1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 02:51:03 +00:00

readd jmx (extracted) because it seems to be different from the jmx in the main munin distribution

This commit is contained in:
Kenyon Ralph 2012-03-05 00:18:19 -08:00
parent 933f0ea70b
commit ddc46f88fd
10 changed files with 280 additions and 0 deletions

View file

@ -0,0 +1,22 @@
graph_args --upper-limit 100 -l 0
graph_scale no
graph_title CPU Usage
graph_vlabel 1000* CPU time %
graph_category Java
graph_order java_cpu_time java_cpu_user_time
java_cpu_time.label cpu
java_cpu_time.jmxObjectName java.lang:type=Threading
java_cpu_time.jmxAttributeName CurrentThreadCpuTime
java_cpu_time.type DERIVE
java_cpu_time.min 0
java_cpu_time.graph yes
java_cpu_time.cdef java_cpu_time,3000000,/
java_cpu_user_time.label user
java_cpu_user_time.jmxObjectName java.lang:type=Threading
java_cpu_user_time.jmxAttributeName CurrentThreadUserTime
java_cpu_user_time.type DERIVE
java_cpu_user_time.min 0
java_cpu_user_time.graph yes
java_cpu_user_time.cdef java_cpu_user_time,3000000,/

View file

@ -0,0 +1,46 @@
graph_title Process Memory
graph_vlabel Bytes
graph_category Java
graph_order java_memory_nonheap_committed java_memory_nonheap_max java_memory_nonheap_used java_memory_heap_committed java_memory_heap_max java_memory_heap_used os_memory_physical os_memory_vm
java_memory_nonheap_committed.label non-heap committed
java_memory_nonheap_committed.jmxObjectName java.lang:type=Memory
java_memory_nonheap_committed.jmxAttributeName NonHeapMemoryUsage
java_memory_nonheap_committed.jmxAttributeKey committed
java_memory_nonheap_max.label non-heap max
java_memory_nonheap_max.jmxObjectName java.lang:type=Memory
java_memory_nonheap_max.jmxAttributeName NonHeapMemoryUsage
java_memory_nonheap_max.jmxAttributeKey max
java_memory_nonheap_used.label non-heap used
java_memory_nonheap_used.jmxObjectName java.lang:type=Memory
java_memory_nonheap_used.jmxAttributeName NonHeapMemoryUsage
java_memory_nonheap_used.jmxAttributeKey used
java_memory_heap_committed.label heap committed
java_memory_heap_committed.jmxObjectName java.lang:type=Memory
java_memory_heap_committed.jmxAttributeName HeapMemoryUsage
java_memory_heap_committed.jmxAttributeKey committed
java_memory_heap_max.label heap max
java_memory_heap_max.jmxObjectName java.lang:type=Memory
java_memory_heap_max.jmxAttributeName HeapMemoryUsage
java_memory_heap_max.jmxAttributeKey max
java_memory_heap_used.label heap used
java_memory_heap_used.jmxObjectName java.lang:type=Memory
java_memory_heap_used.jmxAttributeName HeapMemoryUsage
java_memory_heap_used.jmxAttributeKey used
os_memory_physical.label os free mem
os_memory_physical.jmxObjectName java.lang:type=OperatingSystem
os_memory_physical.jmxAttributeName FreePhysicalMemorySize
os_memory_physical.graph no
os_memory_vm.label os vmem committed
os_memory_vm.jmxObjectName java.lang:type=OperatingSystem
os_memory_vm.jmxAttributeName CommittedVirtualMemorySize
os_memory_vm.graph no

View file

@ -0,0 +1,14 @@
graph_title Thread Count
graph_vlabel Thread Count
graph_category Java
graph_order java_thread_count java_thread_count_peak
java_thread_count.label count
java_thread_count.jmxObjectName java.lang:type=Threading
java_thread_count.jmxAttributeName ThreadCount
java_thread_count_peak.label peak
java_thread_count_peak.jmxObjectName java.lang:type=Threading
java_thread_count_peak.jmxAttributeName PeakThreadCount

View file

@ -0,0 +1,16 @@
graph_title Requests Per Second
graph_vlabel requests per second
graph_category Tomcat
graph_order catalina_request_count catalina_error_count
catalina_request_count.label requests
catalina_request_count.jmxObjectName Catalina:name=http-8080,type=GlobalRequestProcessor
catalina_request_count.jmxAttributeName requestCount
catalina_request_count.type DERIVE
catalina_request_count.min 0
catalina_error_count.label errors
catalina_error_count.jmxObjectName Catalina:name=http-8080,type=GlobalRequestProcessor
catalina_error_count.jmxAttributeName errorCount
catalina_error_count.type DERIVE
catalina_error_count.min 0

View file

@ -0,0 +1,12 @@
graph_title Thread Count
graph_vlabel Thread Count
graph_category Tomcat
graph_order catalina_threads_count catalina_threads_busy
catalina_threads_busy.label busy
catalina_threads_busy.jmxObjectName Catalina:name=http-8080,type=ThreadPool
catalina_threads_busy.jmxAttributeName currentThreadsBusy
catalina_threads_count.label current
catalina_threads_count.jmxObjectName Catalina:name=http-8080,type=ThreadPool
catalina_threads_count.jmxAttributeName currentThreadCount

View file

@ -0,0 +1,32 @@
graph_title Response Time
graph_vlabel Time, ms
graph_category Rules Engine
graph_args --upper-limit 100 -l 0
graph_scale no
graph_category Tomcat
graph_order catalina_request_count catalina_max_time catalina_proc_time catalina_proc_tpr
catalina_request_count.label requests
catalina_request_count.jmxObjectName Catalina:name=http-8080,type=GlobalRequestProcessor
catalina_request_count.jmxAttributeName requestCount
catalina_request_count.graph no
catalina_request_count.type DERIVE
catalina_request_count.min 0
catalina_proc_time.label time
catalina_proc_time.jmxObjectName Catalina:name=http-8080,type=GlobalRequestProcessor
catalina_proc_time.jmxAttributeName processingTime
catalina_proc_time.type DERIVE
catalina_proc_time.min 0
catalina_proc_time.graph no
catalina_proc_tpr.label avg
catalina_proc_tpr.jmxObjectName Catalina:name=http-8080,type=GlobalRequestProcessor
catalina_proc_tpr.jmxAttributeName processingTime
catalina_proc_tpr.cdef catalina_request_count,0,EQ,0,catalina_proc_time,catalina_request_count,/,IF
catalina_max_time.label peak
catalina_max_time.jmxObjectName Catalina:name=http-8080,type=GlobalRequestProcessor
catalina_max_time.jmxAttributeName maxTime

View file

@ -0,0 +1,18 @@
graph_title Traffic
graph_vlabel Bytes rec(-)/sent(+) per second
graph_category Tomcat
graph_order catalina_bytes_received catalina_bytes_sent
catalina_bytes_sent.label bps
catalina_bytes_sent.jmxObjectName Catalina:name=http-8080,type=GlobalRequestProcessor
catalina_bytes_sent.jmxAttributeName bytesSent
catalina_bytes_sent.type DERIVE
catalina_bytes_sent.min 0
catalina_bytes_sent.negative catalina_bytes_received
catalina_bytes_received.label received
catalina_bytes_received.jmxObjectName Catalina:name=http-8080,type=GlobalRequestProcessor
catalina_bytes_received.jmxAttributeName bytesReceived
catalina_bytes_received.type DERIVE
catalina_bytes_received.min 0
catalina_bytes_received.graph no

54
plugins/java/jmx/plugin/jmx_ Executable file
View file

@ -0,0 +1,54 @@
#!/bin/sh
#
# Wildcard-plugin to monitor Java JMX (http://java.sun.com/jmx)attributes.
# To monitor a # specific set of JMX attributes,
# link <config_name> to this file. E.g.
#
# ln -s /usr/share/plugins/jmx_ /etc/munin/plugins/jmx_java_threads
#
# ...will monitor Java thread count, assuming java_threads.conf file is located in
# /etc/munin/plugins folder.
#
# For Java process to be monitored, it must expose JMX remote interface.
# With Java 1.5 it can be done by adding parameters as:
#
# -Dcom.sun.management.jmxremote.port=<PORT> -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
#
# For Tomcat to be monitored, add the following line in catalina.bat script:
# set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.port=<PORT> -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
#
# By default, the plugin monitors localhost on <PORT> = 1616 using URL
# service:jmx:rmi:///jndi/rmi://localhost:1616/jmxrmi
# It can be changed by specifying parameters in /etc/munin/plugin-conf.d/munin-node
#
# [jmx_*]
# env.jmxurl service:jmx:rmi:///jndi/rmi://localhost:1616/jmxrmi
#
# Read more on JMX configuring at http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html
# $Log$
#
LINK=`readlink $0`
CONFIGNAME=`basename $0 | sed 's/^jmx_//g'`.conf
RDIR=`dirname $LINK`
if [ "$jmxurl" = "" ]; then
SERVICE=service:jmx:rmi:///jndi/rmi://localhost:1616/jmxrmi
else
SERVICE="$jmxurl"
fi
if [ "$jmxuser" != "" ]; then
CREDS="--user=$jmxuser --pass=$jmxpass"
fi
# checks
test -z $CONFIGNAME || test -z "$RDIR" && exit 1
JMXQUERY="java -cp $RDIR/jmxquery.jar org.munin.JMXQuery --url=$SERVICE $CREDS --conf=$RDIR/$CONFIGNAME"
case $1 in
(config) $JMXQUERY config;;
(*) $JMXQUERY ;;
esac

Binary file not shown.

View file

@ -0,0 +1,66 @@
-------- JMX plugin for Munin ---------
Java JMX Munin plugin enables you to monitor JMX attributes in Munin.
As soon as JMX embedded in Java 5, any Java process may expose parameters to be monitored using JMX interface,
look http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html and http://java.sun.com/jmx for details
In Java version < 5 it is still possible to expose JMX interface using third party libraries
To see what can be monitored by JMX, run <JDK>/bin/jconsole.exe and connect to
the host/port you setup in your Java process.
Some examples are:
* standard Java JMX implementation exposes memory, threads, OS, garbage collector parameters
* Tomcat exposes multiple parameters - requests, processing time, threads, etc..
* spring framework allows to expose Java beans parameters to JMX
* your application may expose any attributes for JMX by declaration or explicitly.
* can monitor localhost or remote processes
-------- Installation ---------
Pre-requsisites are:
- installed munin-node
- Java version 5 JRE
1) Files from "plugin" folder must be copied to /usr/share/munin/plugins (or another - where your munin plugins located)
2) Make sure that jmx_ executable : chmod a+x /usr/share/munin/plugins/jmx_
3) Copy configuration files that you want to use, from "examples" folder, into /usr/share/munin/plugins folder
4) create links from the /etc/munin/plugins folder to the /usr/share/munin/plugins/jmx_
The name of the link must follow wildcard pattern:
jmx_<configname>,
where configname is the name of the configuration (config filename without extension), for example:
ln -s /usr/share/munin/plugins/jmx_ /etc/munin/plugins/jmx_process_memory
5) optionally specify the environment variable for JMX URL. The default URL corresponds to localhost:1616.
If you have different port listening by JMX or different hostname to monitor, specify jmxurl parameter
in /etc/munin/plugin-conf.d/munin-node:
[jmx_*]
env.jmxurl service:jmx:rmi:///jndi/rmi://localhost:1616/jmxrmi
-------- Check Installation ---------
To check that all installed properly, try invoke plugins from command line, using links like:
root@re:/etc/munin/plugins# ./jmx_java_process_memory config
graph_category Java
...
root@re:/etc/munin/plugins# ./jmx_java_process_memory
java_memory_nonheap_committed.value 35291136
...
If you have configured environment for jmxurl, do not forget to export it before!
-------- Configuration Files ---------
Folder "examples" contains configuration files for Java and Tomcat monitoring examples.
The format of configuration file is a superset of Munin plugin "config" command output
(http://munin.projects.linpro.no/wiki/protocol-config)
It has the following additions:
<fieldname>.jmxObjectName JMX object name, e.g. java.lang:type=Memory
<fieldname>.jmxAttributeName JMX attribute name, e.g. NonHeapMemoryUsage
<fieldname>.jmxAttributeKey If attribute is a composed data (structure), the name of the field in structure, e.g. max
% separates comments in file