mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
Plugins apache_tmemory and apache_servers: multiple changes
* use base SI units for memory consumption (breaks graph values compared to older version) * fix quoting for regular expressions * use common defaults for configuration settings
This commit is contained in:
parent
16ab1d10e1
commit
dbaeb0253c
3 changed files with 39 additions and 51 deletions
|
@ -5,13 +5,13 @@
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
apache_servers -Indicate the number of apache servers running (child process)
|
apache_servers - Indicate the number of apache servers running (child process)
|
||||||
|
|
||||||
=head1 CONFIGURATION
|
=head1 CONFIGURATION
|
||||||
|
|
||||||
[apache_*]
|
[apache_*]
|
||||||
env.apuser user_runnin_apache
|
env.apuser user_running_apache (default: "www-data")
|
||||||
env.binname apache_binary_name
|
env.binname apache_binary_name (default: "apache2")
|
||||||
|
|
||||||
=head1 AUTHOR
|
=head1 AUTHOR
|
||||||
|
|
||||||
|
@ -28,10 +28,10 @@ GPLv2
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
. $MUNIN_LIBDIR/plugins/plugin.sh
|
. "$MUNIN_LIBDIR/plugins/plugin.sh"
|
||||||
|
|
||||||
USR=$apuser
|
USR=${apuser:-www-data}
|
||||||
PROCS=$binname
|
PROCS=${binname:-apache2}
|
||||||
|
|
||||||
if [ "$1" = "autoconf" ]; then
|
if [ "$1" = "autoconf" ]; then
|
||||||
echo yes
|
echo yes
|
||||||
|
@ -40,25 +40,20 @@ fi
|
||||||
|
|
||||||
if [ "$1" = "config" ]; then
|
if [ "$1" = "config" ]; then
|
||||||
|
|
||||||
echo 'graph_title Number of apache servers running.'
|
echo 'graph_title Number of apache servers running'
|
||||||
echo 'graph_args --base 1000 -l 0 '
|
echo 'graph_args --base 1000 -l 0 '
|
||||||
echo 'graph_vlabel servers'
|
echo 'graph_vlabel servers'
|
||||||
echo 'graph_scale no'
|
echo 'graph_scale no'
|
||||||
echo 'graph_category webserver'
|
echo 'graph_category webserver'
|
||||||
echo 'graph_info Indicate the number of apache servers running (child process).'
|
echo 'graph_info Indicate the number of apache servers running (child process).'
|
||||||
|
|
||||||
|
echo "servers.label servers"
|
||||||
|
echo "servers.type GAUGE"
|
||||||
|
echo "servers.min 0"
|
||||||
|
echo "servers.info Number of apache processes"
|
||||||
|
|
||||||
|
exit 0
|
||||||
echo "servers.label servers"
|
|
||||||
echo "servers.type GAUGE"
|
|
||||||
echo "servers.min 0"
|
|
||||||
echo "servers.info I/O on nfs"
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
VAL1=`ps auxf | grep ${PROCS} | grep ^${USR} | grep -v grep | wc -l`
|
process_count=$(ps auxf | grep -- "$PROCS" | grep "^$USR" | grep -v grep | wc -l)
|
||||||
|
echo "servers.value $process_count"
|
||||||
echo "servers.value $VAL1"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,13 @@
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
apache_tmemmory -Indicate the total memory used by apache
|
apache_tmemmory - Indicate the total memory used by apache
|
||||||
|
|
||||||
=head1 CONFIGURATION
|
=head1 CONFIGURATION
|
||||||
|
|
||||||
[apache_*]
|
[apache_*]
|
||||||
env.binname apache_binary_name
|
env.apuser user_running_apache (default: "www-data")
|
||||||
|
env.binname apache_binary_name (default: "apache2")
|
||||||
|
|
||||||
=head1 AUTHOR
|
=head1 AUTHOR
|
||||||
|
|
||||||
|
@ -27,38 +28,32 @@ GPLv2
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
. $MUNIN_LIBDIR/plugins/plugin.sh
|
. "$MUNIN_LIBDIR/plugins/plugin.sh"
|
||||||
|
|
||||||
|
USR=${apuser:-www-data}
|
||||||
USR=$apuser
|
PROCS=${binname:-apache2}
|
||||||
PROCS=$binname
|
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = "autoconf" ]; then
|
if [ "$1" = "autoconf" ]; then
|
||||||
echo yes
|
echo yes
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "config" ]; then
|
if [ "$1" = "config" ]; then
|
||||||
|
|
||||||
echo 'graph_title Total memory used by apache'
|
echo 'graph_title Total memory used by apache'
|
||||||
echo 'graph_args --base 1000 -l 0 '
|
echo 'graph_args --base 1024 -l 0 '
|
||||||
echo 'graph_vlabel Mb'
|
echo 'graph_vlabel bytes'
|
||||||
echo 'graph_scale no'
|
echo 'graph_scale no'
|
||||||
echo 'graph_category webserver'
|
echo 'graph_category webserver'
|
||||||
echo 'graph_info Indicate the total memory used by apache.'
|
echo 'graph_info Indicate the total memory used by apache.'
|
||||||
|
|
||||||
echo "servers.label servers"
|
echo "servers.label servers"
|
||||||
echo "servers.type GAUGE"
|
echo "servers.type GAUGE"
|
||||||
echo "servers.min 0"
|
echo "servers.min 0"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
VAL1=`ps auxf | grep ${PROCS} | grep -v grep | awk '{s+=$6} END {print s}'`
|
total_memory=$(ps auxf | grep -- "$PROCS" | grep "^$USR" | grep -v grep | awk '{s+=$6} END {print s * 1024}')
|
||||||
|
echo "servers.value $total_memory"
|
||||||
VAL2=`expr $VAL1 / 1024`
|
|
||||||
|
|
||||||
echo "servers.value $VAL2"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,7 @@ plugins/amule/amule_shares
|
||||||
plugins/amule/amule_transfers
|
plugins/amule/amule_transfers
|
||||||
plugins/amule/amule_uptime
|
plugins/amule/amule_uptime
|
||||||
plugins/apache/apache_cache_disk_count
|
plugins/apache/apache_cache_disk_count
|
||||||
plugins/apache/apache_servers
|
|
||||||
plugins/apache/apache_threads
|
plugins/apache/apache_threads
|
||||||
plugins/apache/apache_tmemmory
|
|
||||||
plugins/apache/apache_users
|
plugins/apache/apache_users
|
||||||
plugins/apache/page_load
|
plugins/apache/page_load
|
||||||
plugins/apache/qpid_bytedepth
|
plugins/apache/qpid_bytedepth
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue