首页 > java > munin监控jmx

munin监控jmx

2013年11月26日

munin是给懒人准备的,配置简单,插件丰富,图画的还漂亮。
最近想对tomcat做一下性能监控,于是配置了一下,整理记录。

tomcat开启jmx端口
启动脚本增加如下(munin的jmx插件默认使用1616端口,为了省事,直接listen到1616即可):

export JAVA_OPTS=”$JAVA_OPTS -Dcom.sun.management.jmxremote.port=1616 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false”

munin 客户端:

wget http://munin-monitoring.org/export/HEAD/munin-contrib/plugins/java/jmx/plugin/jmx_ -O /usr/share/munin/plugins/
wget http://munin-monitoring.org/export/HEAD/munin-contrib/plugins/java/jmx/plugin/jmxquery.jar -O /usr/share/munin/plugins/
cd /etc/munin/plugins
ln -sf /usr/share/munin/plugins/jmx_ jmx_process_memory
ln -sf /usr/share/munin/plugins/jmx_ jmx_threads

如这样:
lrwxrwxrwx 1 root root 29 Nov 25 11:43 jmx_process_memory -> /usr/share/munin/plugins/jmx_
lrwxrwxrwx 1 root root 29 Nov 25 22:42 jmx_threads -> /usr/share/munin/plugins/jmx_
lrwxrwxrwx 1 root root 29 Nov 25 22:42 jmx_cpu -> /usr/share/munin/plugins/jmx_
lrwxrwxrwx 1 root root 29 Nov 25 22:42 jmx_catalina_requests -> /usr/share/munin/plugins/jmx_
lrwxrwxrwx 1 root root 29 Nov 25 22:42 jmx_catalina_threads -> /usr/share/munin/plugins/jmx_
lrwxrwxrwx 1 root root 29 Nov 25 22:42 jmx_catalina_times -> /usr/share/munin/plugins/jmx_
lrwxrwxrwx 1 root root 29 Nov 25 22:42 jmx_catalina_traffic -> /usr/share/munin/plugins/jmx_

ls -l /usr/share/munin/plugins
-rw-r–r– 1 root root 1898 Nov 25 22:33 process_memory.conf
-rw-r–r– 1 root root 412 Nov 25 22:36 threads.conf
-rw-r–r– 1 root root 694 Nov 25 22:37 cpu.conf
-rw-r–r– 1 root root 484 Nov 25 22:56 catalina_threads.conf
-rw-r–r– 1 root root 631 Nov 25 22:59 catalina_requests.conf
-rw-r–r– 1 root root 1210 Nov 25 23:00 catalina_times.conf
-rw-r–r– 1 root root 714 Nov 25 23:00 catalina_traffic.conf

相关配置文件可参考:
http://munin-monitoring.org/browser/munin-contrib/plugins/java/jmx/examples
其中catalina_*.conf 需要稍微修改一下:
如将
catalina_threads_busy.jmxObjectName Catalina:name=http-bio-8080,type=ThreadPool
改成(需要看你的tomcat如何配置)
catalina_threads_busy.jmxObjectName Catalina:type=ThreadPool,name=”http-bio-8080″

服务端配置:

[Apps;java.2hei.net]
address 192.168.100.201
use_node_name yes

看看效果吧:

分类: java 标签: ,
本文的评论功能被关闭了.