Monitoring and alerting
Connect the Backend to the monitoring of the company and set the alerts that show a problem before users see it.
The BackendBackend — The server program of Platforma. It keeps the projects, runs the Blocks and starts jobs. Glossary gives a health check, metrics and logs, so you can connect it to the monitoring that the company already has: Prometheus, the monitoring of the cloud, or systemd. This page tells where each signal is, which alerts to set, and how to find the cost of the installation in the cloud bill.
Health of the Backend
The main check is /health on the metrics port, 9090 by default. It answers 200 when the
Backend is ready and 503 when it is not ready. When TLS is on, this port serves HTTPS only.
The probes of the pod use this check: the readiness probe asks /health, and the liveness probe
asks /health?service=GRPC, so KubernetesKubernetes — A system that runs programs on a group of machines (a cluster). Platforma can run in a Kubernetes cluster. Glossary restarts the Backend when its gRPC service stops.
kubectl --namespace <namespace> get deployment <release>kubectl --namespace <namespace> get events --field-selector type=WarningThe metrics port listens on 127.0.0.1. On the server:
curl --insecure https://127.0.0.1:9090/healthsystemctl status platformasystemctl show platforma --property=NRestartsWithout TLS, use http://. The unit has Restart=on-failure: systemd starts the Backend again
after a failure, so count the restarts.
From outside, the gRPC health check on the entry pointentry point — The way in to the Backend from outside the cluster, a load balancer or an Ingress with a DNS name. It usually ends TLS and sends the traffic to the Backend pod. Glossary (port 6345 in Single Server modeSingle Server mode — The mode in which the Backend and all its jobs run on one Linux machine, the server, with no Kubernetes cluster. Glossary, 443
through the entry point of the cluster) shows that clients can reach the Backend. It does not need
a sign-insign in — To show the Backend who you are, with a sign-in provider or a single-user token. The verb is "sign in"; the noun and the adjective are "sign-in". Glossary. See Verify the installation.
Metrics
A collector scrapes /metrics on the same port, in the Prometheus format. For the address and the
most useful metrics, see Metrics.
Logs
The Backend writes its full log to the logs disk, /var/log/platforma in the pod.
kubectl logs shows only the short start log. When the logs disk is off, the full log goes to the
output of the pod.
The full log is in /data/platforma/log/. Errors before the Backend opens its log are in the
journal: journalctl -u platforma.
Errors have "level":"error". To collect logs for support, see Get help.
Alerts to set
| Alert | Signal | What it means |
|---|---|---|
| Backend not ready for some minutes | /health answers 503, or the pod is not Ready |
Users cannot connect |
| Restart loop | The pod is in CrashLoopBackOff; in Single Server mode, NRestarts grows |
The Backend cannot start. With --fail-fast-on-invalid-license, a license that is not valid also stops the start: see License |
| Database disk fills up | Free space of the claim <release>-database (Single Server mode: the disk of the data folder) |
The Backend keeps all its state there |
| Logs disk fills up | Free space of the claim <release>-logs (Single Server mode: the disk of the data folder) |
The Backend cannot write its log |
| Workspaceworkspace — The storage where the Backend and all jobs keep the working files of running jobs. The Backend and the jobs use it at the same time. In Kubernetes, it is a network file system; in Single Server mode, it is a folder on the server. Glossary fills up | Free space of the claim <release>-workspace (Single Server mode: the disk of the data folder) |
Jobsjob — One run of a tool on data. The Backend starts jobs on the server where it runs, or in a Kubernetes cluster. Glossary cannot write their working files and fail. On Google Cloud, the Filestore instance of the workspace has a fixed size: the Terraform modulesTerraform modules — The Terraform code that MiLaboratories provides to install Platforma. The cloud-specific Terraform modules make the cluster and its cloud parts in AWS or Google Cloud; the cloud-agnostic Terraform modules install Platforma into the cluster. Glossary make 1024 GiB by default, and the installer sets the size from the deployment size. On AWS, EFS grows by itself |
| Job pods wait for a long time | Job pods are Pending, or KueueKueue — A Kubernetes add-on that holds jobs in a queue until the cluster has free CPU, memory and GPU for them. Glossary does not admit their workloads |
Analyses do not start. The Desktop AppDesktop App — The program that each user installs on their own computer to work with Platforma. It is a client of the Backend. Glossary also shows the load of the queue on its server icon: see A job waits or hangs |
| Certificate is close to its expiry | The expiry date of the certificate of the entry point | The Desktop App cannot connect after the expiry |
| Storage errors | pl_objfs_transfers_total{result="failed"} or pl_objfs_calls_total{result="error"} grows |
The Backend cannot read or write the primary storageprimary storage — The bucket (Amazon S3 or Google Cloud Storage) or folder where Platforma keeps all results and uploaded files. Glossary, when it is a bucket. Jobs and file transfers fail |
| API errors | grpc_server_handled_total with a grpc_code other than OK and Canceled grows fast |
Requests of the Desktop App fail |
In Kubernetes, the free space of a volume comes from the metrics of the kubelet
(kubelet_volume_stats_available_bytes), with the name of the claim in the label
persistentvolumeclaim. <release> is the name of the Helm release of the Backend, platforma
by default. In Single Server mode, the database, the logs and the working
folders of the jobs are all in the data folder: watch the free space of its disk.
Rules in the monitoring of the company
The alerts use the metrics of the Backend and the standard metrics of the cluster or the server. Write them as rules of the alerting tool that the company uses.
The example is a PrometheusRule of the Prometheus Operatoroperator — The person who installs and runs Platforma in your company, for example an IT engineer or a bioinformatician. Glossary. It needs the metrics of the kubelet
(volumes) and of kube-state-metrics (the Deployment), and a collector that scrapes the Backend.
apiVersion: monitoring.coreos.com/v1kind: PrometheusRulemetadata: name: platforma namespace: <namespace>spec: groups: - name: platforma rules: - alert: PlatformaBackendNotReady expr: kube_deployment_status_replicas_available{namespace="<namespace>", deployment="<release>"} < 1 for: 5m - alert: PlatformaVolumeAlmostFull expr: | kubelet_volume_stats_available_bytes{namespace="<namespace>", persistentvolumeclaim=~"<release>-(database|logs|workspace)"} / kubelet_volume_stats_capacity_bytes < 0.1 for: 15m - alert: PlatformaStorageErrors expr: increase(pl_objfs_transfers_total{result="failed"}[15m]) > 0Watch the state of the unit platforma in systemd, the answer of /health on 127.0.0.1:9090,
and the free space of the disk of the data folder. With Prometheus, the node exporter gives the
free space (node_filesystem_avail_bytes) and, with its systemd collector, the state of the unit.
Cost of the cloud resources
The cloud bill shows the cost of each resource. The tags (AWS) or labels (Google Cloud) that the installation puts on its resources let you filter the bill by installation.
Tool: CloudFormation template
The stack puts the tag platforma with the value of the parameter ClusterName on its resources:
the network, the cluster, the nodes and their boot disks, the bucket and the file system. To
filter the bill by this tag, activate platforma as a cost allocation tag in the Billing console
of AWS. The bill shows the tag only for the costs after the activation.
Tool: install.sh in Cloud Shell
The installer labels the bucket with platform=platforma and cluster=<name>-cluster, and the
database disk with platforma-installation=<name>-cluster and platforma-component=database.
The Google Cloud bill also groups the costs by project: to see the full cost of the installation,
install it in a project of its own.
Tool: platforma-tf-* modules (cloud and cloud-agnostic)
The modules put the same keys on all cloud resources that support them: tags on AWS, labels on Google Cloud.
| Key | Value |
|---|---|
platforma-installation | The input name of the root cloud |
platforma-component | What the resource is for: network, cluster, identity, primary-storage, workspace, entry-point, registry-mirrors, and for the volumes database, logs and scratch |
platforma-node-pool | On the nodes and their disks, in place of platforma-component: system, backend, ui, batch or gpu |
Some resources come from the controllers of the cluster, not from Terraform. They also get the
keys. On AWS, these are the volumes, the access points of the file system and the load balancer.
On Google Cloud, these are the disks of the volumes. To add the keys of the company, such as a cost centre, use the
input tags (AWS) or labels (Google Cloud) of the root cloud. The modules refuse the three keys
of the table in these inputs.
Activate the keys as cost allocation tags in the Billing console of AWS. Then Cost Explorer can group the costs by installation, by component and by node pool, for the costs after the activation. On AWS, the network, the cluster and the IAM roles have the tags too.
The labels go to the bill and to its export to BigQuery. On Google Cloud, the network, the firewall rules, the service accounts and the DNS records do not support labels.
The modules do not create cloud resources on a cluster that exists. The cost is the cost of the cluster: tag it as the company tags its other clusters.
Tool: platforma-backend
The chart does not create cloud resources itself. The volumes come from the StorageClasses of the cluster and the load balancer from its entry point: they get the tags or labels that the cluster gives. The cost is the cost of the cluster and of the bucket.
Tool: platforma binary
The cost is the cost of the server, its disks and the bucket, if the primary storage is a bucket. Tag them in the cloud console when the server is in a cloud.