本文这监控了部分选项
客户端支持jmx监控请查看http://www.ttlsa.com/zabbix/zabbix-monitor-mutli-jmx-port/
参考http://wangzan18.blog.51cto.com/8021085/1692444
将catalina-jmx-remote.jar文件放到tomcat/lib下
上传监控程序文件cmdline-jmxclient-0.10.3.jar,进行测试
[root@app1 etc]# /usr/local/jdk7/bin/java -jar /usr/local/zabbix/etc/cmdline-jmxclient-0.10.3.jar - 127.0.0.1:12345 java.lang:type=Memory NonHeapMemoryUsage 05/27/2016 16:25:03 +0800 org.archive.jmx.Client NonHeapMemoryUsage: committed: 138084352 init: 136773632 max: 318767104 used: 36833320
在zabbix_agentd.conf文件中添加自定义监控
UserParameter=java.HeapMemoryUsage.status[*],/usr/local/jdk7/bin/java -jar /usr/local/zabbix/etc/cmdline-jmxclient-0.10.3.jar - 127.0.0.1:$1 java.lang:type=Memory HeapMemoryUsage 2>&1 |grep $2 |awk ‘{print $NF}‘ UserParameter=java.NobHeapMemoryUsage.status[*],/usr/local/jdk7/bin/java -jar /usr/local/zabbix/etc/cmdline-jmxclient-0.10.3.jar - 127.0.0.1:$1 java.lang:type=Memory NonHeapMemoryUsage 2>&1 |grep $2 |awk ‘{print $NF}‘ UserParameter=java.LoadClass.status[*],/usr/local/jdk7/bin/java -jar /usr/local/zabbix/etc/cmdline-jmxclient-0.10.3.jar - 127.0.0.1:$1 java.lang:type=ClassLoading $2 2>&1 |awk ‘{print $NF}‘ UserParameter=java.Thread.status[*],/usr/local/jdk7/bin/java -jar /usr/local/zabbix/etc/cmdline-jmxclient-0.10.3.jar - 127.0.0.1:$1 java.lang:type=Threading $2 2>&1 |awk ‘{print $NF}‘ #说明$1是要监控客户端的端口号,$2是要监控的内容
本文出自 “ly36843运维” 博客,请务必保留此出处http://ly36843.blog.51cto.com/3120113/1783859
原文地址:http://ly36843.blog.51cto.com/3120113/1783859