Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / jmx / plugin / jmx_ @ eb100e33

Historique | Voir | Annoter | Télécharger (1,78 ko)

1
#!/bin/sh
2
#
3
# Wildcard-plugin to monitor Java JMX (http://java.sun.com/jmx)attributes.
4
# To monitor a # specific set of JMX attributes,
5
# link <config_name> to this file. E.g.
6
#
7
#    ln -s /usr/share/plugins/jmx_ /etc/munin/plugins/jmx_java_threads
8
#
9

    
10
# ...will monitor Java thread count, assuming java_threads.conf file is located in
11
# /etc/munin/plugins folder.
12
#
13
# For Java process to be monitored, it must expose JMX remote interface.
14
# With Java 1.5 it can be done by adding parameters as:
15
#
16
# -Dcom.sun.management.jmxremote.port=<PORT> -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
17
#
18
# For Tomcat to be monitored, add the following line in catalina.bat script:
19
# set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.port=<PORT> -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
20
#
21
# By default, the plugin monitors localhost on <PORT> = 1616 using URL
22
# service:jmx:rmi:///jndi/rmi://localhost:1616/jmxrmi
23
# It can be changed by specifying parameters in  /etc/munin/plugin-conf.d/munin-node
24
#
25
# [jmx_*]
26
# env.jmxurl service:jmx:rmi:///jndi/rmi://localhost:1616/jmxrmi
27
#
28
# Read more on JMX configuring at http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html
29
# $Log$
30
#
31
LINK=`readlink $0`
32
CONFIGNAME=`basename $0 | sed 's/^jmx_//g'`.conf
33
RDIR=`dirname $LINK`
34

    
35
if [ "$jmxurl" = "" ]; then
36
SERVICE=service:jmx:rmi:///jndi/rmi://localhost:1616/jmxrmi
37
else
38
SERVICE="$jmxurl"
39
fi
40

    
41
if [ "$jmxuser" != "" ]; then
42
CREDS="--user=$jmxuser --pass=$jmxpass"
43
fi
44

    
45
# checks
46
test -z $CONFIGNAME || test -z "$RDIR" && exit 1
47

    
48
JMXQUERY="java -cp $RDIR/jmxquery.jar org.munin.JMXQuery --url=$SERVICE $CREDS --conf=$RDIR/$CONFIGNAME"
49

    
50

    
51
case $1 in
52
        (config)        $JMXQUERY config;;
53
        (*)             $JMXQUERY       ;;
54
esac