promethues监控tomcat

promethues监控tomcat:

下载网址:
https://github.com/prometheus/jmx_exporter 点击download the jar链接

https://github.com/prometheus/jmx_exporter/blob/master/exsample_configs/tomcat.yml 复制内容另存为config.xml

mkdir /var/lib/tomcat7/prometheus

cp -rv jmx_prometheus_javaagent-0.3.1.jar /var/lib/tomcat7/prometheus/

cp -rv config.xml /var/lib/tomcat7/prometheus/

chown tomcat7:tomcat7 /var/lib/tomcat7/prometheus -R

vi /etc/default/tomcat7

JAVA_OPTS="-Djava.awt.headless=true -Xmx1028m -XX:+UseConcMarkSweepGC -javaagent:/var/lib/tomcat7/prometheus/jmx_prometheus_javaagent-0.3.1.jar=9151:/var/lib/tomcat7/prometheus/config.xml"

:wq

/etc/init.d/tomcat7 restart

浏览器访问:http://ip:9151/metrics

prometheus:

vi /space/prometheus/prometheus.yml

- targets: ['host01:9151']

:wq

grafana面板:

显示总heap内存:
jvm_memory_bytes_max{area='heap',instance="$node:9151"}

显示已使用heap内存:
jvm_memory_bytes_used{area='heap',instance="$node:9151"}

转载于:https://blog.51cto.com/yangzhiming/2308437

你可能感兴趣的:(promethues监控tomcat)