zabbix服务器配置
zabbix_server.conf:
JavaGateway=10.42.239.219 #JavaGateway的IP
JavaGatewayPort=10052 #JavaGateway监听的端口
StartJavaPollers=20 #获取数据的并发数
zabbix_java_gateway.conf
LISTEN_IP="0.0.0.0" #监控地址
LISTEN_PORT=10052 #监听端口
START_POLLERS=5 #开启的工作线程数
TIMEOUT=3 #超时
可以在本地使用cmdline-jmxclient-0.10.3.jar 包来测试键来获取值
查看被监控服务器支持的JMX内容
查看10.42.233.22上tomcat当前支持的监控内容:
java -jar /tmp/cmdline-jmxclient-0.10.3.jar - 10.42.233.22:10052
注意第二个 - 前后都是空格
查看java.lang:type=Memory监控项支持的属性
java -jar /tmp/cmdline-jmxclient-0.10.3.jar - 10.42.233.22:10052 java.lang:type=Memory
Attributes:
Verbose: Verbose (type=boolean)
HeapMemoryUsage: HeapMemoryUsage (type=javax.management.openmbean.CompositeData)
NonHeapMemoryUsage: NonHeapMemoryUsage (type=javax.management.openmbean.CompositeData)
ObjectPendingFinalizationCount: ObjectPendingFinalizationCount (type=int)
ObjectName: ObjectName (type=javax.management.ObjectName)
Operations:
gc: gc
Parameters 0, return type=void
查看java.lang:type=Memory HeapMemoryUsage具体值
java -jar /tmp/cmdline-jmxclient-0.10.3.jar - 10.42.233.22:10052 java.lang:type=Memory HeapMemoryUsage
10/16/2018 17:35:48 +0800 org.archive.jmx.Client HeapMemoryUsage:
committed: 1043857408
init: 260017728
max: 3698327552
used: 329089432
监控项中的配置
jmx["java.lang:type=Memory",HeapMemoryUsage.used]
java.lang:type=Threading中属性PeakThreadCount数据
MBean中一般有属性,操作,通知等,对于属性值,zabbix是可以获取到值的,对于操作信息,处于安全考虑,外部是调用不到的,只能在jconsole中来执行方法来获取值,
java -jar /tmp/cmdline-jmxclient-0.10.3.jar - 10.42.233.22:10052 java.lang:type=Threading PeakThreadCount
用jconsole来获取MBean中的操作值
java -jar /tmp/cmdline-jmxclient-0.10.3.jar - 10.42.233.22:10052 java.lang:type=Threading getThreadingCount=参数1,参数2
原文地址:https://www.cnblogs.com/0916m/p/11481815.html