Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / php / php-cgi @ 361a5316

Historique | Voir | Annoter | Télécharger (1,26 ko)

1
#!/bin/sh
2
# -*- sh -*-
3
#
4
# Plugin to monitor the number of PHP processes on the machine.
5
#
6
# Copyright Khalid Baheyeldin 2009 http://2bits.com
7
#
8
# Parameters:
9
#
10
# config (required)
11
# autoconf (optional - used by munin-config)
12
#
13
# Magick markers (optional - used by munin-config and som installation
14
# scripts):
15
#%# family=manual
16
#%# capabilities=autoconf
17

    
18
if [ "$1" = "autoconf" ]; then
19
echo yes
20
exit 0
21
fi
22

    
23
if [ "$1" = "config" ]; then
24
echo 'graph_title Number of php-cgi processes'
25
echo 'graph_args --base 1000 -l 0 '
26
echo 'graph_vlabel number of php-cgi processes'
27
echo 'graph_category apache'
28
echo 'graph_info This graph shows the number of php-cgi processes in the system.'
29
echo 'php_processes.label php-cgi'
30
echo 'php_processes.draw LINE2'
31
echo 'php_processes.info The current number of php-cgi processes.'
32
exit 0
33
fi
34

    
35
CMD_GREP=`which grep`
36
if [ ! -e ${CMD_GREP} ]; then
37
  echo "Command grep (${CMD_GREP}) not found!"
38
  exit 1
39
fi
40
CMD_SED=`which sed`
41
if [ ! -e ${CMD_SED} ]; then
42
  echo "Command sed (${CMD_SED}) not found!"
43
  exit 1
44
fi
45
CMD_WC=`which wc`
46
if [ ! -e ${CMD_WC} ]; then
47
  echo "Command wc (${CMD_WC}) not found!"
48
  exit 1
49
fi
50

    
51
echo -n "php_processes.value "
52
/bin/ps ax | ${CMD_GREP} -i php-cgi | ${CMD_GREP} -v grep | ${CMD_WC} -l | ${CMD_SED} 's/\t +//' | ${CMD_SED} 's/ *//'