mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
Category Tree: Reduce number of categories
java -> virtualization (jvm) wuala -> backup (wuala) games (game) -> games (quake)
This commit is contained in:
parent
e148716e6e
commit
8d9fe5bdde
11 changed files with 7 additions and 7 deletions
218
plugins/jvm/jstat__gccount
Executable file
218
plugins/jvm/jstat__gccount
Executable file
|
@ -0,0 +1,218 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Plugin for monitor JVM activity - GC Count -
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# Symlink into /etc/munin/plugins/ and add the monitored
|
||||
# alias name like :
|
||||
#
|
||||
# ln -s /usr/share/munin/plugins/jstat__gccount \
|
||||
# /etc/munin/plugins/jstat_<jvm alias>_gccount
|
||||
# This should, however, be given through autoconf and suggest.
|
||||
#
|
||||
# Requirements:
|
||||
#
|
||||
# You need to execute your Java program under jsvc provided by
|
||||
# http://jakarta.apache.org/commons/daemon/
|
||||
# which enables you to run your Java program with specified
|
||||
# pid file with -pidfile option.
|
||||
# A Brief setup documentation is also available at
|
||||
# http://tomcat.apache.org/tomcat-5.5-doc/setup.html
|
||||
#
|
||||
# Target:
|
||||
#
|
||||
# Target Java Virtual Machine to monitor are:
|
||||
# Sun JDK 5.0 (http://java.sun.com/javase/) (default)
|
||||
# BEA JRockit 5.0 (http://dev2dev.bea.com/jrockit/)
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# config (required)
|
||||
#
|
||||
# Config variables:
|
||||
#
|
||||
# pidfilepath - Which file path use. Defaults to '/var/run/jsvc.pid'
|
||||
# javahome - Defaults to '/usr/local/java/jdk'
|
||||
#
|
||||
DefaultPidFile="/var/run/jsvc.pid"
|
||||
DefaultJavaHome="/usr/local/java/jdk"
|
||||
|
||||
#
|
||||
# Environment Variables
|
||||
#
|
||||
if [ -z "${pidfilepath}" ]; then
|
||||
pidfilepath="${DefaultPidFile}"
|
||||
fi
|
||||
|
||||
if [ -z "${graphtitle}" ]; then
|
||||
graphtitle="${pidfilepath}"
|
||||
fi
|
||||
|
||||
if [ -z "${javahome}" ]; then
|
||||
JAVA_HOME="${DefaultJavaHome}"
|
||||
else
|
||||
JAVA_HOME="${javahome}"
|
||||
fi
|
||||
export JAVA_HOME
|
||||
|
||||
#
|
||||
# Functions
|
||||
#
|
||||
chk_jdk()
|
||||
{
|
||||
isJRockit=`${JAVA_HOME}/bin/java -version 2>&1 | egrep -i 'jrockit'`
|
||||
if [ -n "${isJRockit}" ]; then
|
||||
JDK_TYPE="bea"
|
||||
else
|
||||
JDK_TYPE="sun"
|
||||
fi
|
||||
}
|
||||
|
||||
chk_version()
|
||||
{
|
||||
Version=`${JAVA_HOME}/bin/java -version 2>&1 | egrep '^java version' | awk '{print $3}' | sed -e 's/\"//g' | cut -d'_' -f 1`
|
||||
if [ "${Version}" != "1.5.0" ]; then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
config_common()
|
||||
{
|
||||
echo 'graph_title GC Count' $graphtitle
|
||||
echo 'graph_args -l 0'
|
||||
echo 'graph_vlabel GC Count(times)'
|
||||
echo 'graph_total total'
|
||||
echo 'graph_info GC Count'
|
||||
echo 'graph_category virtualization'
|
||||
}
|
||||
|
||||
config_sun_jdk()
|
||||
{
|
||||
config_common
|
||||
|
||||
echo 'Young_GC.label Young_GC'
|
||||
echo 'Young_GC.min 0'
|
||||
echo 'Full_GC.label Full_GC'
|
||||
echo 'Full_GC.min 0'
|
||||
|
||||
}
|
||||
|
||||
config_bea_jdk()
|
||||
{
|
||||
config_common
|
||||
|
||||
echo 'Young_GC.label Young_GC'
|
||||
echo 'Young_GC.min 0'
|
||||
echo 'Old_GC.label Old_GC'
|
||||
echo 'Old_GC.min 0'
|
||||
}
|
||||
|
||||
print_sun_stats()
|
||||
{
|
||||
${JAVA_HOME}/bin/jstat -gc ${PidNum} | tail -1 | awk \
|
||||
'{\
|
||||
S0C = $1; \
|
||||
S1C = $2; \
|
||||
S0U = $3; \
|
||||
S1U = $4; \
|
||||
EC = $5; \
|
||||
EU = $6; \
|
||||
OC = $7; \
|
||||
OU = $8; \
|
||||
PC = $9; \
|
||||
PU = $10; \
|
||||
YGC = $11; \
|
||||
YGCT = $12; \
|
||||
FGC = $13; \
|
||||
FGCT = $14; \
|
||||
GCT = $15; \
|
||||
\
|
||||
S0F = S0C - S0U; \
|
||||
S1F = S1C - S1U; \
|
||||
EF = EC - EU; \
|
||||
OF = OC - OU; \
|
||||
PF = PC - PU; \
|
||||
\
|
||||
print "Young_GC.value " YGC; \
|
||||
print "Full_GC.value " FGC; \
|
||||
}'
|
||||
}
|
||||
|
||||
print_bea_stats()
|
||||
{
|
||||
${JAVA_HOME}/bin/jstat -gc ${PidNum} | tail -1 | awk \
|
||||
'{\
|
||||
HeapSize = $1; \
|
||||
NurserySize = $2; \
|
||||
UsedHeapSize = $3; \
|
||||
YC = $4; \
|
||||
OC = $5; \
|
||||
YCTime = $6; \
|
||||
OCTime = $7; \
|
||||
GCTime = $8; \
|
||||
YCPauseTime = $9; \
|
||||
OCPauseTime = $10; \
|
||||
PauseTime = $11; \
|
||||
Finalizers = $12; \
|
||||
\
|
||||
print "Young_GC.value " YC; \
|
||||
print "Old_GC.value " OC;\
|
||||
}'
|
||||
}
|
||||
|
||||
#
|
||||
# common for all argument
|
||||
#
|
||||
chk_jdk
|
||||
|
||||
#
|
||||
# autoconf
|
||||
#
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
|
||||
if [ ! -x "${JAVA_HOME}/bin/jstat" ]; then
|
||||
echo "no (No jstat found in ${JAVA_HOME}/bin)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
chk_version
|
||||
if [ $? != 0 ]; then
|
||||
echo "no (Java version is invalid)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "${pidfilepath}" -o ! -r "${pidfilepath}" ]; then
|
||||
echo "no (No such file ${pidfilepath} or cannot read ${pidfilepath}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "yes"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# config
|
||||
#
|
||||
if [ "$1" = "config" ]; then
|
||||
if [ "${JDK_TYPE}" == "bea" ]; then
|
||||
config_bea_jdk
|
||||
else
|
||||
config_sun_jdk
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#
|
||||
# Main
|
||||
#
|
||||
PidNum=`cat ${pidfilepath}`
|
||||
|
||||
if [ "${JDK_TYPE}" == "bea" ]; then
|
||||
print_bea_stats
|
||||
else
|
||||
print_sun_stats
|
||||
fi
|
226
plugins/jvm/jstat__gctime
Executable file
226
plugins/jvm/jstat__gctime
Executable file
|
@ -0,0 +1,226 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Plugin for monitor JVM activity - GC Time -
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# Symlink into /etc/munin/plugins/ and add the monitored
|
||||
# alias name like :
|
||||
#
|
||||
# ln -s /usr/share/munin/plugins/jstat__gctime \
|
||||
# /etc/munin/plugins/jstat_<jvm alias>_gctime
|
||||
# This should, however, be given through autoconf and suggest.
|
||||
#
|
||||
# Requirements:
|
||||
#
|
||||
# You need to execute your Java program under jsvc provided by
|
||||
# http://jakarta.apache.org/commons/daemon/
|
||||
# which enables you to run your Java program with specified
|
||||
# pid file with -pidfile option.
|
||||
# A Brief setup documentation is also available at
|
||||
# http://tomcat.apache.org/tomcat-5.5-doc/setup.html
|
||||
#
|
||||
# Target:
|
||||
#
|
||||
# Target Java Virtual Machine to monitor are:
|
||||
# Sun JDK 5.0 (http://java.sun.com/javase/) (default)
|
||||
# BEA JRockit 5.0 (http://dev2dev.bea.com/jrockit/)
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# config (required)
|
||||
#
|
||||
# Config variables:
|
||||
#
|
||||
# pidfilepath - Which file path use. Defaults to '/var/run/jsvc.pid'
|
||||
# javahome - Defaults to '/usr/local/java/jdk'
|
||||
#
|
||||
DefaultPidFile="/var/run/jsvc.pid"
|
||||
DefaultJavaHome="/usr/local/java/jdk"
|
||||
|
||||
#
|
||||
# Environment Variables
|
||||
#
|
||||
if [ -z "${pidfilepath}" ]; then
|
||||
pidfilepath="${DefaultPidFile}"
|
||||
fi
|
||||
|
||||
if [ -z "${graphtitle}" ]; then
|
||||
graphtitle="${pidfilepath}"
|
||||
fi
|
||||
|
||||
if [ -z "${javahome}" ]; then
|
||||
JAVA_HOME="${DefaultJavaHome}"
|
||||
else
|
||||
JAVA_HOME="${javahome}"
|
||||
fi
|
||||
export JAVA_HOME
|
||||
|
||||
#
|
||||
# Functions
|
||||
#
|
||||
chk_jdk()
|
||||
{
|
||||
isJRockit=`${JAVA_HOME}/bin/java -version 2>&1 | egrep -i 'jrockit'`
|
||||
if [ -n "${isJRockit}" ]; then
|
||||
JDK_TYPE="bea"
|
||||
else
|
||||
JDK_TYPE="sun"
|
||||
fi
|
||||
}
|
||||
|
||||
chk_version()
|
||||
{
|
||||
Version=`${JAVA_HOME}/bin/java -version 2>&1 | egrep '^java version' | awk '{print $3}' | sed -e 's/\"//g' | cut -d'_' -f 1`
|
||||
if [ "${Version}" != "1.5.0" ]; then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
config_common()
|
||||
{
|
||||
echo 'graph_title GC Time' $graphtitle
|
||||
echo 'graph_args -l 0'
|
||||
echo 'graph_vlabel GC Time(sec)'
|
||||
echo 'graph_total total'
|
||||
echo 'graph_info GC Time'
|
||||
echo 'graph_category virtualization'
|
||||
}
|
||||
|
||||
config_sun_jdk()
|
||||
{
|
||||
config_common
|
||||
|
||||
echo 'Young_GC.label Young_GC'
|
||||
echo 'Young_GC.min 0'
|
||||
echo 'Full_GC.label Full_GC'
|
||||
echo 'Full_GC.min 0'
|
||||
|
||||
}
|
||||
|
||||
config_bea_jdk()
|
||||
{
|
||||
config_common
|
||||
|
||||
echo 'Young_GC.label Young_GC'
|
||||
echo 'Young_GC.min 0'
|
||||
echo 'Old_GC.label Old_GC'
|
||||
echo 'Old_GC.min 0'
|
||||
echo 'Young_Pause.label Young_GC Pause'
|
||||
echo 'Young_Pause.min 0'
|
||||
echo 'Old_Pause.label Old_GC Pause'
|
||||
echo 'Old_Pause.min 0'
|
||||
|
||||
}
|
||||
|
||||
print_sun_stats()
|
||||
{
|
||||
${JAVA_HOME}/bin/jstat -gc ${PidNum} | tail -1 | awk \
|
||||
'{\
|
||||
S0C = $1; \
|
||||
S1C = $2; \
|
||||
S0U = $3; \
|
||||
S1U = $4; \
|
||||
EC = $5; \
|
||||
EU = $6; \
|
||||
OC = $7; \
|
||||
OU = $8;
|
||||
PC = $9; \
|
||||
PU = $10; \
|
||||
YGC = $11; \
|
||||
YGCT = $12; \
|
||||
FGC = $13; \
|
||||
FGCT = $14; \
|
||||
GCT = $15; \
|
||||
|
||||
\
|
||||
S0F = S0C - S0U; \
|
||||
S1F = S1C - S1U; \
|
||||
EF = EC - EU; \
|
||||
OF = OC - OU; \
|
||||
PF = PC - PU; \
|
||||
\
|
||||
print "Young_GC.value " YGCT; \
|
||||
print "Full_GC.value " FGCT; \
|
||||
}'
|
||||
}
|
||||
|
||||
print_bea_stats()
|
||||
{
|
||||
${JAVA_HOME}/bin/jstat -gc ${PidNum} | tail -1 | awk \
|
||||
'{\
|
||||
HeapSize = $1; \
|
||||
NurserySize = $2; \
|
||||
UsedHeapSize = $3; \
|
||||
YC = $4; \
|
||||
OC = $5; \
|
||||
YCTime = $6; \
|
||||
OCTime = $7; \
|
||||
GCTime = $8; \
|
||||
YCPauseTime = $9; \
|
||||
OCPauseTime = $10; \
|
||||
PauseTime = $11; \
|
||||
Finalizers = $12; \
|
||||
\
|
||||
print "Young_GC.value " YCTime; \
|
||||
print "Old_GC.value " OCTime; \
|
||||
print "Young_Pause.value " YCPauseTime; \
|
||||
print "Old_Pause.value " OCPauseTime
|
||||
}'
|
||||
}
|
||||
|
||||
#
|
||||
# common for all argument
|
||||
#
|
||||
chk_jdk
|
||||
|
||||
#
|
||||
# autoconf
|
||||
#
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
|
||||
if [ ! -x "${JAVA_HOME}/bin/jstat" ]; then
|
||||
echo "no (No jstat found in ${JAVA_HOME}/bin)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
chk_version
|
||||
if [ $? != 0 ]; then
|
||||
echo "no (Java version is invalid)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "${pidfilepath}" -o ! -r "${pidfilepath}" ]; then
|
||||
echo "no (No such file ${pidfilepath} or cannot read ${pidfilepath}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "yes"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# config
|
||||
#
|
||||
if [ "$1" = "config" ]; then
|
||||
if [ "${JDK_TYPE}" == "bea" ]; then
|
||||
config_bea_jdk
|
||||
else
|
||||
config_sun_jdk
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#
|
||||
# Main
|
||||
#
|
||||
PidNum=`cat ${pidfilepath}`
|
||||
|
||||
if [ "${JDK_TYPE}" == "bea" ]; then
|
||||
print_bea_stats
|
||||
else
|
||||
print_sun_stats
|
||||
fi
|
238
plugins/jvm/jstat__heap
Executable file
238
plugins/jvm/jstat__heap
Executable file
|
@ -0,0 +1,238 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Plugin for monitor JVM activity - Heap Usage -
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# Symlink into /etc/munin/plugins/ and add the monitored
|
||||
# alias name like :
|
||||
#
|
||||
# ln -s /usr/share/munin/plugins/jstat__heap \
|
||||
# /etc/munin/plugins/jstat_<jvm alias>_heap
|
||||
# This should, however, be given through autoconf and suggest.
|
||||
#
|
||||
# Requirements:
|
||||
#
|
||||
# You need to execute your Java program under jsvc provided by
|
||||
# http://jakarta.apache.org/commons/daemon/
|
||||
# which enables you to run your Java program with specified
|
||||
# pid file with -pidfile option.
|
||||
# A Brief setup documentation is also available at
|
||||
# http://tomcat.apache.org/tomcat-5.5-doc/setup.html
|
||||
#
|
||||
# Target:
|
||||
#
|
||||
# Target Java Virtual Machine to monitor are:
|
||||
# Sun JDK 5.0 (http://java.sun.com/javase/) (default)
|
||||
# BEA JRockit 5.0 (http://dev2dev.bea.com/jrockit/)
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# config (required)
|
||||
#
|
||||
# Config variables:
|
||||
#
|
||||
# pidfilepath - Which file path use. Defaults to '/var/run/jsvc.pid'
|
||||
# javahome - Defaults to '/usr/local/java/jdk'
|
||||
#
|
||||
DefaultPidFile="/var/run/jsvc.pid"
|
||||
DefaultJavaHome="/usr/local/java/jdk"
|
||||
|
||||
#
|
||||
# Environment Variables
|
||||
#
|
||||
if [ -z "${pidfilepath}" ]; then
|
||||
pidfilepath="${DefaultPidFile}"
|
||||
fi
|
||||
|
||||
if [ -z "${graphtitle}" ]; then
|
||||
graphtitle="${pidfilepath}"
|
||||
fi
|
||||
|
||||
if [ -z "${javahome}" ]; then
|
||||
JAVA_HOME="${DefaultJavaHome}"
|
||||
else
|
||||
JAVA_HOME="${javahome}"
|
||||
fi
|
||||
export JAVA_HOME
|
||||
|
||||
#
|
||||
# Functions
|
||||
#
|
||||
chk_jdk()
|
||||
{
|
||||
isJRockit=`${JAVA_HOME}/bin/java -version 2>&1 | egrep -i 'jrockit'`
|
||||
if [ -n "${isJRockit}" ]; then
|
||||
JDK_TYPE="bea"
|
||||
else
|
||||
JDK_TYPE="sun"
|
||||
fi
|
||||
}
|
||||
|
||||
chk_version()
|
||||
{
|
||||
Version=`${JAVA_HOME}/bin/java -version 2>&1 | egrep '^java version' | awk '{print $3}' | sed -e 's/\"//g' | cut -d'_' -f 1`
|
||||
if [ "${Version}" != "1.5.0" ]; then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
config_common()
|
||||
{
|
||||
echo "graph_title Heap Usage" $graphtitle
|
||||
echo "graph_args --base 1024 -l 0"
|
||||
echo "graph_vlabel Heap Usage(Bytes)"
|
||||
echo "graph_info Heap Usage"
|
||||
echo "graph_category virtualization"
|
||||
}
|
||||
|
||||
config_sun_jdk()
|
||||
{
|
||||
config_common
|
||||
|
||||
echo "Eden_Used.label Eden_Used"
|
||||
echo "Eden_Free.label Eden_Free"
|
||||
echo "Survivor0_Used.label Survivor0_Used"
|
||||
echo "Survivor0_Free.label Survivor0_Free"
|
||||
echo "Survivor1_Used.label Survivor1_Used"
|
||||
echo "Survivor1_Free.label Survivor1_Free"
|
||||
echo "Old_Used.label Old_Used"
|
||||
echo "Old_Free.label Old_Free"
|
||||
echo "Permanent_Used.label Permanent_Used"
|
||||
echo "Permanent_Free.label Permanent_Free"
|
||||
echo "Eden_Used.draw AREA"
|
||||
echo "Eden_Free.draw STACK"
|
||||
echo "Survivor0_Used.draw STACK"
|
||||
echo "Survivor0_Free.draw STACK"
|
||||
echo "Survivor1_Used.draw STACK"
|
||||
echo "Survivor1_Free.draw STACK"
|
||||
echo "Old_Used.draw STACK"
|
||||
echo "Old_Free.draw STACK"
|
||||
echo "Permanent_Used.draw STACK"
|
||||
echo "Permanent_Free.draw STACK"
|
||||
}
|
||||
|
||||
config_bea_jdk()
|
||||
{
|
||||
config_common
|
||||
|
||||
echo "NurserySize.label NurserySize"
|
||||
echo "HeapSize.label HeapSize"
|
||||
echo "UsedHeapSize.label UsedHeapSize"
|
||||
echo "NurserySize.draw AREA"
|
||||
echo "HeapSize.draw STACK"
|
||||
echo "UsedHeapSize.draw STACK"
|
||||
}
|
||||
|
||||
print_sun_stats()
|
||||
{
|
||||
${JAVA_HOME}/bin/jstat -gc ${PidNum} | tail -1 | awk \
|
||||
'{\
|
||||
S0C = $1; \
|
||||
S1C = $2; \
|
||||
S0U = $3; \
|
||||
S1U = $4; \
|
||||
EC = $5; \
|
||||
EU = $6; \
|
||||
OC = $7; \
|
||||
OU = $8;
|
||||
PC = $9; \
|
||||
PU = $10; \
|
||||
\
|
||||
S0F = S0C - S0U; \
|
||||
S1F = S1C - S1U; \
|
||||
EF = EC - EU; \
|
||||
OF = OC - OU; \
|
||||
PF = PC - PU; \
|
||||
\
|
||||
print "Eden_Used.value " EU * 1024; \
|
||||
print "Eden_Free.value " EF * 1024; \
|
||||
print "Survivor0_Used.value " S0U * 1024; \
|
||||
print "Survivor0_Free.value " S0F * 1024; \
|
||||
print "Survivor1_Used.value " S1U * 1024; \
|
||||
print "Survivor1_Free.value " S1F * 1024; \
|
||||
print "Old_Used.value " OU * 1024; \
|
||||
print "Old_Free.value " OF * 1024; \
|
||||
print "Permanent_Used.value " PU * 1024; \
|
||||
print "Permanent_Free.value " PF * 1024; \
|
||||
}'
|
||||
}
|
||||
|
||||
print_bea_stats()
|
||||
{
|
||||
${JAVA_HOME}/bin/jstat -gc ${PidNum} | tail -1 | awk \
|
||||
'{\
|
||||
HeapSize = $1; \
|
||||
NurserySize = $2; \
|
||||
UsedHeapSize = $3; \
|
||||
YC = $4; \
|
||||
OC = $5; \
|
||||
YCTime = $6; \
|
||||
OCTime = $7; \
|
||||
GCTime = $8; \
|
||||
YCPauseTime = $9; \
|
||||
OCPauseTime = $10; \
|
||||
PauseTime = $11; \
|
||||
Finalizers = $12; \
|
||||
\
|
||||
print "NurserySize.value " NurserySize * 1024; \
|
||||
print "HeapSize.value " UsedHeapSize * 1024; \
|
||||
print "UsedHeapSize.value " UsedHeapSize * 1024; \
|
||||
}'
|
||||
}
|
||||
|
||||
#
|
||||
# common for all argument
|
||||
#
|
||||
chk_jdk
|
||||
|
||||
#
|
||||
# autoconf
|
||||
#
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
|
||||
if [ ! -x "${JAVA_HOME}/bin/jstat" ]; then
|
||||
echo "no (No jstat found in ${JAVA_HOME}/bin)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
chk_version
|
||||
if [ $? != 0 ]; then
|
||||
echo "no (Java version is invalid)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "${pidfilepath}" -o ! -r "${pidfilepath}" ]; then
|
||||
echo "no (No such file ${pidfilepath} or cannot read ${pidfilepath}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "yes"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# config
|
||||
#
|
||||
if [ "$1" = "config" ]; then
|
||||
if [ "${JDK_TYPE}" == "bea" ]; then
|
||||
config_bea_jdk
|
||||
else
|
||||
config_sun_jdk
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#
|
||||
# Main
|
||||
#
|
||||
PidNum=`cat ${pidfilepath}`
|
||||
|
||||
if [ "${JDK_TYPE}" == "bea" ]; then
|
||||
print_bea_stats
|
||||
else
|
||||
print_sun_stats
|
||||
fi
|
182
plugins/jvm/jvm_sun_memory
Executable file
182
plugins/jvm/jvm_sun_memory
Executable file
|
@ -0,0 +1,182 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
# Sun JVM memory statistics. Parses a verbose log of minor GC and
|
||||
# tenured GC stats.
|
||||
|
||||
# To determine the totalheap value it looks for maxmem stats (from a
|
||||
# tenured gc) in the last 5 minutes of the log file. If there are no
|
||||
# log lines in the last 5 minutes the value will be U(ndefined).
|
||||
|
||||
# Since the log lines are timestamped with seconds since the JVM
|
||||
# started we look at the last line of the log to determine when "now"
|
||||
# is for the JVM. In a reasonably active JVM there will be several
|
||||
# minor GCs a minute so the "now" approximation based on these log
|
||||
# lines are close enough.
|
||||
|
||||
# Configuration (common with the other sun_jvm_* plugins in this family):
|
||||
# [jvm_sun_*]
|
||||
# env.logfile /var/foo/java.log (default: /var/log/app/jvm/gc.log)
|
||||
# env.graphtitle (default: "Sun Java")
|
||||
|
||||
# You need to configure your Sun JVM with these options:
|
||||
# -verbose:gc
|
||||
# -Xloggc:/var/log/app/jvm/gc.log
|
||||
# -XX:+PrintGCTimeStamps
|
||||
# -XX:+PrintGCDetails
|
||||
|
||||
# History:
|
||||
|
||||
# This plugin was developed by various people over some time - no logs
|
||||
# of this has been found. - In 2006 significant contributions was
|
||||
# financed by NRK (Norwegian Broadcasting Coproration) and performed
|
||||
# by Nicolai Langfeldt of Linpro AS in Oslo, Norway.
|
||||
|
||||
# $Id: $
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Fcntl qw(:seek);
|
||||
|
||||
# Full path to jvm log file
|
||||
my $logfile = $ENV{logfile} || "/var/log/app/jvm/gc.log";
|
||||
my $grtitle = $ENV{graphtitle} || "Sun Java";
|
||||
|
||||
# Title that appears on munin graph
|
||||
my $title = "$grtitle memory usage";
|
||||
# Extended information that appears below munin graph
|
||||
my $info = "Write som info about this graph...";
|
||||
|
||||
sub analyze_record {
|
||||
# Match all interesting elements of a record and insert them
|
||||
# into a hash
|
||||
|
||||
my $record = shift;
|
||||
my %elements;
|
||||
|
||||
if ( $record =~
|
||||
m/(\d+\.\d+).+?(\d+\.\d+).+?DefNew: (\d+).+?(\d+).+?(\d+).+?(\d+\.\d+).+?(\d+\.\d+): \[Tenured(\[U.+\])*: (\d+).+?(\d+).+?(\d+).+?(\d+\.\d+).+?(\d+).+?(\d+).+?(\d+).+?(\d+\.\d+).+/
|
||||
) {
|
||||
%elements = (
|
||||
total_timestamp => $1,
|
||||
defnew_timestamp => $2,
|
||||
defnew_mem_from => $3*1024,
|
||||
defnew_mem_to => $4*1024,
|
||||
defnew_mem_max => $5*1024,
|
||||
defnew_time_used => $6,
|
||||
tenured_timestamp => $7,
|
||||
tenured_mem_from => $9*1024,
|
||||
tenured_mem_to => $10*1024,
|
||||
tenured_mem_max => $11*1024,
|
||||
tenured_time_used => $12,
|
||||
total_mem_from => $13*1024,
|
||||
total_mem_to => $14*1024,
|
||||
total_mem_max => $15*1024,
|
||||
total_time_used => $16 );
|
||||
}
|
||||
return %elements;
|
||||
}
|
||||
|
||||
my $record='';
|
||||
|
||||
# Print config information to munin server
|
||||
if ( $ARGV[0] and $ARGV[0] eq "config" ) {
|
||||
print "graph_title $title\n";
|
||||
print "graph_vlabel Bytes Memory\n";
|
||||
print "graph_category virtualization\n";
|
||||
print "graph_args --lower-limit 0\n";
|
||||
print "graph_info Show heap memory usage of JVM\n";
|
||||
print "graph_order defnew_max tenured_max tenured_start tenured_end defnew_start defnew_end totalheap totalheapmax\n";
|
||||
print "defnew_max.label DefNew max\n";
|
||||
print "defnew_max.draw AREA\n";
|
||||
print "tenured_max.label Tenured max\n";
|
||||
print "tenured_max.draw STACK\n";
|
||||
print "tenured_max.info DefNew max and Tenured max are stacked to show the total heap memory usage\n";
|
||||
print "tenured_start.label Tenured start\n";
|
||||
print "tenured_start.info Tenured (long term) memory used at start of GC\n";
|
||||
print "tenured_end.label Tenured end\n";
|
||||
print "tenured_end.info Tenured (long term) memory used at end of GC\n";
|
||||
print "defnew_start.label DefNew start\n";
|
||||
print "defnew_start.info Short term memory used by objects at start of GC\n";
|
||||
print "defnew_end.label DefNew end\n";
|
||||
print "defnew_end.info Short term memory claimed by objects that survived the GC\n";
|
||||
print "totalheapmax.label Maximum total heap\n";
|
||||
print "totalheapmax.info Maximum used total heap last 5 minutes\n";
|
||||
print "totalheaptomax.label Total heap end\n";
|
||||
print "totalheaptomax.info Heapsize at maximum after GC\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
# Scan through the log file and keep the last instance of a
|
||||
# Tenured record in $record.
|
||||
|
||||
my %last;
|
||||
# We can't be sure that there is a totalmemto in the log.
|
||||
my $totalmemto_atmax = 0;
|
||||
my $totalmemfrom_max = 0;
|
||||
|
||||
|
||||
open( FILE, "< $logfile" ) or die "Can't open $logfile: $!\n";
|
||||
|
||||
# We want to collect the highest total_mem_max in the last 5 minute period.
|
||||
seek(FILE,-4096,SEEK_END);
|
||||
my $now;
|
||||
my $lastnow = 0;
|
||||
|
||||
while (<FILE>) {
|
||||
chomp;
|
||||
if (/:/) {
|
||||
($now,undef) = split(/:/,$_,2);
|
||||
$now = $lastnow unless $now;
|
||||
}
|
||||
}
|
||||
|
||||
my $noolderthan = $now - 300;
|
||||
|
||||
# print "Latest time is: $now. 5 min ago is $noolderthan\n";
|
||||
|
||||
seek(FILE,0,SEEK_SET);
|
||||
|
||||
$lastnow = 0;
|
||||
$now=0;
|
||||
|
||||
while (<FILE>) {
|
||||
chomp;
|
||||
if (/:/) {
|
||||
($now,undef) = split(/:/,$_,2);
|
||||
$now = $lastnow unless $now;
|
||||
}
|
||||
|
||||
if (/.+Tenured.+/) {
|
||||
$record = $_;
|
||||
} elsif (/^:.+/) {
|
||||
$record .= $_;
|
||||
}
|
||||
if ($record =~ /Tenured.+secs\]$/) {
|
||||
%last = analyze_record($record);
|
||||
|
||||
#print "($now > $noolderthan and $last{total_mem_from} > $totalmemfrom_max)\n";
|
||||
|
||||
if ($now > $noolderthan and $last{total_mem_from} > $totalmemfrom_max) {
|
||||
$totalmemfrom_max = $last{total_mem_max};
|
||||
$totalmemto_atmax = $last{total_mem_to};
|
||||
# print "New larger at $now: $totalmemto_max\n";
|
||||
}
|
||||
$record = '';
|
||||
}
|
||||
$lastnow=$now;
|
||||
}
|
||||
close FILE;
|
||||
|
||||
$totalmemfrom_max=$totalmemto_atmax='U' if $totalmemfrom_max==0;
|
||||
|
||||
# Print the values to be represented in the munin graph
|
||||
print "tenured_max.value $last{total_mem_max}\n";
|
||||
print "tenured_start.value $last{total_mem_from}\n";
|
||||
print "tenured_end.value $last{total_mem_to}\n";
|
||||
|
||||
print "defnew_max.value $last{defnew_mem_max}\n";
|
||||
print "defnew_start.value $last{defnew_mem_from}\n";
|
||||
print "defnew_end.value $last{defnew_mem_to}\n";
|
||||
|
||||
print "totalheapmax.value $totalmemfrom_max\n";
|
||||
print "totalheaptomax.value $totalmemto_atmax\n";
|
130
plugins/jvm/jvm_sun_minorgcs
Executable file
130
plugins/jvm/jvm_sun_minorgcs
Executable file
|
@ -0,0 +1,130 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
# Sun JVM minor GC statistics. Parses a verbose log of minor GC
|
||||
# stats. Reads the log file and sums time in seconds spent on GC and
|
||||
# number of times it is performed. These numbers are saved in a state
|
||||
# file. The next time the plugin is run it only reads from the point
|
||||
# it quit the last time and increases the sums based on the lines
|
||||
# found in the last portion of the log. Thus we obtain counters. The
|
||||
# counters are reset when the log is rotated.
|
||||
|
||||
# The two numbers are graphed in _one_ graph. Where it has been used
|
||||
# until now these two numbers have been in the same order of
|
||||
# magnitude.
|
||||
|
||||
# Configuration (common with the other sun_jvm_* plugins in this family):
|
||||
# [jvm_sun_*]
|
||||
# env.logfile /var/foo/java.log (default: /var/log/munin/java.log)
|
||||
# env.graphtitle (default: "Sun Java")
|
||||
# env.grname (default: "sun-jvm". Used for state file-name)
|
||||
|
||||
# You need to configure your Sun JVM with these options:
|
||||
# -verbose:gc
|
||||
# -Xloggc:/var/log/app/jvm/gc.log
|
||||
# -XX:+PrintGCTimeStamps
|
||||
# -XX:+PrintGCDetails
|
||||
|
||||
# History:
|
||||
|
||||
# This plugin was developed by various people over some time - no logs
|
||||
# of this has been found. - In 2006 significant contributions was
|
||||
# financed by NRK (Norwegian Broadcasting Coproration) and performed
|
||||
# by Nicolai Langfeldt of Linpro AS in Oslo, Norway.
|
||||
|
||||
# $Id: $
|
||||
|
||||
use strict;
|
||||
|
||||
my $logfile = $ENV{logfile} || "/var/log/app/jvm/gc.log";
|
||||
my $grtitle = $ENV{graphtitle} || 'Sun Java';
|
||||
my $grname = $ENV{graphtitle} || 'sun-jvm';
|
||||
|
||||
my $statefile = "/var/lib/munin/plugin-state/plugin-java_sun_${grname}_minorgcs.state";
|
||||
my $pos = 0;
|
||||
my $count = 0;
|
||||
my $seconds = 0;
|
||||
my $startsize;
|
||||
my $timespent;
|
||||
my $totaltimespent=0;
|
||||
|
||||
if ( $ARGV[0] and $ARGV[0] eq "config" ) {
|
||||
print "graph_title $grtitle minor GCs pr minute\n";
|
||||
print "graph_args --base 1000 -l 0 --rigid\n";
|
||||
print "graph_scale no\n";
|
||||
print "graph_category virtualization\n";
|
||||
print "graph_period minute\n";
|
||||
print "gcs.label Number of GCs\n";
|
||||
print "gcs.type DERIVE\n";
|
||||
print "gcs.min 0\n";
|
||||
print "time.label Seconds spent on GC\n";
|
||||
print "time.type DERIVE\n";
|
||||
print "time.min 0\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if (-l $statefile) {
|
||||
die("$statefile is a symbolic link, refusing to touch it.");
|
||||
}
|
||||
|
||||
if (! -f $logfile) {
|
||||
print "gcs.value U\n";
|
||||
print "time.value U\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if (-f "$statefile") {
|
||||
open (IN, "$statefile") or exit 4;
|
||||
($pos,$count,$timespent) = split(/:/,<IN>);
|
||||
close IN;
|
||||
}
|
||||
|
||||
$startsize = (stat $logfile)[7];
|
||||
|
||||
if ($startsize < $pos) {
|
||||
# Log rotated
|
||||
$pos = 0;
|
||||
}
|
||||
|
||||
($pos, $count, $timespent) = parseFile ($logfile, $pos, $count, $timespent);
|
||||
|
||||
print "gcs.value $count\n";
|
||||
print "time.value ",int($timespent),"\n";
|
||||
|
||||
open (OUT, ">$statefile") or die "Could not open $statefile for reading: $!\n";
|
||||
print OUT "$pos:$count:$timespent\n";
|
||||
close OUT;
|
||||
|
||||
sub parseFile {
|
||||
my ($fname, $start, $count, $timespent) = @_;
|
||||
my @secs;
|
||||
|
||||
open (LOGFILE, $fname) or die "Could not open $fname: $!\n";
|
||||
|
||||
# Stat filehandle after open - avoids race with logrotater or
|
||||
# restart or whatever.
|
||||
|
||||
my $stop = $startsize = (stat LOGFILE)[7];
|
||||
|
||||
if ($startsize < $start) {
|
||||
# Log rotated
|
||||
$start = 0;
|
||||
}
|
||||
|
||||
seek (LOGFILE, $start, 0) or
|
||||
die "Could not seek to $start in $fname: $!\n";
|
||||
|
||||
while (tell (LOGFILE) < $stop) {
|
||||
my $line =<LOGFILE>;
|
||||
chomp ($line);
|
||||
|
||||
# Log format: 35.037: [GC 35.038: [DefNew: 166209K->11364K(174080K), 0.2106410 secs] 175274K->26037K(1721472K), 0.2107680 secs]
|
||||
if ($line =~ /\[GC.+ (\d+\.\d+) secs\]/) {
|
||||
$count++;
|
||||
$timespent += $1;
|
||||
}
|
||||
}
|
||||
close(LOGFILE);
|
||||
return($stop,$count,$timespent);
|
||||
}
|
||||
|
||||
# vim:syntax=perl
|
92
plugins/jvm/jvm_sun_tenuredgcs
Executable file
92
plugins/jvm/jvm_sun_tenuredgcs
Executable file
|
@ -0,0 +1,92 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
# Sun JVM tenured GC statistics. Parses a verbose log of tenured GC
|
||||
# stats. Reads the entire log file and sums time in seconds spent on
|
||||
# GC and number of times it is performed. Thus we obtain counters.
|
||||
# The counters are reset when the log is rotated. (note: the minorgcs
|
||||
# plugin uses a state file, we did not make it a priority to use a
|
||||
# state file in this plugin...)
|
||||
|
||||
# The two numbers are graphed in _one_ graph. Where it has been used
|
||||
# until now these two numbers have been in the same order of
|
||||
# magnitude.
|
||||
|
||||
# Configuration (common with the other sun_jvm_* plugins in this family):
|
||||
# [jvm_sun_*]
|
||||
# env.logfile /var/foo/java.log (default: /var/log/munin/java.log)
|
||||
# env.graphtitle (default: "Sun Java")
|
||||
|
||||
# You need to configure your Sun JVM with these options:
|
||||
# -verbose:gc
|
||||
# -Xloggc:/var/log/app/jvm/gc.log
|
||||
# -XX:+PrintGCTimeStamps
|
||||
# -XX:+PrintGCDetails
|
||||
|
||||
# History:
|
||||
|
||||
# This plugin was developed by various people over some time - no logs
|
||||
# of this has been found. - In 2006 significant contributions was
|
||||
# financed by NRK (Norwegian Broadcasting Coproration) and performed
|
||||
# by Nicolai Langfeldt of Linpro AS in Oslo, Norway.
|
||||
|
||||
# $Id: $
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
# Full path to jvm log file
|
||||
my $logfile = $ENV{logfile} || "/var/log/app/jvm/gc.log";
|
||||
my $grtitle = $ENV{graphtitle} || 'Sun Java';
|
||||
|
||||
# Title that appears on munin graph
|
||||
my $title = "$grtitle tenured GCs pr second";
|
||||
|
||||
# Extended information that appears below munin graph
|
||||
my $info = "Amount is the number of Tenured GC pr. second.\nSeconds spent is the total time spent on those Tenured GCs.";
|
||||
|
||||
my $record = "";
|
||||
my %elements;
|
||||
|
||||
# Print config information to munin server
|
||||
if ( $ARGV[0] and $ARGV[0] eq "config" ) {
|
||||
print "graph_title $grtitle tenured GCs pr minute\n";
|
||||
print "graph_period minute\n";
|
||||
print "graph_category virtualization\n";
|
||||
print "graph_args --lower-limit 0\n";
|
||||
print "graph_info $info\n";
|
||||
print "activity.label Number of GCs\n";
|
||||
print "activity.type DERIVE\n";
|
||||
print "activity.min 0\n";
|
||||
print "time.label Seconds spent on GCs\n";
|
||||
print "time.type DERIVE\n";
|
||||
print "time.min 0\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
# Scan through the log file and keep the last instance of a
|
||||
# Tenured record in $record.
|
||||
open( FILE, "< $logfile" ) or die "Can't open $logfile : $!";
|
||||
my $counter = 0;
|
||||
my $record_time_spent;
|
||||
my $time_spent;
|
||||
while (<FILE>) {
|
||||
chomp;
|
||||
if (m/.+Tenured.+/) {
|
||||
$record = $_;
|
||||
} elsif (m/^:.+/) {
|
||||
$record .= $_;
|
||||
}
|
||||
if ( $record =~ m/(\d+)\..+Tenured.+(\d+\.\d+) secs\]/ ) {
|
||||
# print "Record: $record\n";
|
||||
$record_time_spent = $2;
|
||||
# print "Time spent: ",$record_time_spent,"\n";
|
||||
|
||||
$counter++;
|
||||
$time_spent += $record_time_spent;
|
||||
}
|
||||
$record = "";
|
||||
}
|
||||
close FILE;
|
||||
|
||||
print "activity.value $counter\n";
|
||||
print "time.value ",int($time_spent),"\n";
|
Loading…
Add table
Add a link
Reference in a new issue