CentOS7上のmuninにtomcatの監視をさせてみる

Apacheインストール済みの状態を前提条件とします。

muninをインストールする

yum install epel-release
yum install munin munin-node
yum install munin-java-plugins
htpasswd -c /etc/munin/munin-htpasswd muninadmin
munin-node restart
systemctl restart httpd

監視間隔の設定をします。

vim /etc/munin/munin.conf
update_rate 60
vim  /etc/cron.d/munin
*/1 * * * *     munin test -x /usr/bin/munin-cron && /usr/bin/munin-cron
service munin-node stop
rm -rf /var/lib/munin/localhost
service munin-node start
CATALINA_OPTS="-Dcom.sun.management.jmxremote.port=5600 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
vim /etc/munin/plugin-conf.d/jmx

[jmx_*]
env.ip 127.0.0.1
env.port 1616
env.JRE_HOME XXX
env.JAVA_OPTS -Xmx128m

ln -s /usr/share/munin/plugins/tomcat_access /etc/munin/plugins/ ln -s /usr/share/munin/plugins/tomcat_jvm /etc/munin/plugins/ ln -s /usr/share/munin/plugins/tomcat_threads /etc/munin/plugins/ ln -s /usr/share/munin/plugins/tomcat_volume /etc/munin/plugins/
vim tomcat-users.xml

<role rolename="manager-status" />
<user username="munin" password="munin" roles="manager-status"/>
vim /etc/munin/plugin-conf.d/tomcat

env.host      localhost
env.port      8080
env.request   /manager/status?XML=true
env.user      munin
env.password  munin
env.timeout   30
env.connector http-bio-8080
munin-node restart
systemctl restart httpd