root / plugins / apache / apache_servers @ dbaeb025
Historique | Voir | Annoter | Télécharger (1,11 ko)
| 1 |
#!/bin/sh |
|---|---|
| 2 |
# -*- sh -*- |
| 3 |
|
| 4 |
: << =cut |
| 5 |
|
| 6 |
=head1 NAME |
| 7 |
|
| 8 |
apache_servers - Indicate the number of apache servers running (child process) |
| 9 |
|
| 10 |
=head1 CONFIGURATION |
| 11 |
|
| 12 |
[apache_*] |
| 13 |
env.apuser user_running_apache (default: "www-data") |
| 14 |
env.binname apache_binary_name (default: "apache2") |
| 15 |
|
| 16 |
=head1 AUTHOR |
| 17 |
|
| 18 |
Ricardo Fraile <rfrail3@yahoo.es> |
| 19 |
|
| 20 |
=head1 LICENSE |
| 21 |
|
| 22 |
GPLv2 |
| 23 |
|
| 24 |
=head1 MAGICK MARKERS |
| 25 |
|
| 26 |
#%# family=auto |
| 27 |
#%# capabilities=autoconf |
| 28 |
|
| 29 |
=cut |
| 30 |
|
| 31 |
. "$MUNIN_LIBDIR/plugins/plugin.sh" |
| 32 |
|
| 33 |
USR=${apuser:-www-data}
|
| 34 |
PROCS=${binname:-apache2}
|
| 35 |
|
| 36 |
if [ "$1" = "autoconf" ]; then |
| 37 |
echo yes |
| 38 |
exit 0 |
| 39 |
fi |
| 40 |
|
| 41 |
if [ "$1" = "config" ]; then |
| 42 |
|
| 43 |
echo 'graph_title Number of apache servers running' |
| 44 |
echo 'graph_args --base 1000 -l 0 ' |
| 45 |
echo 'graph_vlabel servers' |
| 46 |
echo 'graph_scale no' |
| 47 |
echo 'graph_category webserver' |
| 48 |
echo 'graph_info Indicate the number of apache servers running (child process).' |
| 49 |
|
| 50 |
echo "servers.label servers" |
| 51 |
echo "servers.type GAUGE" |
| 52 |
echo "servers.min 0" |
| 53 |
echo "servers.info Number of apache processes" |
| 54 |
|
| 55 |
exit 0 |
| 56 |
fi |
| 57 |
|
| 58 |
process_count=$(ps auxf | grep -- "$PROCS" | grep "^$USR" | grep -v grep | wc -l) |
| 59 |
echo "servers.value $process_count" |
