Doc: Jolokia JVM monitoring with Jolokia JVM agent

A little doc using Jolokia plugin for monitoring a Java virtual machine (JVM):

I use the Jolokia JVM agent - not the WAR deployment.
Example for tomcat monitoring with jolokia agent:

Needs:

  • Jolokia jolokia-agent-jvm Jolokia – Download
  • JAVA_OPTS config
  • Checkmk plugin mk_jolokia.py
  • Checkmk config agent jologia.cfg
  • Python libs urllib3, requests

Install:

mk_jolokia.py - plugin:

# /usr/lib/check_mk_agent/plugins/mk_jolokia.py
( chmod +x mk_jolokia.py)

The mk_jolokia.py plugin nees python libraries ‘urllib3’ and ‘requests’.
See ‘check_mk_agent’ debug output:

<<<jolokia_info>>>
Error: mk_jolokia requires the requests library. Please install it on the monitored system.

if so, install python-pip and the library

dnf install python-pip
pip install requests

checkmk.cfg:

# /etc/check_mk/jolokia.cfg
instances = [
{
'protocol' : 'http' ,
'server' : '127.0.0.1' ,
'port' : 7777,
'suburi' : 'jolokia' ,
'instance' : 'jolokia-lab'
}
]

Jolokia JVM agent:
Place the jar file on the host:

# /usr/lib/java/jolokia-agent-jvm-2.1.1-javaagent.jar
( chmod +r, should be readable)

Call it with JAVA_OPTS:

# /etc/tomcat/conf.d/1-jolokia.conf
JDK_JAVA_OPTIONS= "-javaagent:/usr/lib/java/jolokia-agent-jvm-2.1.1-javaagent.jar=port=7777,host=0.0.0.0"

New discovered services:

1 Like

(without personally verifying)

On RockyLinux(9.x) hosts it should suffice to substitute:

pip install requests

for

dnf install python3-requests

IMHO: pip install 'module’ does not make the system aware of any installed module in python, so this should only be used as a last resort.

  • Glowsome