Skip to content

Latest commit

 

History

History
166 lines (105 loc) · 2.48 KB

File metadata and controls

166 lines (105 loc) · 2.48 KB

Prometheus Query Cheatsheet for DevOps & Monitoring Teams

Node Metrics

Total number of nodes

count(kube_node_info)

Number of Ready nodes

count(kube_node_status_condition{condition="Ready", status="true"})

Number of NotReady nodes

count(kube_node_status_condition{condition="Ready", status="false"})

Pod Metrics

Total number of pods in Running state

count(kube_pod_status_phase{phase="Running"})

Total number of pods in Pending state

count(kube_pod_status_phase{phase="Pending"})

Pods restarting frequently (last 10 min)

increase(kube_pod_container_status_restarts_total[10m]) > 5

Pods not ready

kube_pod_status_ready{condition="false"}

CPU Metrics

Node CPU usage percentage

100 - (avg by(instance) (rate(node_cpu_seconds_total{mode="idle"}[5m])) * 100)

Pod CPU usage

rate(container_cpu_usage_seconds_total{container!="", image!=""}[5m])

Memory Metrics

Node memory usage

node_memory_MemTotal_bytes - node_memory_MemAvailable_bytes

Pod memory usage

container_memory_usage_bytes{container!="", image!=""}

Disk Metrics

Node disk usage

node_filesystem_size_bytes{fstype=~"ext4|xfs"} - node_filesystem_free_bytes{fstype=~"ext4|xfs"}

Node disk usage percentage

100 * (1 - node_filesystem_free_bytes{fstype=~"ext4|xfs"} / node_filesystem_size_bytes{fstype=~"ext4|xfs"})

Network Metrics

Pod network receive rate

rate(container_network_receive_bytes_total[5m])

Pod network transmit rate

rate(container_network_transmit_bytes_total[5m])

Kubernetes Resource Count

Total deployments

count(kube_deployment_created)

Total replica sets

count(kube_replica_set_created)

Total namespaces

count(kube_namespace_created)

Application Metrics (if instrumented)

HTTP request rate

rate(http_requests_total[5m])

Application error rate

rate(app_errors_total[5m])

Filesystem Alerts

Node disk almost full (above 80%)

(node_filesystem_size_bytes{fstype=~"ext4|xfs"} - node_filesystem_free_bytes{fstype=~"ext4|xfs"})
/ node_filesystem_size_bytes{fstype=~"ext4|xfs"} > 0.8

Let me know if you want this exported as a .md file or included in your documentation project.