This file is indexed.

/usr/share/munin/plugins/jmx_ is in munin-plugins-java 2.0.25-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/bin/sh
# -*- sh -*-
: << =cut

=head1 NAME

jmx_ - Wildcard plugin to monitor Java application servers via JMX

=head1 APPLICABLE SYSTEMS

Tested with Tomcat 4.1/5.0/5.5/6.0 on Sun JVM 5/6 and OpenJDK.

Any JVM that supports JMX should in theory do.

Needs nc in path for autoconf.

=head1 CONFIGURATION

  [jmx_*]
    env.ip 127.0.0.1
    env.port 5400
    env.category jvm
    env.username monitorRole
    env.password SomethingSecret

    env.JRE_HOME /usr/lib/jvm/java-6-sun/jre
    env.JAVA_OPTS -Xmx128m

Needed configuration on the Tomcat side: add

  -Dcom.sun.management.jmxremote \
  -Dcom.sun.management.jmxremote.port=5400 \
  -Dcom.sun.management.jmxremote.ssl=false \
  -Dcom.sun.management.jmxremote.authenticate=false

to CATALINA_OPTS in your startup scripts.

Replace authenticate=false with 
  -Dcom.sun.management.jmxremote.password.file=/etc/tomcat/jmxremote.password \
  -Dcom.sun.management.jmxremote.access.file=/etc/tomcat/jmxremote.access
 ...if you want authentication.

jmxremote.password:
 monitorRole SomethingSecret

jmxremote.access:
 monitorRole readonly

You may need higher access levels for some counters, notably ThreadsDeadlocked.

=head1 BUGS

No encryption supported in the JMX connection.

The plugins available reflect the most interesting aspects of a
JVM runtime.  This should be extended to cover things specific to
Tomcat, JBoss, Glassfish and so on.  Patches welcome.

=head1 AUTHORS

=encoding UTF-8

Mo Amini, Diyar Amin and Younes Hajji, Høgskolen i Oslo/Oslo
University College.

Shell script wrapper and integration by Erik Inge Bolsø, Redpill
Linpro AS.

Previous work on JMX plugin by Aleksey Studnev. Support for
authentication added by Ingvar Hagelund, Redpill Linpro AS.

=head1 LICENSE

GPLv2

=head1 MAGIC MARKERS

 #%# family=auto
 #%# capabilities=autoconf suggest

=cut

MUNIN_JAR="/usr/share/munin/munin-jmx-plugins.jar"

if [ "x$JRE_HOME" != "x" ] ; then
  JRE=$JRE_HOME/bin/java
  export JRE_HOME=$JRE_HOME
fi
JAVA_BIN=${JRE:-/usr/bin/java}

ip=${ip:-127.0.0.1}
port=${port:-5400}

if [ "x$1" = "xsuggest" ] ; then
  echo MultigraphAll
  exit 0
fi

if [ "x$1" = "xautoconf" ] ; then
    NC=`which nc 2>/dev/null`
    if [ "x$NC" = "x" ] ; then
      echo "no (nc not found)"
      exit 0
    fi
    $NC -n -z $ip $port >/dev/null 2>&1
    CONNECT=$?

    $JAVA_BIN -? >/dev/null 2>&1
    JAVA=$?
    if [ $JAVA -ne 0 ] ; then
      echo "no (java runtime not found at $JAVA_BIN)"
      exit 0
    fi

    if [ ! -e $MUNIN_JAR ] ; then
      echo "no (munin jmx classes not found at $MUNIN_JAR)"
      exit 0
    fi

    if [ $CONNECT -eq 0 ] ; then
      echo "yes"
      exit 0
    else
      echo "no (connection to $ip:$port failed)"
      exit 0
    fi
fi

if [ "x$1" = "xconfig" ] ; then
  param=config
else
  param=Tomcat
fi

scriptname=${0##*/}
jmxfunc=${scriptname##*_}
prefix=${scriptname%_*}

if [ "x$jmxfunc" = "x" ] ; then
  echo "error, plugin must be symlinked in order to run"
  exit 1
fi

ip=$ip port=$port $JAVA_BIN -cp $MUNIN_JAR $JAVA_OPTS org.munin.plugin.jmx.$jmxfunc $param $prefix