Catalog

75 rules, ready to turn on

The rules Fleetscope adds with Add recommended rules, for each tenant you pick. They come turned off: backtest one, then turn it on. Every query below is the one the app runs.

What each group needs

GroupWatchesNeeds in Mimir or LokiRules
ServersCPU, memory, disks, reboots, clocks and the kernel of every server.node-exporter (Alloy or Prometheus) on VMs and nodes17
KubernetesPods, workloads, volumes, nodes, capacity, routes and certificates.kube-state-metrics, cAdvisor and the kubelet; cert-manager and Gateway API metrics for their rules32
MongoDBMembers, primaries, elections, replication lag, the oplog, tickets and connections.mongodb_exporter, with replica set metrics for the rules of a replica set11
Docker on VMsContainers that restart, run out of memory or stop.cAdvisor of the VM (for example in Alloy)4
LogsConnection and crash errors in the logs of a service, 5xx through Envoy and nginx, and logs that stopped.Loki6
Domains and SSLDomains that fail or answer 5xx, and certificates close to expiry.the blackbox exporter probing your domains3
Argo CDApplications Missing, Degraded or out of sync.the metrics of Argo CD2

Reads

Mimir (PromQL) and Loki (LogQL), each with its tenants, over an in-cluster service or HTTPS.

Opens in

Grafana Explore: every alert links to its query on the data source of its tenant.

Tells

Telegram (with topics), Slack and Google Chat, with a backup channel when one fails.

The library

Servers 17 rules · needs node-exporter (Alloy or Prometheus) on VMs and nodes

Node CPU high

PromQL · Mimir

Warning > 80%, Critical > 90% for 5 min

The CPU of the server has been busy for a quarter of an hour. Find what uses it, look for a runaway or a job that runs too often, or add capacity.

Query
PromQL
# used
sum by (cluster, node) (1 - rate(node_cpu_seconds_total{mode="idle"}[15m]))

# max (the number is 100 × used ÷ max)
count by (cluster, node) (node_cpu_seconds_total{mode="idle"})

Node memory high

PromQL · Mimir

Warning > 85%, Critical > 95% for 5 min

The server uses almost all its memory and the kernel will start killing processes. Find the biggest consumers, or add memory.

Query
PromQL
# used
sum by (cluster, node) (node_memory_MemTotal_bytes - node_memory_MemAvailable_bytes)

# max (the number is 100 × used ÷ max)
sum by (cluster, node) (node_memory_MemTotal_bytes)

Disk almost full

PromQL · Mimir

Warning > 80%, Critical > 90% for 5 min

A disk of the server is almost full (one alert for each disk, however many places it is mounted on). Clean old logs, images and temporary files, or grow the disk.

Query
PromQL
# used
max by (cluster, node, device) (node_filesystem_size_bytes{fstype!~"tmpfs|overlay|squashfs|nsfs|ramfs|devtmpfs|autofs|fuse.*"} - node_filesystem_avail_bytes{fstype!~"tmpfs|overlay|squashfs|nsfs|ramfs|devtmpfs|autofs|fuse.*"})

# max (the number is 100 × used ÷ max)
max by (cluster, node, device) (node_filesystem_size_bytes{fstype!~"tmpfs|overlay|squashfs|nsfs|ramfs|devtmpfs|autofs|fuse.*"})

Server not reporting

PromQL · Mimir

Fires when the condition holds for 2 min · Critical

Mimir cannot scrape the node-exporter of the VM: it is down, rebooting, or cut off from the network. Check it in the cloud console. A Kubernetes node is watched by "Kubernetes node not ready" instead: a node the autoscaler removed would stay open here.

Query
PromQL
max by (cluster, node, instance) (up{job=~".*node.?exporter.*", cluster=""})

Disk out of inodes

PromQL · Mimir

Warning > 90%, Critical > 97% for 5 min

A disk of the server is running out of inodes: new files cannot be created even with free space. Find the directories with many small files (caches, sessions, logs).

Query
PromQL
# used
max by (cluster, node, device) (node_filesystem_files{fstype!~"tmpfs|overlay|squashfs|nsfs|ramfs|devtmpfs|autofs|fuse.*"} - node_filesystem_files_free{fstype!~"tmpfs|overlay|squashfs|nsfs|ramfs|devtmpfs|autofs|fuse.*"})

# max (the number is 100 × used ÷ max)
max by (cluster, node, device) (node_filesystem_files{fstype!~"tmpfs|overlay|squashfs|nsfs|ramfs|devtmpfs|autofs|fuse.*"})

Swap in use

PromQL · Mimir

Warning > 50%, Critical > 80% for 10 min

The server swaps: it has run out of memory and is slow. Find what uses the memory, or add memory.

Query
PromQL
# used
sum by (cluster, node) (node_memory_SwapTotal_bytes - node_memory_SwapFree_bytes)

# max (the number is 100 × used ÷ max)
sum by (cluster, node) (node_memory_SwapTotal_bytes)

Processes stalled on memory

PromQL · Mimir

Warning > 1%, Critical > 5% for 5 min

Every process of the server waits for memory part of the time (memory pressure): it is close to running out. Find what grows, or add memory.

Query
PromQL
100 * max by (cluster, node) (rate(node_pressure_memory_stalled_seconds_total[10m]))

Processes stalled on the disk

PromQL · Mimir

Warning > 20%, Critical > 50% for 5 min

Every process of the server waits for the disk a large part of the time. Find what reads or writes, or use a faster disk.

Query
PromQL
100 * max by (cluster, node) (rate(node_pressure_io_stalled_seconds_total[10m]))

Network errors

PromQL · Mimir

Warning > 5/s for 10 min

The network cards of the server count errors. Check the interface, the driver and the link.

Query
PromQL
sum by (cluster, node) (rate(node_network_receive_errs_total[5m]) + rate(node_network_transmit_errs_total[5m]))

Server rebooted

PromQL · Mimir

Warning < 600 s

The server started less than 10 minutes ago. Check whether it was planned (an upgrade, a Spot reclaim) or a crash. A Kubernetes node the autoscaler has just added is not counted.

Query
PromQL
(time() - max by (cluster, node) (node_boot_time_seconds)) unless on (cluster, node) (time() - max by (cluster, node) (kube_node_created) < 1800)

Clock out of sync

PromQL · Mimir

Warning > 0.1 s, Critical > 1 s for 10 min

The clock of the server is off: TLS, tokens and logs depend on it. Check the time service (chrony, systemd-timesyncd).

Query
PromQL
max by (cluster, node) (abs(node_timex_offset_seconds))

VM metrics stopped

PromQL · Mimir

Fires when the condition holds for 10 min · Warning

The node-exporter of the VM sends nothing to Mimir any more: it was stopped, the VM was removed, or Alloy no longer scrapes it. Its CPU, memory and disk rules are blind. A Warning, because a VM that was removed on purpose does the same.

Query
PromQL
max by (node) (max_over_time(node_uname_info{cluster=""}[1d])) unless max by (node) (node_uname_info{cluster=""})

Kernel killed a process (out of memory)

PromQL · Mimir

Warning > 0, Critical > 3

The kernel killed a process of the VM because it ran out of memory in the last 10 minutes. Find what grew (dmesg shows the victim), then raise the memory or the limit of that process.

Query
PromQL
max by (cluster, node) (increase(node_vmstat_oom_kill{cluster=""}[10m]))

Connection tracking table almost full

PromQL · Mimir

Warning > 80%, Critical > 95% for 5 min

The kernel table that tracks connections is almost full: new connections are dropped. Find the source of the many connections, or raise net.netfilter.nf_conntrack_max.

Query
PromQL
# used
max by (cluster, node) (node_nf_conntrack_entries)

# max (the number is 100 × used ÷ max)
max by (cluster, node) (node_nf_conntrack_entries_limit)

File descriptors almost used up

PromQL · Mimir

Warning > 80%, Critical > 95% for 5 min

The server has opened almost all the file descriptors the kernel allows: programs will fail to open files or sockets. Find the process with the most open files (lsof) or raise fs.file-max.

Query
PromQL
# used
max by (cluster, node) (node_filefd_allocated)

# max (the number is 100 × used ÷ max)
max by (cluster, node) (node_filefd_maximum)

Disk will be full soon

PromQL · Mimir

Warning < 172800 s, Critical < 43200 s for 30 min

At the pace it filled over the last 6 hours, the disk runs out of space within this time. Find what grows (logs, data, images) and clean up or grow the disk.

Query
PromQL
max by (cluster, node, device) (node_filesystem_avail_bytes{fstype!~"tmpfs|overlay|squashfs|nsfs|ramfs|devtmpfs|autofs|fuse.*"}) / clamp_min(-min by (cluster, node, device) (deriv(node_filesystem_avail_bytes{fstype!~"tmpfs|overlay|squashfs|nsfs|ramfs|devtmpfs|autofs|fuse.*"}[6h])), 1)

Disk turned read-only

PromQL · Mimir

Fires when the condition holds for 5 min · Critical

A file system of the VM is mounted read-only: the kernel usually does this after disk errors, and programs can no longer write. Read dmesg, check the disk, and remount or repair it.

Query
PromQL
max by (cluster, node, device) (node_filesystem_readonly{cluster="", fstype!~"tmpfs|overlay|squashfs|nsfs|ramfs|devtmpfs|autofs|fuse.*"})

Kubernetes 32 rules · needs kube-state-metrics, cAdvisor and the kubelet; cert-manager and Gateway API metrics for their rules

Kubernetes node not ready

PromQL · Mimir

Fires when the condition holds for 2 min · Critical

The node stopped reporting Ready. Check it in the cloud console and its kubelet; workloads on it are being moved.

Query
PromQL
max by (cluster, node) (kube_node_status_condition{condition="Ready",status="true"})

Kubernetes node under pressure

PromQL · Mimir

Fires when the condition holds for 2 min · Critical

The node is short of memory, disk or process IDs and may evict pods. Free resources or add capacity.

Query
PromQL
max by (cluster, node, condition) (kube_node_status_condition{condition=~"MemoryPressure|DiskPressure|PIDPressure",status="true"})

Container in CrashLoopBackOff

PromQL · Mimir

Fires when the condition holds for 5 min · Critical

The container keeps exiting. Read its previous log to see why, then fix the command, configuration or probe.

Query
PromQL
(max by (cluster, namespace, pod, container) (max_over_time(kube_pod_container_status_waiting_reason{reason="CrashLoopBackOff"}[5m]))) * on (cluster, namespace, pod) group_left (node) max by (cluster, namespace, pod, node) (kube_pod_info)

Image cannot be pulled

PromQL · Mimir

Fires when the condition holds for 5 min · Critical

Check the image name and tag, and that the cluster can pull it (registry access, imagePullSecrets).

Query
PromQL
(max by (cluster, namespace, pod, container) (max_over_time(kube_pod_container_status_waiting_reason{reason=~"ImagePullBackOff|ErrImagePull"}[5m]))) * on (cluster, namespace, pod) group_left (node) max by (cluster, namespace, pod, node) (kube_pod_info)

Container OOMKilled

PromQL · Mimir

Fires when the condition holds · Critical

The container used more memory than its limit and was killed. Raise the memory limit or find what grows in it.

Query
PromQL
(sum by (cluster, namespace, pod, container) (increase(kube_pod_container_status_restarts_total[15m])) and on (cluster, namespace, pod, container) (max by (cluster, namespace, pod, container) (kube_pod_container_status_last_terminated_reason{reason="OOMKilled"}) == 1)) * on (cluster, namespace, pod) group_left (node) max by (cluster, namespace, pod, node) (kube_pod_info)

Container restarts often

PromQL · Mimir

Warning >= 3, Critical >= 10

The container restarted several times in the last hour. Read its previous log and its events to find the cause.

Query
PromQL
(sum by (cluster, namespace, pod) (increase(kube_pod_container_status_restarts_total[1h]))) * on (cluster, namespace, pod) group_left (node) max by (cluster, namespace, pod, node) (kube_pod_info)

Pod pending

PromQL · Mimir

Fires when the condition holds for 5 min · Critical

The pod has stayed Pending for more than 5 minutes (a pod running its init containers is not counted). Check its events: usually not enough CPU or memory, a node selector nothing matches, or an unbound volume.

Query
PromQL
(max by (cluster, namespace, pod) (kube_pod_status_phase{phase="Pending"}) unless on (cluster, namespace, pod) (max by (cluster, namespace, pod) (kube_pod_init_container_status_running) == 1)) * on (cluster, namespace, pod) group_left (node) max by (cluster, namespace, pod, node) (kube_pod_info)

Container near its memory limit

PromQL · Mimir

Warning > 90%, Critical > 97% for 5 min

The container uses almost all the memory it may use and will be OOMKilled at the limit. Raise the limit or find what grows.

Query
PromQL
# used
(max by (cluster, namespace, pod, container) (container_memory_working_set_bytes{container!="",container!="POD"})) * on (cluster, namespace, pod) group_left (node) max by (cluster, namespace, pod, node) (kube_pod_info)

# max (the number is 100 × used ÷ max)
(max by (cluster, namespace, pod, container) (kube_pod_container_resource_limits{resource="memory"})) * on (cluster, namespace, pod) group_left (node) max by (cluster, namespace, pod, node) (kube_pod_info)

Deployment has unavailable replicas

PromQL · Mimir

Warning > 0 for 10 min

Some replicas are not ready. Look at the pods of the workload for crashes, pending pods or failing readiness probes.

Query
PromQL
max by (cluster, namespace, deployment) (kube_deployment_status_replicas_unavailable)

Autoscaler at its maximum

PromQL · Mimir

Fires when the condition holds for 30 min · Critical

The autoscaler has run as many replicas as it may for 30 minutes. If the load keeps growing it cannot follow: raise maxReplicas or the requests it scales on.

Query
PromQL
max by (cluster, namespace, horizontalpodautoscaler) (kube_horizontalpodautoscaler_status_current_replicas) - max by (cluster, namespace, horizontalpodautoscaler) (kube_horizontalpodautoscaler_spec_max_replicas)

Volume almost full

PromQL · Mimir

Warning > 85%, Critical > 95% for 5 min

The persistent volume is almost full and the workload will fail to write. Grow the claim or clean the data.

Query
PromQL
# used
max by (cluster, namespace, persistentvolumeclaim) (kubelet_volume_stats_used_bytes)

# max (the number is 100 × used ÷ max)
max by (cluster, namespace, persistentvolumeclaim) (kubelet_volume_stats_capacity_bytes)

Cluster almost out of CPU to schedule

PromQL · Mimir

Warning > 85%, Critical > 92% for 10 min

The pods ask for most of the CPU the nodes can give: the next pod or a rollout may stay Pending. Add nodes or lower requests far above real use.

Query
PromQL
# used
sum by (cluster) (kube_pod_container_resource_requests{resource="cpu"} * on (cluster, namespace, pod) group_left () (max by (cluster, namespace, pod) (kube_pod_status_phase{phase=~"Pending|Running"}) == 1))

# max (the number is 100 × used ÷ max)
sum by (cluster) (kube_node_status_allocatable{resource="cpu"} unless on (cluster, node) (max by (cluster, node) (kube_node_spec_unschedulable) == 1))

Cluster almost out of memory to schedule

PromQL · Mimir

Warning > 85%, Critical > 92% for 10 min

The pods ask for most of the memory the nodes can give: the next pod or a rollout may stay Pending. Add nodes or lower requests far above real use.

Query
PromQL
# used
sum by (cluster) (kube_pod_container_resource_requests{resource="memory"} * on (cluster, namespace, pod) group_left () (max by (cluster, namespace, pod) (kube_pod_status_phase{phase=~"Pending|Running"}) == 1))

# max (the number is 100 × used ÷ max)
sum by (cluster) (kube_node_status_allocatable{resource="memory"} unless on (cluster, node) (max by (cluster, node) (kube_node_spec_unschedulable) == 1))

Deployment has no ready replica

PromQL · Mimir

Fires when the condition holds for 2 min · Critical

None of the replicas of the workload is available: the service is down. Look at its pods for crashes, pending pods or failing probes.

Query
PromQL
(max by (cluster, namespace, deployment) (kube_deployment_status_replicas_available) == 0) and on (cluster, namespace, deployment) (max by (cluster, namespace, deployment) (kube_deployment_spec_replicas) > 0)

StatefulSet has replicas not ready

PromQL · Mimir

Warning > 0 for 10 min

Some replicas of the StatefulSet are not ready. Look at its pods and their volumes.

Query
PromQL
max by (cluster, namespace, statefulset) (kube_statefulset_status_replicas) - max by (cluster, namespace, statefulset) (kube_statefulset_status_replicas_ready)

DaemonSet pods unavailable

PromQL · Mimir

Warning > 0 for 10 min

The DaemonSet does not run on some nodes. Look at its pods on those nodes (taints, resources, image).

Query
PromQL
max by (cluster, namespace, daemonset) (kube_daemonset_status_number_unavailable)

Pod running but not ready

PromQL · Mimir

Fires when the condition holds for 10 min · Warning

The pod runs but fails its readiness probe, so it gets no traffic. Look at the probe and the log of the pod.

Query
PromQL
(max by (cluster, namespace, pod) (kube_pod_status_ready{condition="false"}) and on (cluster, namespace, pod) (max by (cluster, namespace, pod) (kube_pod_status_phase{phase="Running"}) == 1)) * on (cluster, namespace, pod) group_left (node) max by (cluster, namespace, pod, node) (kube_pod_info)

Job failed

PromQL · Mimir

Warning > 0

A Job failed: it ran out of retries or of time (a pod that failed before a retry succeeded does not count). Read the log of its last pod; a CronJob runs it again at its next time.

Query
PromQL
max by (cluster, namespace, job_name) (kube_job_failed{condition="true"})

Container throttled on CPU

PromQL · Mimir

Warning > 50% for 15 min

The container hits its CPU limit and is slowed down most of the time. Raise the CPU limit or find what uses the CPU.

Query
PromQL
(100 * sum by (cluster, namespace, pod, container) (rate(container_cpu_cfs_throttled_periods_total{container!=""}[5m])) / sum by (cluster, namespace, pod, container) (rate(container_cpu_cfs_periods_total{container!=""}[5m]))) * on (cluster, namespace, pod) group_left (node) max by (cluster, namespace, pod, node) (kube_pod_info)

Volume out of inodes

PromQL · Mimir

Warning > 90%, Critical > 97% for 5 min

The persistent volume is running out of inodes: new files cannot be created. Find the directories with many small files.

Query
PromQL
# used
max by (cluster, namespace, persistentvolumeclaim) (kubelet_volume_stats_inodes_used)

# max (the number is 100 × used ÷ max)
max by (cluster, namespace, persistentvolumeclaim) (kubelet_volume_stats_inodes)

Kubernetes metrics stopped

PromQL · Mimir

Fires when the condition holds for 5 min · Critical

kube-state-metrics of the cluster sends nothing to Mimir any more: every Kubernetes rule of the cluster is blind. Check kube-state-metrics and the Alloy that scrapes it.

Query
PromQL
count by (cluster) (max_over_time(kube_node_info[1d])) unless count by (cluster) (kube_node_info)

Ingress points to a Service with no ready pod

PromQL · Mimir

Fires when the condition holds for 3 min · Critical

An Ingress sends traffic to a Service that has no ready endpoint: no pod matches its selector, none is ready, or the Service is gone. The domain answers with errors while the pods may look fine. Check the selector of the Service and the readiness of its pods.

Query
PromQL
count by (cluster, namespace, ingress, service_name) (kube_ingress_path{service_name!=""}) unless on (cluster, namespace, service_name) count by (cluster, namespace, service_name) (label_replace(label_replace(kube_endpoint_address{ready="true"}, "service_name", "$1", "endpoint", "(.+)"), "service_name", "$1", "exported_endpoint", "(.+)"))

Gateway not accepted or not programmed

PromQL · Mimir

Fires when the condition holds for 5 min · Critical

The Gateway is not Accepted or not Programmed by its controller: the routes on it may not serve. Read the conditions of the Gateway (kubectl describe gateway) and the log of the controller (Envoy Gateway).

Query
PromQL
min by (cluster, namespace, name, type) (gatewayapi_gateway_status{type=~"Accepted|Programmed"})

Certificate not ready

PromQL · Mimir

Fires when the condition holds for 15 min · Warning

cert-manager reports the Certificate as not ready: the issuance or the renewal failed, and the Secret may hold an expired certificate. Read the events of the Certificate and of its Order or CertificateRequest (kubectl describe certificate).

Query
PromQL
max by (cluster, namespace, name) (certmanager_certificate_ready_status{condition="False"})

Certificate close to expiry

PromQL · Mimir

Warning < 1209600 s, Critical < 432000 s

A Certificate of cert-manager expires soon and has not been renewed: the automatic renewal is failing. Read the events of the Certificate and the log of cert-manager.

Query
PromQL
min by (cluster, namespace, name) (certmanager_certificate_expiration_timestamp_seconds) - time()

PodDisruptionBudget has fewer healthy pods than it needs

PromQL · Mimir

Warning > 0 for 15 min

Fewer pods are healthy than the PodDisruptionBudget asks for: voluntary disruptions, such as a node upgrade, are blocked, and the workload has less redundancy than intended. Look at the pods the budget selects.

Query
PromQL
max by (cluster, namespace, poddisruptionbudget) (kube_poddisruptionbudget_status_desired_healthy - kube_poddisruptionbudget_status_current_healthy)

Deployment rollout is stuck

PromQL · Mimir

Fires when the condition holds for 5 min · Warning

The rollout of the Deployment passed its progress deadline: the new pods do not become ready (image, probe, resources or quota). The old pods may still serve. Look at the new ReplicaSet and its pods.

Query
PromQL
max by (cluster, namespace, deployment) (kube_deployment_status_condition{condition="Progressing",status="false"})

Volume will be full soon

PromQL · Mimir

Warning < 172800 s, Critical < 43200 s for 30 min

At the pace it filled over the last 6 hours, the volume runs out of space within this time. Grow the claim or clean up before it is full.

Query
PromQL
max by (cluster, namespace, persistentvolumeclaim) (kubelet_volume_stats_available_bytes) / clamp_min(-min by (cluster, namespace, persistentvolumeclaim) (deriv(kubelet_volume_stats_available_bytes[6h])), 1)

Volume claim not bound

PromQL · Mimir

Fires when the condition holds for 10 min · Warning

The claim is Pending (no volume matches it, or the StorageClass cannot make one) or Lost (its volume is gone). The pods that mount it cannot start. Read the events of the claim.

Query
PromQL
max by (cluster, namespace, persistentvolumeclaim, phase) (kube_persistentvolumeclaim_status_phase{phase=~"Pending|Lost"})

Container cannot be created

PromQL · Mimir

Fires when the condition holds for 5 min · Critical

Kubernetes cannot create the container: a ConfigMap or Secret it reads is missing, the image name is wrong, or the runtime refused it. Read the events of the pod.

Query
PromQL
(max by (cluster, namespace, pod, container, reason) (max_over_time(kube_pod_container_status_waiting_reason{reason=~"CreateContainerConfigError|CreateContainerError|InvalidImageName|RunContainerError"}[5m]))) * on (cluster, namespace, pod) group_left (node) max by (cluster, namespace, pod, node) (kube_pod_info)

Node cordoned for long

PromQL · Mimir

Fires when the condition holds for 2 h · Warning

The node takes no new pod for more than 2 hours. Uncordon it if the maintenance is over, or drain and remove it.

Query
PromQL
max by (cluster, node) (kube_node_spec_unschedulable)

Autoscaler cannot read its metrics

PromQL · Mimir

Fires when the condition holds for 15 min · Warning

The autoscaler cannot get the metrics it scales on, so it does not scale. Check metrics-server (or the adapter of custom metrics) and the requests of the pods.

Query
PromQL
max by (cluster, namespace, horizontalpodautoscaler) (kube_horizontalpodautoscaler_status_condition{condition="ScalingActive",status="false"})

MongoDB 11 rules · needs mongodb_exporter, with replica set metrics for the rules of a replica set

MongoDB down

PromQL · Mimir

Fires when the condition holds for 1 min · Critical

The exporter cannot reach mongod: it is stopped, crashed or refusing connections. Check the service on the VM and its log.

Query
PromQL
max by (cluster_name, node) (mongodb_up)

MongoDB replication lag

PromQL · Mimir

Warning > 120 s, Critical > 600 s for 2 min

A secondary is behind the primary. Look for a slow disk or network on it, or a burst of writes on the primary.

Query
PromQL
max by (cluster_name, name) (mongodb_mongod_replset_member_replication_lag{state="SECONDARY"})

MongoDB operations queued

PromQL · Mimir

Warning > 10, Critical > 25 for 10 min

Operations wait for a lock. Find the slow queries or the writes that hold it.

Query
PromQL
sum by (cluster_name, node) (avg_over_time(mongodb_mongod_global_lock_current_queue[5m]))

MongoDB replica set has no primary

PromQL · Mimir

Fires when the condition holds for 1 min · Critical

No member of the replica set is primary: writes fail. Check which members are up and the log of the last primary.

Query
PromQL
count by (cluster_name) (mongodb_mongod_replset_my_state == 1) or (count by (cluster_name) (mongodb_mongod_replset_my_state) * 0)

MongoDB connections near the limit

PromQL · Mimir

Warning > 80%, Critical > 90% for 5 min

mongod accepts few more connections. Find the clients that open too many (pool size) or raise maxIncomingConnections.

Query
PromQL
# used
max by (cluster_name, node) (mongodb_connections{state="current"})

# max (the number is 100 × used ÷ max)
max by (cluster_name, node) (mongodb_connections{state="current"}) + max by (cluster_name, node) (mongodb_connections{state="available"})

MongoDB metrics stopped

PromQL · Mimir

Fires when the condition holds for 5 min · Critical

The mongodb-exporter of the member sends nothing to Mimir any more: every MongoDB rule of it is blind. Check the exporter on the VM and the Alloy that scrapes it.

Query
PromQL
max by (cluster_name, node) (max_over_time(mongodb_up[1d])) unless max by (cluster_name, node) (mongodb_up)

MongoDB member not healthy

PromQL · Mimir

Fires when the condition holds for 2 min · Critical

A member of the replica set is neither primary, secondary nor arbiter: it is down, recovering, rolling back or starting. The replica set has less redundancy until it is back. Read the log of mongod on that member.

Query
PromQL
(max by (cluster_name, name) (mongodb_mongod_replset_member_state) != 1 != 2 != 7) * 0 + 1

MongoDB election

PromQL · Mimir

Warning > 0

The replica set elected a primary in the last 15 minutes: the former primary stepped down, failed or lost the network. Check why, and that the applications reconnected.

Query
PromQL
max by (cluster_name) (increase(mongodb_mongod_replset_term[15m]))

MongoDB restarted

PromQL · Mimir

Warning < 600 s

mongod started less than 10 minutes ago. Check whether it was planned or a crash (the log of mongod, an OOM kill of the VM).

Query
PromQL
min by (cluster_name, node) (mongodb_instance_uptime_seconds)

MongoDB oplog window short

PromQL · Mimir

Warning < 86400 s, Critical < 21600 s for 30 min

The oplog holds less than this time of writes: a secondary that is down longer than that cannot catch up and needs a full resync. Grow the oplog (replSetResizeOplog) or lower the write load.

Query
PromQL
max by (cluster_name, node) (mongodb_mongod_replset_oplog_head_timestamp - mongodb_mongod_replset_oplog_tail_timestamp)

MongoDB out of WiredTiger tickets

PromQL · Mimir

Warning > 80%, Critical > 95% for 5 min

Almost all the read or write tickets of WiredTiger are in use: new operations wait in a queue. Look for slow operations, a missing index or a disk that cannot keep up.

Query
PromQL
# used
max by (cluster_name, node, type) (mongodb_mongod_wiredtiger_concurrent_transactions_out_tickets)

# max (the number is 100 × used ÷ max)
max by (cluster_name, node, type) (mongodb_mongod_wiredtiger_concurrent_transactions_total_tickets)

Docker on VMs 4 rules · needs cAdvisor of the VM (for example in Alloy)

Docker container restarting

PromQL · Mimir

Warning >= 2, Critical >= 4

The container started again several times in 15 minutes: it crashes and Docker (or its restart policy) starts it again. Read its log (docker logs) and the exit code (docker inspect).

Query
PromQL
max by (node, container) (changes(container_start_time_seconds{job=~".*cadvisor.*", container!="", pod=""}[15m]))

Docker container OOMKilled

PromQL · Mimir

Critical > 0

The kernel killed a process of the container because it went over its memory limit in the last 10 minutes. Raise the limit (--memory) or find what grows in it.

Query
PromQL
max by (node, container) (increase(container_oom_events_total{job=~".*cadvisor.*", container!="", pod=""}[10m]))

Docker container near its memory limit

PromQL · Mimir

Warning > 90%, Critical > 97% for 5 min

The container uses almost all the memory its limit allows: next it is killed. Raise the limit or find what grows in it.

Query
PromQL
# used
max by (node, container) (container_memory_working_set_bytes{job=~".*cadvisor.*", container!="", pod=""})

# max (the number is 100 × used ÷ max)
max by (node, container) (container_spec_memory_limit_bytes{job=~".*cadvisor.*", container!="", pod=""} > 0)

Docker container stopped

PromQL · Mimir

Fires when the condition holds for 5 min · Warning

A container that ran in the last hour is gone: it stopped, exited or was removed. If it should run, start it and read its log; a container of a CI job or one removed on purpose closes by itself within the hour.

Query
PromQL
max by (node, container) (max_over_time(container_memory_working_set_bytes{job=~".*cadvisor.*", container!="", pod=""}[1h])) unless max by (node, container) (container_memory_working_set_bytes{job=~".*cadvisor.*", container!="", pod=""})

Logs 6 rules · needs Loki

Connection errors in logs

LogQL · Loki

Warning > 10, Critical > 30

The service writes that it cannot reach something (a database, another service, DNS). The newest line is in the alert: check that the target runs and is reachable, its address and its limits.

Query
LogQL
sum by (cluster, namespace, app) (count_over_time({cluster=~".+"} != "upstream_status" != "response_flags" !~ "count_over_time|/loki/api/" |~ `(?i)(connection refused|connection reset|connection timed out|could not connect|couldn't connect|failed to connect|unable to connect|no route to host|i/o timeout|ECONNREFUSED|ECONNRESET|ETIMEDOUT|EHOSTUNREACH|no such host|temporary failure in name resolution|too many connections|server selection error|server selection timeout|server selection timed out|MongoServerSelectionError|MongoNetworkError|communications link failure|connection is not available|getaddrinfo ENOTFOUND|name or service not known|database system is starting up)` [5m]))

Crash errors in logs

LogQL · Loki

Warning > 0, Critical > 10

The service writes an error that kills it (a panic, a fatal error, out of memory). The newest line is in the alert: read the lines around it on the Loki page.

Query
LogQL
sum by (cluster, namespace, app) (count_over_time({cluster=~".+"} |~ `(panic:|fatal error:|OutOfMemoryError|Unhandled exception|SIGSEGV|segmentation fault|Out of memory|out of memory: Killed process)` !~ "count_over_time|/loki/api/" [5m]))

Logs stopped

LogQL · Loki

Fires when the condition holds for 5 min · Critical

The cluster sent logs to Loki an hour ago and none in the last 10 minutes: every log rule of it is blind. Check the Alloy that ships the logs of the cluster.

Query
LogQL
sum by (cluster) (count_over_time({cluster=~".+"}[1h] offset 15m)) unless sum by (cluster) (count_over_time({cluster=~".+"}[10m]))

HTTPRoute has no healthy backend

LogQL · Loki

Warning > 0, Critical > 10

Envoy answers the route with no healthy upstream (UH) or cannot connect to it (UF): the Service behind the HTTPRoute has no ready pod, or its pods refuse connections. Check the backendRefs of the route, the selector of the Service and the readiness of its pods.

Query
LogQL
sum by (cluster, route_namespace, route) (count_over_time({cluster=~".+"} |= `response_flags` !~ "count_over_time|/loki/api/" | regexp `"route_name":"httproute/(?P<route_namespace>[^/]+)/(?P<route>[^/]+)/` | json flags="response_flags" | flags=~`.*(UH|UF).*` [5m]))

Errors through Envoy Gateway

LogQL · Loki

Warning >= 5%, Critical >= 20%

Many requests to the domain end in a 5xx through Envoy Gateway (more than 50 requests in 5 minutes). Find the service behind it and read its log; a deploy or a dependency is the usual cause.

Query
LogQL
100 * sum by (cluster, domain) (count_over_time({cluster=~".+"} |= `response_flags` !~ "count_over_time|/loki/api/" | json domain=`[":authority"]`, code="response_code" | code >= 500 | domain != "" | domain !~ "^[0-9.:]+$" [5m])) / (sum by (cluster, domain) (count_over_time({cluster=~".+"} |= `response_flags` !~ "count_over_time|/loki/api/" | json domain=`[":authority"]` [5m])) > 50)

Errors through the nginx proxy

LogQL · Loki

Warning >= 5%, Critical >= 20%

Many requests to the domain end in a 5xx through the nginx proxy (more than 50 requests in 5 minutes). upstream_status in the log tells whether the service behind answered the error or could not be reached.

Query
LogQL
100 * sum by (cluster, domain) (count_over_time({cluster=~".+"} |= `upstream_status` !~ "count_over_time|/loki/api/" | json domain="host", code="status" | code >= 500 | domain != "" | domain !~ "^[0-9.:]+$" [5m])) / (sum by (cluster, domain) (count_over_time({cluster=~".+"} |= `upstream_status` !~ "count_over_time|/loki/api/" | json domain="host" [5m])) > 50)

Domains and SSL 3 rules · needs the blackbox exporter probing your domains

Domain answers with a server error

PromQL · Mimir

Critical >= 500 for 1 min

The domain answers with an HTTP status of 500 or more: the load balancer or the application behind it is failing. Look at the service the domain points to and its logs.

Query
PromQL
max by (cluster, job, instance) (probe_http_status_code{job=~".*blackbox.*"})

Domain check failing

PromQL · Mimir

Fires when the condition holds for 2 min · Critical

The probe of the domain fails without a server error: it cannot be reached, the TLS handshake fails, or it does not answer with the status the probe expects. Check the DNS, the load balancer and the service behind it; if it works from your own network, check whether it allows only some addresses.

Query
PromQL
min by (cluster, job, instance) (probe_success{job=~".*blackbox.*"}) unless on (cluster, job, instance) (max by (cluster, job, instance) (probe_http_status_code{job=~".*blackbox.*"}) >= 500)

Domain certificate close to expiry

PromQL · Mimir

Warning < 2592000 s, Critical < 1209600 s

The TLS certificate the domain presents expires soon, or has expired. A certificate bought outside is renewed by hand, which takes an order and a change window: start now. One renewal covers every domain that uses the certificate.

Query
PromQL
min by (cluster, job, instance) (probe_ssl_earliest_cert_expiry{job=~".*blackbox.*"}) - time()

Argo CD 2 rules · needs the metrics of Argo CD

ArgoCD application Missing or Degraded

PromQL · Mimir

Fires when the condition holds for 15 min · Critical

Some resources of the application are missing from the cluster or do not work (Degraded): the service may be down or never deployed. Open the application in ArgoCD and look at its resources that are not Healthy. A production application (a name with "-prod.") is Critical.

Query
PromQL
2 * max by (name, project, dest_namespace, health_status) (argocd_app_info{health_status=~"Missing|Degraded", name=~".*-prod[.].*"}) or max by (name, project, dest_namespace, health_status) (argocd_app_info{health_status=~"Missing|Degraded"})

ArgoCD application out of sync

PromQL · Mimir

Fires when the condition holds for 1 h · Warning

The cluster differs from Git for more than an hour: a sync failed, auto-sync is off, or something changes the resources after the sync (an autoscaler, a controller). Sync it, or add ignoreDifferences for a field that is meant to change.

Query
PromQL
max by (name, project, dest_namespace) (argocd_app_info{sync_status="OutOfSync"})