Prometheus Agent 安装手册
Prometheus官方 node_exporter
- 下载对应操作系统的最新release版本
- 运行node_exporter
- 查看默认提供的9100端口,能看到所暴露的指标数据
- 下载对应操作系统的最新release版本
- 需要在被监控数据库中新建监控用户并授权
GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'exporter'@'localhost';
- 新建my.cnf配置文件
- 运行exporter
nohub ./mysqld_exporter --config.my-cnf="my.cnf" > app.log 2>&1 &
- 查看提供的9104端口,能看到所暴露的指标数据
官方并没有提供Redis的exporter,可使用较流行的
- 运行redis_exporter
- 查看提供的9121端口,能看到所暴露的指标数据
tomcat war 部署方式监控,这种方式直接在tomcat里面加上exporter的jar包修改catalina.sh,启动并暴露指标
1、新建config.yaml文件
lowercaseOutputLabelNames: true
lowercaseOutputName: true
rules:
- pattern: 'Catalina<type=GlobalRequestProcessor, name=\"(\w+-\w+)-(\d+)\"><>(\w+):'
name: tomcat_$3_total
labels:
port: "$2"
protocol: "$1"
type: COUNTER
- pattern: 'Catalina<j2eeType=Servlet, WebModule=//([-a-zA-Z0-9+&@#/%?=~_|!:.,;]*[-a-zA-Z0-9+&@#/%=~_|]), name=([-a-zA-Z0-9+/$%~_-|!.]*), J2EEApplication=none, J2EEServer=none><>(requestCount|maxTime|processingTime|errorCount):'
name: tomcat_servlet_$3_total
labels:
servlet: "$2"
help: Tomcat servlet $3 total
type: COUNTER
- pattern: 'Catalina<type=ThreadPool, name="(\w+-\w+)-(\d+)"><>(currentThreadCount|currentThreadsBusy|keepAliveCount|pollerThreadCount|connectionCount):'
name: tomcat_threadpool_$3
port: "$2"
protocol: "$1"
help: Tomcat threadpool $3
type: GAUGE
- pattern: 'Catalina<type=Manager, host=([-a-zA-Z0-9+&@#/%?=~_|!:.,;]*[-a-zA-Z0-9+&@#/%=~_|]), context=([-a-zA-Z0-9+/$%~_-|!.]*)><>(processingTime|sessionCounter|rejectedSessions|expiredSessions):'
name: tomcat_session_$3_total
labels:
context: "$2"
host: "$1"
4、最后startup.sh启动tomcat,可在提供的9151端口上查到tomcat和jmx的相关指标