1. MySQL
https://github.com/prometheus/mysqld_exporter
可用性
表示 MySQL 实例是否已停机 mysql_up
表示数据库正常运行的时长,通常使用该指标配置告警,监控运行少于半小时的 MySQL 实例 mysql_global_status_uptime
数据库连接
连接错误是数据库中的主要错误之一,通过该指标可以查看到具体连接错误信息以及错误连接次数。mysql_global_status_connection_errors_total
MySQL 实例请求已经连接的线程数。mysql_global_status_threads_connected
MySQL 实例请求运行中的线程数。mysql_global_status_threads_running
MySQL 实例最大连接记录统计。mysql_global_status_max_used_connections
MySQL 实例的最大连接数,若超过该连接数之后有新的请求到来,就会拒绝连接。mysql_global_variables_max_connections
异常中断的连接(尝试连接)。mysql_global_status_aborted_connects
异常中断的连接(超时)。mysql_global_status_aborted_clients
查询
MySQL 实例慢查询统计 mysql_global_status_slow_queries
MySQL 实例当前查询 QPS mysql_global_status_queries
流量
入站流量 mysql_global_status_bytes_received
出站流量 mysql_global_status_bytes_sent
文件
正在打开的文件统计 mysql_global_status_opened_files
MySQL 已经打开的文件统计 mysql_global_status_open_files
允许打开的文件统计 mysql_global_variables_open_files_limit
Innodb 打开的文件统计 mysql_global_status_innodb_num_open_files
https://blog.csdn.net/qq_31555951/article/details/109496622
https://help.aliyun.com/zh/prometheus/use-cases/monitor-mysql-databases
2. Redis
https://github.com/oliver006/redis_exporter
Redis 实例是否可用 redis_up
连接的客户端数 redis_connected_clients
内存使用率 100 * (redis_memory_used_bytes / redis_memory_max_bytes )
命令执行 QPS rate(redis_commands_processed_total[1m])
cache 命中 QPS irate(redis_keyspace_hits_total[5m])
cache 未命中 QPS irate(redis_keyspace_misses_total[5m])
网络入流量 rate(redis_net_input_bytes_total[5m])
网络出流量 rate(redis_net_output_bytes_total[5m])
db 中的 key 数量 sum(redis_db_keys) by (db)
db 中的过期 key 数量 sum(redis_db_keys_expiring) by (db)
每一种命令的 QPS topk(5, irate(redis_commands_total[1m]))
3. MongoDB
https://github.com/percona/mongodb_exporter
https://github.com/raffis/mongodb-query-exporter
服务器是否在线 mongodb_up
客户端连接数 mongodb_ss_connections{conn_type=”current”}
collection 全部文档的体积,单位 bytes mongodb_collstats_storageStats_size
collection 读操作的数量(每分钟) delta(mongodb_collstats_latencyStats_reads_ops[1m])
collection 读操作的延迟(每分钟),单位为微秒 delta(mongodb_collstats_latencyStats_reads_latency[1m])
collection 的 index 数量 mongodb_collstats_storageStats_nindexes
collection 的 index 占用的磁盘空间 mongodb_collstats_storageStats_totalIndexSize
https://www.cnblogs.com/yangmeichong/p/18156069
4. Kafka
https://github.com/danielqsj/kafka_exporter
https://github.com/prometheus/jmx_exporter
https://cloud.tencent.com/document/product/1416/111833
https://developer.aliyun.com/article/1578308
5. elasticsearch
https://github.com/prometheus-community/elasticsearch_exporter
https://www.cnblogs.com/qianyuliang/p/15410892.html
https://cloud.tencent.com/developer/article/1765046
集群健康和节点可用性
集群状态,green( 所有的主分片和副本分片都正常运行)、yellow(所有的主分片都正常运行,但不是所有的副本分片都正常运行)red(有主分片没能正常运行) elasticsearch_cluster_health_status
集群节点数/数据节点数 elasticsearch_cluster_health_number_of_nodes
活跃的主分片总数 elasticsearch_cluster_health_active_primary_shards
活跃的分片总数(包括复制分片) elasticsearch_cluster_health_active_shards
当前节点正在迁移到其他节点的分片数量,通常为 0,集群中有节点新加入或者退出时该值会增加 elasticsearch_cluster_health_relocating_shards
正在初始化的分片 elasticsearch_cluster_health_initializing_shards
未分配的分片数,通常为 0,当有节点的副本分片丢失该值会增加 elasticsearch_cluster_health_unassigned_shards
只有主节点能处理集群级元数据的更改(创建索引,更新映射,分配分片等),通过 pending-tasks API 可以查看队列中等待的任务,绝大部分情况下元数据更改的队列基本上保持为零 elasticsearch_cluster_health_number_of_pending_tasks
主机级别的系统和网络指标
CPU 使用率 elasticsearch_process_cpu_percent
磁盘可用空间 elasticsearch_filesystem_data_free_bytes
ES 进程打开的文件描述符 elasticsearch_process_open_files_count
ES 节点之间网络入流量 elasticsearch_transport_rx_packets_total
ES 节点之间网络出流量 elasticsearch_transport_tx_packets_total
JVM 内存和垃圾回收
垃圾搜集数 elasticsearch_jvm_gc_collection_seconds_count
垃圾回收时间 elasticsearch_jvm_gc_collection_seconds_sum
最大使用内存限制 elasticsearch_jvm_memory_committed_bytes
内存使用量 elasticsearch_jvm_memory_used_bytes
6. Zookeeper
#比较老旧不推荐
https://github.com/dabealu/zookeeper-exporter
https://github.com/carlpett/zookeeper_exporter/
#jmx 方式
https://github.com/prometheus/jmx_exporter/blob/main/example_configs/zookeeper.yaml
https://bbs.huaweicloud.com/blogs/166278
为了更加方便的集成 prometheus,建议使用 3.6.0 以后的版本,因为这个版本以后 zookeeper 加入了 prometheus 集成监控,只需要开启 zookeeper 的指标配置即可。在这个版本之前的 zookeeper,可能需要通过 JMX 进行监控。 启用以下三个属性值即可
##Metrics Providers
#https://prometheus.io Metrics Exporter
metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
metricsProvider.httpPort=7000
metricsProvider.exportJvmInfo=true
7. Nginx
https://github.com/nginxinc/nginx-prometheus-exporter/
https://cloud.tencent.com/document/product/1416/111838
存活状态 1 正常 0 异常 nginx_up
nginx 已接受的连接 nginx_connections_accepted
nginx 连接活动数 nginx_connections_active
nginx 已处理的连接 nginx_connections_handled
nginx 连接 _ 读取 nginx_connections_reading
nginx 连接 _ 等待 nginx_connections_waiting
nginx 连接 _ 写入 nginx_connections_writing
nginx 请求总数 nginx_http_requests_total
8. k8s 集群 node-exporter
https://github.com/prometheus/node_exporter
cpu、内存相关的指标
过去 1 分钟的系统平均负载 node_load1
系统总内存量(以字节为单位) node_memory_MemTotal_bytes
系统当前可用的内存量(以字节为单位) node_memory_MemAvailable_bytes
系统缓存使用的内存(以字节为单位) node_memory_Cached_bytes
用于缓冲使用的内存(以字节为单位) node_memory_Buffers_bytes
计算可用内存百分比 node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes * 100
计算已用内存百分比 (node_memory_MemTotal_bytes – node_memory_MemAvailable_bytes) / node_memory_MemTotal_bytes *100
磁盘相关指标
文件系统大小(以字节为单位) node_filesystem_size_bytes
文件系统可用空间(以字节为单位 ) node_filesystem_avail_bytes
计算可用空间百分比 node_filesystem_avail_bytes / node_filesystem_size_bytes * 100
计算已用空间百分比 (node_filesystem_size_bytes – node_filesystem_avail_bytes ) / node_filesystem_size_bytes * 100
磁盘 IO 吞吐量相关核心指标
从给定设备读取的总字节数。(以字节为单位)。(使用 irate 可以得到每秒写入大小) node_disk_read_bytes_total
向给定设备写入的总字节数 node_disk_written_bytes_total
磁盘 IOPS 相关核心指标
磁盘设备完成的读操作总数。(使用 irate 可以得到每秒读操作的平均数) node_disk_reads_completed_total
磁盘设备完成的写操作总数。(使用 irate 可以得到每秒读操作的平均数) node_disk_writes_completed_total
网络核心指标
网络接口接收到的总字节数。(以字节为单位) node_network_receive_bytes_total
网络接口发送出去的总字节数。(以字节为单位) node_network_transmit_bytes_total
连接追踪核心指标
系统正在跟踪的网络连接的数量。这包括所有类型的连接,例如 TCP, UDP、ICMP 等 node_nf_conntrack_entries
系统 conntrack 能够跟踪的网络连接的最大数量 node_nf_conntrack_entries_limit
TCP 与其他相关指标
当前已断开的 TCP 连接数 node_tcp_connection_states{state=”time_wait”}
当前建立的 TCP 连接数 node_tcp_connection_states{state=”established”}
https://www.volcengine.com/docs/6731/189369