Managed Service for Prometheus includes alert rules for ARMS, K8s, MongoDB, MySQL, Nginx, and Redis.
ARMS alert rules
Alert name | Expression | Data collection period (minutes) | Alert trigger condition |
PodCpu75 | 100 * (sum(rate(container_cpu_usage_seconds_total[1m])) by (pod_name) / sum(label_replace(kube_pod_container_resource_limits_cpu_cores, "pod_name", "$1", "pod", "(.*)")) by (pod_name))>75 | 7 | The CPU usage of the pod is greater than 75%. |
PodMemory75 | 100 * (sum(container_memory_working_set_bytes) by (pod_name) / sum(label_replace(kube_pod_container_resource_limits_memory_bytes, "pod_name", "$1", "pod", "(.*)")) by (pod_name))>75 | 5 | The memory usage of the pod is greater than 75%. |
pod_status_no_running | sum (kube_pod_status_phase{phase!="Running"}) by (pod,phase) | 5 | The pod is not in the Running state. |
PodMem4GbRestart | (sum (container_memory_working_set_bytes{id!="/"})by (pod_name,container_name) /1024/1024/1024)>4 | 5 | The memory usage of the pod is greater than 4 GB. |
PodRestart | sum (increase (kube_pod_container_status_restarts_total{}[2m])) by (namespace,pod) >0 | 5 | The pod restarts. |
K8s alert rules
Alert name | Expression | Data collection period (minutes) | Alert trigger condition |
KubeStateMetricsListErrors | (sum(rate(kube_state_metrics_list_total{job="kube-state-metrics",result="error"}[5m])) / sum(rate(kube_state_metrics_list_total{job="kube-state-metrics"}[5m]))) > 0.01 | 15 | An error occurs in the metric list. |
KubeStateMetricsWatchErrors | (sum(rate(kube_state_metrics_watch_total{job="kube-state-metrics",result="error"}[5m])) / sum(rate(kube_state_metrics_watch_total{job="kube-state-metrics"}[5m]))) > 0.01 | 15 | An error occurs in the metric watch. |
NodeFilesystemAlmostOutOfSpace | ( node_filesystem_avail_bytes{job="node-exporter",fstype!=""} / node_filesystem_size_bytes{job="node-exporter",fstype!=""} * 100 < 5 and node_filesystem_readonly{job="node-exporter",fstype!=""} == 0 ) | 60 | The node file system is almost out of space. |
NodeFilesystemSpaceFillingUp | ( node_filesystem_avail_bytes{job="node-exporter",fstype!=""} / node_filesystem_size_bytes{job="node-exporter",fstype!=""} * 100 < 40 and predict_linear(node_filesystem_avail_bytes{job="node-exporter",fstype!=""}[6h], 24*60*60) < 0 and node_filesystem_readonly{job="node-exporter",fstype!=""} == 0 ) | 60 | The node file system is running out of space. |
NodeFilesystemFilesFillingUp | ( node_filesystem_files_free{job="node-exporter",fstype!=""} / node_filesystem_files{job="node-exporter",fstype!=""} * 100 < 40 and predict_linear(node_filesystem_files_free{job="node-exporter",fstype!=""}[6h], 24*60*60) < 0 and node_filesystem_readonly{job="node-exporter",fstype!=""} == 0 ) | 60 | The node file system is running out of inodes. |
NodeFilesystemAlmostOutOfFiles | ( node_filesystem_files_free{job="node-exporter",fstype!=""} / node_filesystem_files{job="node-exporter",fstype!=""} * 100 < 3 and node_filesystem_readonly{job="node-exporter",fstype!=""} == 0 ) | 60 | The node file system is almost out of inodes. |
NodeNetworkReceiveErrs | increase(node_network_receive_errs_total[2m]) > 10 | 60 | An error occurs when the node receives network packets. |
NodeNetworkTransmitErrs | increase(node_network_transmit_errs_total[2m]) > 10 | 60 | An error occurs when the node transmits network packets. |
NodeHighNumberConntrackEntriesUsed | (node_nf_conntrack_entries / node_nf_conntrack_entries_limit) > 0.75 | None | A high number of conntrack entries are used. |
NodeClockSkewDetected | ( node_timex_offset_seconds > 0.05 and deriv(node_timex_offset_seconds[5m]) >= 0 ) or ( node_timex_offset_seconds < -0.05 and deriv(node_timex_offset_seconds[5m]) <= 0 ) | 10 | Clock skew is detected. |
NodeClockNotSynchronising | min_over_time(node_timex_sync_status[5m]) == 0 | 10 | The system time is out of sync. |
KubePodCrashLooping | rate(kube_pod_container_status_restarts_total{job="kube-state-metrics"}[15m]) * 60 * 5 > 0 | 15 | The pod is in a crash loop. |
KubePodNotReady | sum by (namespace, pod) (max by(namespace, pod) (kube_pod_status_phase{job="kube-state-metrics", phase=~"Pending|Unknown"}) * on(namespace, pod) group_left(owner_kind) max by(namespace, pod, owner_kind) (kube_pod_owner{owner_kind!="Job"})) > 0 | 15 | The pod is not ready. |
KubeDeploymentGenerationMismatch | kube_deployment_status_observed_generation{job="kube-state-metrics"} != kube_deployment_metadata_generation{job="kube-state-metrics"} | 15 | A deployment generation mismatch occurs. |
KubeDeploymentReplicasMismatch | ( kube_deployment_spec_replicas{job="kube-state-metrics"} != kube_deployment_status_replicas_available{job="kube-state-metrics"} ) and ( changes(kube_deployment_status_replicas_updated{job="kube-state-metrics"}[5m]) == 0 ) | 15 | A deployment replica mismatch occurs. |
KubeStatefulSetReplicasMismatch | ( kube_statefulset_status_replicas_ready{job="kube-state-metrics"} != kube_statefulset_status_replicas{job="kube-state-metrics"} ) and ( changes(kube_statefulset_status_replicas_updated{job="kube-state-metrics"}[5m]) == 0 ) | 15 | A StatefulSet replica mismatch occurs. |
KubeStatefulSetGenerationMismatch | kube_statefulset_status_observed_generation{job="kube-state-metrics"} != kube_statefulset_metadata_generation{job="kube-state-metrics"} | 15 | A StatefulSet generation mismatch occurs. |
KubeStatefulSetUpdateNotRolledOut | max without (revision) ( kube_statefulset_status_current_revision{job="kube-state-metrics"} unless kube_statefulset_status_update_revision{job="kube-state-metrics"} ) * ( kube_statefulset_replicas{job="kube-state-metrics"} != kube_statefulset_status_replicas_updated{job="kube-state-metrics"} ) | 15 | The StatefulSet update is not rolled out. |
KubeDaemonSetRolloutStuck | kube_daemonset_status_number_ready{job="kube-state-metrics"} / kube_daemonset_status_desired_number_scheduled{job="kube-state-metrics"} < 1.00 | 15 | DaemonSet exit backoff |
KubeContainerWaiting | sum by (namespace, pod, container) (kube_pod_container_status_waiting_reason{job="kube-state-metrics"}) > 0 | 60 | The container is in the Waiting state. |
KubeDaemonSetNotScheduled | kube_daemonset_status_desired_number_scheduled{job="kube-state-metrics"} - kube_daemonset_status_current_number_scheduled{job="kube-state-metrics"} > 0 | 10 | The DaemonSet is not scheduled. |
KubeDaemonSetMisScheduled | kube_daemonset_status_number_misscheduled{job="kube-state-metrics"} > 0 | 15 | The daemon plan is missing. |
KubeCronJobRunning | time() - kube_cronjob_next_schedule_time{job="kube-state-metrics"} > 3600 | 60 | If the Cron job runs for longer than 1 hour. |
KubeJobCompletion | kube_job_spec_completions{job="kube-state-metrics"} - kube_job_status_succeeded{job="kube-state-metrics"} > 0 | 60 | The task is complete. |
KubeJobFailed | kube_job_failed{job="kube-state-metrics"} > 0 | 15 | The Job failed. |
KubeHpaReplicasMismatch | (kube_hpa_status_desired_replicas{job="kube-state-metrics"} != kube_hpa_status_current_replicas{job="kube-state-metrics"}) and changes(kube_hpa_status_current_replicas[15m]) == 0 | 15 | An HPA replica mismatch occurs. |
KubeHpaMaxedOut | kube_hpa_status_current_replicas{job="kube-state-metrics"} == kube_hpa_spec_max_replicas{job="kube-state-metrics"} | 15 | The number of HPA replicas reaches the maximum. |
KubeCPUOvercommit | sum(namespace:kube_pod_container_resource_requests_cpu_cores:sum{}) / sum(kube_node_status_allocatable_cpu_cores) > (count(kube_node_status_allocatable_cpu_cores)-1) / count(kube_node_status_allocatable_cpu_cores) | 5 | CPU is overcommitted. |
KubeMemoryOvercommit | sum(namespace:kube_pod_container_resource_requests_memory_bytes:sum{}) / sum(kube_node_status_allocatable_memory_bytes) > (count(kube_node_status_allocatable_memory_bytes)-1) / count(kube_node_status_allocatable_memory_bytes) | 5 | Memory is overcommitted. |
KubeCPUQuotaOvercommit | sum(kube_resourcequota{job="kube-state-metrics", type="hard", resource="cpu"}) / sum(kube_node_status_allocatable_cpu_cores) > 1.5 | 5 | CPU quota is overcommitted. |
KubeMemoryQuotaOvercommit | sum(kube_resourcequota{job="kube-state-metrics", type="hard", resource="memory"}) / sum(kube_node_status_allocatable_memory_bytes{job="node-exporter"}) > 1.5 | 5 | Memory quota is overcommitted. |
KubeQuotaExceeded | kube_resourcequota{job="kube-state-metrics", type="used"} / ignoring(instance, job, type) (kube_resourcequota{job="kube-state-metrics", type="hard"} > 0) > 0.90 | 15 | The quota has been exceeded. |
CPUThrottlingHigh | sum(increase(container_cpu_cfs_throttled_periods_total{container!="", }[5m])) by (container, pod, namespace) / sum(increase(container_cpu_cfs_periods_total{}[5m])) by (container, pod, namespace) > ( 25 / 100 ) | 15 | The CPU is overheating. |
KubePersistentVolumeFillingUp | kubelet_volume_stats_available_bytes{job="kubelet", metrics_path="/metrics"} / kubelet_volume_stats_capacity_bytes{job="kubelet", metrics_path="/metrics"} < 0.03 | 1 | The persistent volume is running out of space. |
KubePersistentVolumeErrors | kube_persistentvolume_status_phase{phase=~"Failed|Pending",job="kube-state-metrics"} > 0 | 5 | Invalid storage volume capacity. |
KubeVersionMismatch | count(count by (gitVersion) (label_replace(kubernetes_build_info{job!~"kube-dns|coredns"},"gitVersion","$1","gitVersion","(v[0-9]*.[0-9]*.[0-9]*).*"))) > 1 | 15 | A version mismatch occurs. |
KubeClientErrors | (sum(rate(rest_client_requests_total{code=~"5.."}[5m])) by (instance, job) / sum(rate(rest_client_requests_total[5m])) by (instance, job)) > 0.01 | 15 | A client error occurs. |
KubeAPIErrorBudgetBurn | sum(apiserver_request:burnrate1h) > (14.40 * 0.01000) and sum(apiserver_request:burnrate5m) > (14.40 * 0.01000) | 2 | High API error rate. |
KubeAPILatencyHigh | ( cluster:apiserver_request_duration_seconds:mean5m{job="apiserver"} > on (verb) group_left() ( avg by (verb) (cluster:apiserver_request_duration_seconds:mean5m{job="apiserver"} >= 0) + 2*stddev by (verb) (cluster:apiserver_request_duration_seconds:mean5m{job="apiserver"} >= 0) ) ) > on (verb) group_left() 1.2 * avg by (verb) (cluster:apiserver_request_duration_seconds:mean5m{job="apiserver"} >= 0) and on (verb,resource) cluster_quantile:apiserver_request_duration_seconds:histogram_quantile{job="apiserver",quantile="0.99"} > 1 | 5 | API latency is high. |
KubeAPIErrorsHigh | sum(rate(apiserver_request_total{job="apiserver",code=~"5.."}[5m])) by (resource,subresource,verb) / sum(rate(apiserver_request_total{job="apiserver"}[5m])) by (resource,subresource,verb) > 0.05 | 10 | The API error rate is high. |
KubeClientCertificateExpiration | apiserver_client_certificate_expiration_seconds_count{job="apiserver"} > 0 and on(job) histogram_quantile(0.01, sum by (job, le) (rate(apiserver_client_certificate_expiration_seconds_bucket{job="apiserver"}[5m]))) < 604800 | None | The client authentication has expired. |
AggregatedAPIErrors | sum by(name, namespace)(increase(aggregator_unavailable_apiservice_count[5m])) > 2 | None | An error occurs in the aggregated API. |
AggregatedAPIDown | sum by(name, namespace)(sum_over_time(aggregator_unavailable_apiservice[5m])) > 0 | 5 | The aggregated API is down. |
KubeAPIDown | absent(up{job="apiserver"} == 1) | 15 | Unpublishing an API. |
KubeNodeNotReady | kube_node_status_condition{job="kube-state-metrics",condition="Ready",status="true"} == 0 | 15 | The node is not ready. |
KubeNodeUnreachable | kube_node_spec_taint{job="kube-state-metrics",key="node.kubernetes.io/unreachable",effect="NoSchedule"} == 1 | 2 | The node is unreachable. |
KubeletTooManyPods | max(max(kubelet_running_pod_count{job="kubelet", metrics_path="/metrics"}) by(instance) * on(instance) group_left(node) kubelet_node_name{job="kubelet", metrics_path="/metrics"}) by(node) / max(kube_node_status_capacity_pods{job="kube-state-metrics"} != 1) by(node) > 0.95 | 15 | There are too many Pods. |
KubeNodeReadinessFlapping | sum(changes(kube_node_status_condition{status="true",condition="Ready"}[15m])) by (node) > 2 | 15 | The node readiness status is flapping. |
KubeletPlegDurationHigh | node_quantile:kubelet_pleg_relist_duration_seconds:histogram_quantile{quantile="0.99"} >= 10 | 5 | The PLEG duration is high. |
KubeletPodStartUpLatencyHigh | histogram_quantile(0.99, sum(rate(kubelet_pod_worker_duration_seconds_bucket{job="kubelet", metrics_path="/metrics"}[5m])) by (instance, le)) * on(instance) group_left(node) kubelet_node_name{job="kubelet", metrics_path="/metrics"} > 60 | 15 | Pod startup latency is high. |
KubeletDown | absent(up{job="kubelet", metrics_path="/metrics"} == 1) | 15 | The kubelet is down. |
KubeSchedulerDown | absent(up{job="kube-scheduler"} == 1) | 15 | Kubelet scheduling is deprecated. |
KubeControllerManagerDown | absent(up{job="kube-controller-manager"} == 1) | 15 | The kube-controller-manager is down. |
TargetDown | 100 * (count(up == 0) BY (job, namespace, service) / count(up) BY (job, namespace, service)) > 10 | 10 | The target is down. |
NodeNetworkInterfaceFlapping | changes(node_network_up{job="node-exporter",device!~"veth.+"}[2m]) > 2 | 2 | The network interface status is flapping. |
MongoDB alert rules
Alert name | Expression | Data collection period (minutes) | Alert trigger condition |
MongodbReplicationLag | avg(mongodb_replset_member_optime_date{state="PRIMARY"}) - avg(mongodb_replset_member_optime_date{state="SECONDARY"}) > 10 | 5 | Replication lag is too high. |
MongodbReplicationHeadroom | (avg(mongodb_replset_oplog_tail_timestamp - mongodb_replset_oplog_head_timestamp) - (avg(mongodb_replset_member_optime_date{state="PRIMARY"}) - avg(mongodb_replset_member_optime_date{state="SECONDARY"}))) <= 0 | 5 | Replication headroom is insufficient. |
MongodbReplicationStatus3 | mongodb_replset_member_state == 3 | 5 | The replication state is 3. |
MongodbReplicationStatus6 | mongodb_replset_member_state == 6 | 5 | The replication state is 6. |
MongodbReplicationStatus8 | mongodb_replset_member_state == 8 | 5 | The replication state is 8. |
MongodbReplicationStatus10 | mongodb_replset_member_state == 10 | 5 | The replication state is 10. |
MongodbNumberCursorsOpen | mongodb_metrics_cursor_open{state="total_open"} > 10000 | 5 | Too many cursors are open. |
MongodbCursorsTimeouts | sum (increase increase(mongodb_metrics_cursor_timed_out_total[10m]) > 100 | 5 | Cursors are timing out. |
MongodbTooManyConnections | mongodb_connections{state="current"} > 500 | 5 | Too many connections. |
MongodbVirtualMemoryUsage | (sum(mongodb_memory{type="virtual"}) BY (ip) / sum(mongodb_memory{type="mapped"}) BY (ip)) > 3 | 5 | Virtual memory usage is high. |
MySQL alert rules
Alert name | Expression | Data collection period (minutes) | Alert trigger condition |
MySQL is down | mysql_up == 0 | 1 | MySQL is down. |
open files high | mysql_global_status_innodb_num_open_files > (mysql_global_variables_open_files_limit) * 0.75 | 1 | The number of open files is high. |
Read buffer size is bigger than max. allowed packet size | mysql_global_variables_read_buffer_size > mysql_global_variables_slave_max_allowed_packet | 1 | The read buffer size is larger than the maximum allowed packet size. |
Sort buffer possibly missconfigured | mysql_global_variables_innodb_sort_buffer_size <256*1024 or mysql_global_variables_read_buffer_size > 4*1024*1024 | 1 | The sort buffer may be misconfigured. |
Thread stack size is too small | mysql_global_variables_thread_stack <196608 | 1 | The thread stack size is too small. |
Used more than 80% of max connections limited | mysql_global_status_max_used_connections > mysql_global_variables_max_connections * 0.8 | 1 | More than 80% of the maximum allowed connections are used. |
InnoDB Force Recovery is enabled | mysql_global_variables_innodb_force_recovery != 0 | 1 | You can enable forced recovery. |
InnoDB Log File size is too small | mysql_global_variables_innodb_log_file_size < 16777216 | 1 | The InnoDB log file size is too small. |
InnoDB Flush Log at Transaction Commit | mysql_global_variables_innodb_flush_log_at_trx_commit != 1 | 1 | A transaction commit flushes the log. |
Table definition cache too small | mysql_global_status_open_table_definitions > mysql_global_variables_table_definition_cache | 1 | The table definition cache is too small. |
Table open cache too small | mysql_global_status_open_tables >mysql_global_variables_table_open_cache * 99/100 | 1 | The table open cache is too small. |
Thread stack size is possibly too small | mysql_global_variables_thread_stack < 262144 | 1 | The thread stack size may be too small. |
InnoDB Buffer Pool Instances is too small | mysql_global_variables_innodb_buffer_pool_instances == 1 | 1 | The number of InnoDB buffer pool instances is too small. |
InnoDB Plugin is enabled | mysql_global_variables_ignore_builtin_innodb == 1 | 1 | The plugin has been enabled. |
Binary Log is disabled | mysql_global_variables_log_bin != 1 | 1 | The binary log is disabled. |
Binlog Cache size too small | mysql_global_variables_binlog_cache_size < 1048576 | 1 | The binary log cache size is too small. |
Binlog Statement Cache size too small | mysql_global_variables_binlog_stmt_cache_size <1048576 and mysql_global_variables_binlog_stmt_cache_size > 0 | 1 | The binary log statement cache size is too small. |
Binlog Transaction Cache size too small | mysql_global_variables_binlog_cache_size <1048576 | 1 | The transaction cache is too small. |
Sync Binlog is enabled | mysql_global_variables_sync_binlog == 1 | 1 | Binary logging is enabled. |
IO thread stopped | mysql_slave_status_slave_io_running != 1 | 1 | The I/O thread is stopped. |
SQL thread stopped | mysql_slave_status_slave_sql_running == 0 | 1 | The SQL thread is stopped. |
Mysql_Too_Many_Connections | rate(mysql_global_status_threads_connected[5m])>200 | 5 | Too many connections. |
Mysql_Too_Many_slow_queries | rate(mysql_global_status_slow_queries[5m])>3 | 5 | Too many slow queries. |
Slave lagging behind Master | rate(mysql_slave_status_seconds_behind_master[1m]) >30 | 1 | The slave is lagging behind the master. |
Slave is NOT read only(Please ignore this warning indicator.) | mysql_global_variables_read_only != 0 | 1 | The secondary permission is not a read-only permission. |
Nginx alert rules
Alert name | Expression | Data collection period (minutes) | Alert trigger condition |
NginxHighHttp4xxErrorRate | sum(rate(nginx_http_requests_total{status=~"^4.."}[1m])) / sum(rate(nginx_http_requests_total[1m])) * 100 > 5 | 5 | The HTTP 4xx error rate is high. |
NginxHighHttp5xxErrorRate | sum(rate(nginx_http_requests_total{status=~"^5.."}[1m])) / sum(rate(nginx_http_requests_total[1m])) * 100 > 5 | 5 | The HTTP 5xx error rate is high. |
NginxLatencyHigh | histogram_quantile(0.99, sum(rate(nginx_http_request_duration_seconds_bucket[30m])) by (host, node)) > 10 | 5 | Latency is high. |
Redis alert rules
Alert name | Expression | Data collection period (minutes) | Alert trigger condition |
RedisDown | redis_up == 0 | 5 | Redis is down. |
RedisMissingMaster | count(redis_instance_info{role="master"}) == 0 | 5 | A master is missing. |
RedisTooManyMasters | count(redis_instance_info{role="master"}) > 1 | 5 | There is more than one master. |
RedisDisconnectedSlaves | count without (instance, job) (redis_connected_slaves) - sum without (instance, job) (redis_connected_slaves) - 1 > 1 | 5 | A slave is disconnected. |
RedisReplicationBroken | delta(redis_connected_slaves[1m]) < 0 | 5 | Replication is interrupted. |
RedisClusterFlapping | changes(redis_connected_slaves[5m]) > 2 | 5 | Monitors the replica connection for changes. |
RedisMissingBackup | time() - redis_rdb_last_save_timestamp_seconds > 60 * 60 * 24 | 5 | The backup was interrupted. |
RedisOutOfMemory | redis_memory_used_bytes / redis_total_system_memory_bytes * 100 > 90 | 5 | Out of memory. |
RedisTooManyConnections | redis_connected_clients > 100 | 5 | Too many connections. |
RedisNotEnoughConnections | redis_connected_clients < 5 | 5 | Not enough connections. |
RedisRejectedConnections | increase(redis_rejected_connections_total[1m]) > 0 | 5 | Connections are being rejected. |