-
Notifications
You must be signed in to change notification settings - Fork 45
/
phpfpm_processes
58 lines (40 loc) · 1.16 KB
/
phpfpm_processes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/sh
# -*- sh -*-
: <<=cut
=head1 NAME
phpfpm_average - Munin plugin to monitor the number of PHP5-FPM processes on the machine.
=head1 CONFIGURATION
You might need to specify connection parameters in the plugin
configuration to override the defaults. These are the defaults:
[phpfpm_*]
env.phpbin php-fpm
env.phppool www
=head1 PARAMETERS:
config (required)
autoconf (optional - used by munin-config)
=over
=head1 LICENSE
Copyright TJ Stein 2010 http://constantshift.com
=head1 MAGICK MARKERS
#%# family=manual
#%# capabilities=autoconf
=cut
PHP_BIN=${phpbin-"php-fpm"}
PHP_POOL=${phppool-"www"}
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title PHP-FPM Processes'
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel PHP-FPM Processes'
echo 'graph_category PHP'
echo 'graph_info This graph shows the number of PHP-FPM processes in the system.'
echo 'php_processes.label PHP-FPM Processes'
echo 'php_processes.draw LINE2'
echo 'php_processes.info The current number of PHP-FPM processes.'
exit 0
fi
echo -n "php_processes.value "
ps awwwux | grep "$PHP_BIN: pool $PHP_POOL" | grep -v grep | wc -l