root / plugins / apache / apache_servers @ dbaeb025
Historique | Voir | Annoter | Télécharger (1,11 ko)
| 1 | 4771fd2b | rfrail3 | #!/bin/sh |
|---|---|---|---|
| 2 | # -*- sh -*- |
||
| 3 | |||
| 4 | : << =cut |
||
| 5 | |||
| 6 | =head1 NAME |
||
| 7 | |||
| 8 | dbaeb025 | Lars Kruse | apache_servers - Indicate the number of apache servers running (child process) |
| 9 | 4771fd2b | rfrail3 | |
| 10 | =head1 CONFIGURATION |
||
| 11 | |||
| 12 | [apache_*] |
||
| 13 | dbaeb025 | Lars Kruse | env.apuser user_running_apache (default: "www-data") |
| 14 | env.binname apache_binary_name (default: "apache2") |
||
| 15 | 4771fd2b | rfrail3 | |
| 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 | dbaeb025 | Lars Kruse | . "$MUNIN_LIBDIR/plugins/plugin.sh" |
| 32 | 4771fd2b | rfrail3 | |
| 33 | dbaeb025 | Lars Kruse | USR=${apuser:-www-data}
|
| 34 | PROCS=${binname:-apache2}
|
||
| 35 | 4771fd2b | rfrail3 | |
| 36 | if [ "$1" = "autoconf" ]; then |
||
| 37 | 17f78427 | Lars Kruse | echo yes |
| 38 | 4771fd2b | rfrail3 | exit 0 |
| 39 | fi |
||
| 40 | |||
| 41 | if [ "$1" = "config" ]; then |
||
| 42 | |||
| 43 | dbaeb025 | Lars Kruse | 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 | 4771fd2b | rfrail3 | |
| 50 | dbaeb025 | Lars Kruse | echo "servers.label servers" |
| 51 | echo "servers.type GAUGE" |
||
| 52 | echo "servers.min 0" |
||
| 53 | echo "servers.info Number of apache processes" |
||
| 54 | 4771fd2b | rfrail3 | |
| 55 | dbaeb025 | Lars Kruse | exit 0 |
| 56 | 4771fd2b | rfrail3 | fi |
| 57 | |||
| 58 | dbaeb025 | Lars Kruse | process_count=$(ps auxf | grep -- "$PROCS" | grep "^$USR" | grep -v grep | wc -l) |
| 59 | echo "servers.value $process_count" |
