root / plugins / php / php5-fpm_status @ 17f78427
Historique | Voir | Annoter | Télécharger (1,41 ko)
| 1 |
#!/bin/bash |
|---|---|
| 2 |
# |
| 3 |
# Plugin to monitor php5-fpm process manager, php5-fpm 5.3.3 is required |
| 4 |
# 20100726 21:15:39 radar AT aol DOT pl |
| 5 |
# modified by Daniel Caillibaud on 20110926 |
| 6 |
# |
| 7 |
# /etc/php5/fpm/php5-fpm.conf: |
| 8 |
# |
| 9 |
# pm.status_path = /fpm-status |
| 10 |
# |
| 11 |
# |
| 12 |
# Magic markers (optional - only used by munin-config and some installation scripts): |
| 13 |
#%# family=contrib |
| 14 |
|
| 15 |
vhost=${0#/etc/munin/plugins/php5-fpm_status_}
|
| 16 |
url="http://$vhost/fpm-status" |
| 17 |
statusfile="/tmp/fpm-status_$vhost.txt" |
| 18 |
|
| 19 |
wget $url -O $statusfile 2>/dev/null |
| 20 |
|
| 21 |
if [ "$1" = "config" ]; then |
| 22 |
pool=$(awk '/pool/{print $2}' $statusfile)
|
| 23 |
echo "graph_title php5-fpm status $pool" |
| 24 |
echo "graph_args --base 1000 -l 0" |
| 25 |
echo "graph_vlabel Processes" |
| 26 |
echo "graph_scale yes" |
| 27 |
echo "graph_category processes" |
| 28 |
echo "graph_info This graph shows the php5-fpm process manager status from pool: $pool" |
| 29 |
echo "active.label Active processes" |
| 30 |
echo "active.type GAUGE" |
| 31 |
echo "active.draw AREA" |
| 32 |
echo "active.info The number of active processes" |
| 33 |
echo "idle.label Idle processes" |
| 34 |
echo "idle.type GAUGE" |
| 35 |
echo "idle.draw STACK" |
| 36 |
echo "idle.info The number of idle processes" |
| 37 |
echo "total.label Total processes" |
| 38 |
echo "total.type GAUGE" |
| 39 |
echo "total.draw LINE2" |
| 40 |
echo "total.info The number of idle + active processes" |
| 41 |
exit 0 |
| 42 |
else |
| 43 |
awk ' |
| 44 |
/^idle/ {print "idle.value " $3}
|
| 45 |
/^active/{print "active.value " $3}
|
| 46 |
/^total/ {print "total.value " $3}
|
| 47 |
' < $statusfile |
| 48 |
fi |
| 49 |
|
| 50 |
rm -f $statusfile |
| 51 |
|
