"Fossies" - the Fresh Open Source Software Archive

Member "munin-2.0.52/plugins/node.d.java/jmx_.in" (20 Nov 2019, 3001 Bytes) of package /linux/misc/munin-2.0.52.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!@@GOODSH@@
    2 # -*- sh -*-
    3 : << =cut
    4 
    5 =head1 NAME
    6 
    7 jmx_ - Wildcard plugin to monitor Java application servers via JMX
    8 
    9 =head1 APPLICABLE SYSTEMS
   10 
   11 Tested with Tomcat 4.1/5.0/5.5/6.0 on Sun JVM 5/6 and OpenJDK.
   12 
   13 Any JVM that supports JMX should in theory do.
   14 
   15 Needs nc in path for autoconf.
   16 
   17 =head1 CONFIGURATION
   18 
   19   [jmx_*]
   20     env.ip 127.0.0.1
   21     env.port 5400
   22     env.category jvm
   23     env.username monitorRole
   24     env.password SomethingSecret
   25 
   26     env.JRE_HOME /usr/lib/jvm/java-6-sun/jre
   27     env.JAVA_OPTS -Xmx128m
   28 
   29 Needed configuration on the Tomcat side: add
   30 
   31   -Dcom.sun.management.jmxremote \
   32   -Dcom.sun.management.jmxremote.port=5400 \
   33   -Dcom.sun.management.jmxremote.ssl=false \
   34   -Dcom.sun.management.jmxremote.authenticate=false
   35 
   36 to CATALINA_OPTS in your startup scripts.
   37 
   38 Replace authenticate=false with
   39   -Dcom.sun.management.jmxremote.password.file=/etc/tomcat/jmxremote.password \
   40   -Dcom.sun.management.jmxremote.access.file=/etc/tomcat/jmxremote.access
   41  ...if you want authentication.
   42 
   43 jmxremote.password:
   44  monitorRole SomethingSecret
   45 
   46 jmxremote.access:
   47  monitorRole readonly
   48 
   49 You may need higher access levels for some counters, notably ThreadsDeadlocked.
   50 
   51 =head1 BUGS
   52 
   53 No encryption supported in the JMX connection.
   54 
   55 The plugins available reflect the most interesting aspects of a
   56 JVM runtime.  This should be extended to cover things specific to
   57 Tomcat, JBoss, Glassfish and so on.  Patches welcome.
   58 
   59 =head1 AUTHORS
   60 
   61 =encoding UTF-8
   62 
   63 Mo Amini, Diyar Amin and Younes Hajji, Høgskolen i Oslo/Oslo
   64 University College.
   65 
   66 Shell script wrapper and integration by Erik Inge Bolsø, Redpill
   67 Linpro AS.
   68 
   69 Previous work on JMX plugin by Aleksey Studnev. Support for
   70 authentication added by Ingvar Hagelund, Redpill Linpro AS.
   71 
   72 =head1 LICENSE
   73 
   74 GPLv2
   75 
   76 =head1 MAGIC MARKERS
   77 
   78  #%# family=auto
   79  #%# capabilities=autoconf suggest
   80 
   81 =cut
   82 
   83 MUNIN_JAR="@@JAVALIBDIR@@/munin-jmx-plugins.jar"
   84 
   85 if [ "x$JRE_HOME" != "x" ] ; then
   86   JRE=$JRE_HOME/bin/java
   87   export JRE_HOME=$JRE_HOME
   88 fi
   89 JAVA_BIN=${JRE:-@@JAVARUN@@}
   90 
   91 ip=${ip:-127.0.0.1}
   92 port=${port:-5400}
   93 
   94 if [ "x$1" = "xsuggest" ] ; then
   95   echo MultigraphAll
   96   exit 0
   97 fi
   98 
   99 if [ "x$1" = "xautoconf" ] ; then
  100     $JAVA_BIN -cp $MUNIN_JAR $JAVA_OPTS org.munin.plugin.jmx.PortProbe $port $ip
  101     CONNECT=$?
  102 
  103     $JAVA_BIN -? >/dev/null 2>&1
  104     JAVA=$?
  105     if [ $JAVA -ne 0 ] ; then
  106       echo "no (java runtime not found at $JAVA_BIN)"
  107       exit 0
  108     fi
  109 
  110     if [ ! -e $MUNIN_JAR ] ; then
  111       echo "no (munin jmx classes not found at $MUNIN_JAR)"
  112       exit 0
  113     fi
  114 
  115     if [ $CONNECT -eq 0 ] ; then
  116       echo "yes"
  117       exit 0
  118     else
  119       echo "no (connection to $ip:$port failed)"
  120       exit 0
  121     fi
  122 fi
  123 
  124 if [ "x$1" = "xconfig" ] ; then
  125   param=config
  126 else
  127   param=Tomcat
  128 fi
  129 
  130 scriptname=${0##*/}
  131 jmxfunc=${scriptname##*_}
  132 prefix=${scriptname%_*}
  133 
  134 if [ "x$jmxfunc" = "x" ] ; then
  135   echo "error, plugin must be symlinked in order to run"
  136   exit 1
  137 fi
  138 
  139 ip=$ip port=$port $JAVA_BIN -cp $MUNIN_JAR $JAVA_OPTS org.munin.plugin.jmx.$jmxfunc $param $prefix