以下是一些可能有用的Prometheus监控和告警规则,可以在监控Greenplum时使用:
CPU 监控:
# CPU usage percentage
100 - (avg by(instance) (irate(node_cpu_seconds_total{mode="idle"}[5m])) * 100)
内存 监控:
# Memory usage percentage
100 - ((node_memory_MemFree + node_memory_Buffers + node_memory_Cached) / node_memory_MemTotal * 100)
磁盘 监控:
# Disk usage percentage
100 - ((node_filesystem_avail_bytes{mountpoint="/"} / node_filesystem_size_bytes{mountpoint="/"}) * 100)
网络 监控:
# Network traffic in bytes/s
sum(increase(node_network_receive_bytes_total[1m])) + sum(increase(node_network_transmit_bytes_total[1m]))
连接数 监控:
# Number of TCP connections
count(netstat_sockets{protocol="tcp"})
查询数 监控:
# Number of queries executed per second
rate(gp_interconnect_query_sent[1m])
缓存命中率 监控:
# Cache hit rate
((gp_segment_configuration_table_scan_count - gp_segment_configuration_table_scan_disk_count) / gp_segment_configuration_table_scan_count) * 100
这些规则可以产生警报,例如当磁盘使用率超过90%时:
ALERT DiskUsageCritical
IF (node_filesystem_avail_bytes{mountpoint="/"} / node_filesystem_size_bytes{mountpoint="/"}) * 100 < 10
FOR 5m
LABELS { severity="critical" }
ANNOTATIONS {
summary = "Disk usage is too high",
description = "The disk usage on {{ $labels.instance }} has reached critical levels.",
}




