原文:http://lovelace.blog.51cto.com/1028430/1424964/
zabbix
监控tomcat
[root@nginx zabbix-2.2.0]# ./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-ssh2 --enable-java
[root@nginx tmp]# tar xf jdk-7u9-linux-x64.tar.gz -C /usr/local/ [root@nginx tmp]# ls /usr/local/jdk1.7.0_09/ bin jre README.html THIRDPARTYLICENSEREADME.txt COPYRIGHT lib release db LICENSE src.zip include man THIRDPARTYLICENSEREADME-JAVAFX.txt
[root@nginx zabbix-2.2.0]# find / -name zabbix_java /usr/local/sbin/zabbix_java /tmp/zabbix-2.2.0/src/zabbix_java [root@nginx zabbix-2.2.0]# [root@nginx zabbix-2.2.0]# ls bin lib settings.sh shutdown.sh startup.sh
[root@nginx zabbix_java]# vim settings.sh [root@nginx zabbix_java]# sed -e '/^#/d;/^$/d' settings.sh LISTEN_IP="0.0.0.0" LISTEN_PORT=10052 PID_FILE="/tmp/zabbix_java.pid" START_POLLERS=5 [root@nginx zabbix_java]#
[root@nginx zabbix_java]# sed -e '/^#/d;/^$/d' /usr/local/etc/zabbix_server.conf LogFile=/tmp/zabbix_server.log DBName=zabbix DBUser=zabbix DBPassword=zabbix [root@nginx zabbix_java]# vim /usr/local/etc/zabbix_server.conf [root@nginx zabbix_java]# sed -e '/^#/d;/^$/d' /usr/local/etc/zabbix_server.conf LogFile=/tmp/zabbix_server.log DBName=zabbix DBUser=zabbix DBPassword=zabbix JavaGateway=127.0.0.1 JavaGatewayPort=10052 StartJavaPollers=5
[root@nginx zabbix-2.2.0]# find / -name zabbix_java /usr/local/sbin/zabbix_java /tmp/zabbix-2.2.0/src/zabbix_java [root@nginx zabbix-2.2.0]# [root@nginx zabbix-2.2.0]# ls bin lib settings.sh shutdown.sh startup.sh [root@nginx zabbix-2.2.0]# ss -tunlp | grep 10052 tcp LISTEN 0 50 :::10052 :::* users:(("java",16405,12))
root@tomcat5 tmp]# wget http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.8/bin/extras/catalina-jmx-remote.jar
[root@tomcat5 tmp]# mv catalina-jmx-remote.jar /usr/local/tomcat/lib/ [root@tomcat5 tmp]#
CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=**ip**"
[root@nginx zabbix-2.2.0]# java -jar /root/cmdline-jmxclient-0.10.3.jar - 192.168.146.130:9999 java.lang:type=Memory NonHeapMemoryUsage 05/24/2014 15:42:02 +0800 org.archive.jmx.Client NonHeapMemoryUsage: committed: 47316992 init: 24313856 max: 136314880 used: 47012784