Commands

This is a short description of how to use the predefined check_jmx command found in jmx.cfg.

Usage

  check_jmx!<PORT>!<JMX_ARGUMENTS>

Definition

See also jmx.cfg

# 'check_jmx' command definition
define command {
  command_name    check_jmx
  command_line    /usr/local/nagios/libexec/check_jmx -U service:jmx:rmi:///jndi/rmi://'$HOSTADDRESS$':'$ARG1$'/jmxrmi $ARG2$
}

Examples

Note: The examples depend on the JVM used. Settings might differ and might be named differently based on OS and JVM vendor. Authorisation is left out.

Garbage Collection

  check_jmx!<PORT>!-O "java.lang:type=GarbageCollector,name=ConcurrentMarkSweep" -A LastGcInfo -K duration -w 3500 -c 4000 -u ms

Heap Memory

  check_jmx!<PORT>!-O java.lang:type=Memory -A HeapMemoryUsage -K used -w 4150000000 -c 4200000000 -u B

Memory Pools

Reset peak usage statistics after retrieving value.

  check_jmx!<PORT>!-O "java.lang:type=MemoryPool,name=CMS Perm Gen" -A PeakUsage -K used -u B -o resetPeakUsage

System Load

  check_jmx!<PORT>!-O "java.lang:type=OperatingSystem" -A SystemLoadAverage

Threading

  check_jmx!<PORT>!-O "java.lang:type=Threading" -A ThreadCount

Regular Expression Matching

This example will warn you if the operating system version changes.

  check_jmx!<PORT>!-O "java.lang:type=OperatingSystem" -A Version -w "2.6.32-22-generic"

This example will warn you if the value of the Status attribute doesn't match the regex.

  check_jmx!<PORT>!-O "ch.syabru.nagios:name=TestBean" -A Status -w "^OK.*"

A regex starting with a '@' means that the threshold is matched if the regex matches.

  check_jmx!<PORT>!-O "ch.syabru.nagios:name=TestBean" -A Status -w "@.*WARN.*"