1

It would be great if anyone can share a working configuration for the tomcat_ plugin of munin. I need to monitor several tomcat instances on one machine.

So far I can't figure out:

  • which are the available metrics for the tomcat_ plugin? (documentation is quite poor - at least what I've managed to find)
  • how to configure it correctly?

3 Answers3

9

share my experiences,hope it helps

step1: enable tomcat plugins

sudo ln -s /usr/share/munin/plugins/tomcat_access /etc/munin/plugins/tomcat_access
sudo ln -s /usr/share/munin/plugins/tomcat_jvm /etc/munin/plugins/tomcat_jvm
sudo ln -s /usr/share/munin/plugins/tomcat_threads /etc/munin/plugins/tomcat_threads
sudo ln -s /usr/share/munin/plugins/tomcat_volume /etc/munin/plugins/tomcat_volume

step2: config tomcat manager status page where the plugin read info from

edit tomcat-users.xml and add

<user username="munin" password="munin" roles="manager"/>
<role rolename="manager"/>

access http://munin:munin@localhost:8080/manager/status?XML=true to see if it works. check official document for details:Manager App HOW-TO

step3: config tomcat plugins

edit /etc/munin/plugin-conf.d/munin-node and add

[tomcat_*]
env.ports 8080
env.user munin
env.password munin

step4: local check

run and check messages.

/etc/munin/plugins/tomcat_jvm

normally you need install simple xml support,

sudo apt-get install libxml-simple-perl
#OR
sudo yum install perl-XML-Simple

step5: update munin node

sudo /etc/init.d/munin-node restart

check you graphics, it should works.

Michael
  • 206
  • 1
  • 3
  • Thank you for the instructions, I still hadn't the chance to check it out and verify your answer, but I'll mark the question as answered. If problems appear, I'll add to the discussion. – Vladimir Tsvetkov Jan 11 '12 at 11:28
  • 1
    You shouldn't run munin plug-ins that way. Instead, use the provided command, as in `munin-run tomcat_jvm`, so you will also check that munin configuration for finding and running your plug-in is correct. – eppesuig Jan 25 '15 at 23:10
7

First, it's a great answer! However, when you mention manually running and checking using "/etc/munin/plugins/tomcat_jvm," this doesn't pick up the environment variables from /etc/munin/plugin-conf.d/munin-node (i.e. user/password), so it fails. The correct way is to use munin-run:

$ sudo /etc/munin/plugins/tomcat_jvm
free.value U
used.value U
max.value U

$ sudo munin-run tomcat_jvm
free.value 13894584
used.value 40762440
max.value 1073741824

Also, I'm running Tomcat 7 and some of the tomcat plugins expect connectors with the name of the form http-${PORT} but my connectors are of the form http-apr-${PORT} so I also needed to add this to the [tomcat_*] stanza of munin-node:

env.connector "http-apr-8081"
Pierre.Vriens
  • 1,159
  • 34
  • 15
  • 19
Infofinity
  • 203
  • 3
  • 5
3

My reputation doesn't allow commenting, but correct env.connector is crucial for other plugins than tomcat_jvm. In my case I needed to drop quotation marks ("), i.e.

 env.connector jk-127.0.0.1-8009

If you can't find the correct connector name, try either

$ lynx http://localhost:8080/manager/html

or

$ curl http://localhost:8080/manager/status?XML=true -u munin:munin | grep connector

Also note, that in tomcat 6.0.30 or later, the roles for manager are more fine-grained. I haven't yet tried myself, but according to the documentation role manager-status in tomcat-users.xml should work in this case.

isido
  • 61
  • 4