Prometheus 常见 Exporter 及其使用场景:
系统监控 Exporter:
-
Node Exporter:
- 监控 Linux/Unix 系统指标
- 指标:CPU、内存、磁盘、网络、文件系统
- 部署:在每个节点上运行
- 示例指标:
node_cpu_seconds_total、node_memory_MemAvailable_bytes
-
Windows Exporter:
- 监控 Windows 系统
- 支持 WMI 性能计数器
- 指标:CPU、内存、进程、服务
数据库 Exporter:
-
MySQL Exporter:
- 监控 MySQL/MariaDB
- 指标:连接数、查询性能、复制状态
- 配置:DSN 连接字符串
- 示例:
mysql_global_status_threads_connected
-
PostgreSQL Exporter:
- 监控 PostgreSQL
- 指标:连接、查询、锁、复制
- 支持扩展指标
-
Redis Exporter:
- 监控 Redis
- 指标:内存使用、连接数、命令统计
- 支持集群模式
应用 Exporter:
-
Blackbox Exporter:
- HTTP/HTTPS、TCP、ICMP 探测
- 用于可用性监控
- 配置模块定义探测参数
-
JMX Exporter:
- 监控 Java 应用
- 通过 JMX 获取指标
- 支持 Kafka、Tomcat 等
-
StatsD Exporter:
- 兼容 StatsD 协议
- 适合应用埋点
容器和云平台 Exporter:
-
cAdvisor:
- 容器资源使用
- 集成在 Kubelet
-
Kube-State-Metrics:
- Kubernetes 对象状态
- Pod、Deployment、Service 等
部署示例:
yamlscrape_configs: - job_name: 'node' static_configs: - targets: ['node1:9100', 'node2:9100'] - job_name: 'mysql' static_configs: - targets: ['mysql-exporter:9104']
最佳实践:
- 选择合适的 Exporter 版本
- 配置认证和安全
- 监控 Exporter 自身健康
- 使用标签区分不同实例