2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Update plugins/other/php-fastcgi

This commit is contained in:
Andrey Dudin 2012-01-20 15:47:10 +04:00
parent d5de773e4b
commit 0b18f278ab

View File

@ -6,9 +6,9 @@
# php_fcgi --- Munin plugin for determining the memory usage and
# number of PHP FastCGI processes.
# Copyright (C) 2010 António P. P. Almeida <appa@perusio.net>
# Copyright (C) 2010 Antonio P. P. Almeida <appa@perusio.net>
# Author: António P. P. Almeida <appa@perusio.net>
# Author: Antonio P. P. Almeida <appa@perusio.net>
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
@ -51,13 +51,21 @@ Any host running PHP FastCGI.
1.0
=head1 CONFIGURATION
This shows the default configuration of this plugin. You can override
the process name of php-fcgi.
[php-fcgi]
env.pname php-cgi
=head1 BUGS
None known
=head1 AUTHOR
António Almeida <appa@perusio.net>
Antonio Almeida <appa@perusio.net>
=head1 REPOSITORY
@ -72,6 +80,11 @@ MIT
## Support for rounding functions.
use POSIX;
## Environment defined variables.
## The default process name if different set it in the environment.
my $PROCESS_NAME = exists $ENV{'pname'} ? $ENV{'pname'} : "php-cgi";
## Munin config method.
if (exists $ARGV[0] and $ARGV[0] eq "config") {
@ -86,7 +99,7 @@ if (exists $ARGV[0] and $ARGV[0] eq "config") {
exit 0;
} else {
my ($pp, $pm) = eval(`ps u -p \$(pidof php-cgi) | awk 'NR > 1 {pm += \$5} END {print "("NR-1","pm/1024")"}'`);
my ($pp, $pm) = eval(`ps u -p \$(pidof $PROCESS_NAME) | awk 'NR > 1 {pm += \$5} END {print "("NR-1","pm/1024")"}'`);
printf("php_cgi_ram.value %d\n", ceil($pm));
print "php_cgi_processes.value $pp\n";
}
}