Révision 0b18f278
Update plugins/other/php-fastcgi
| plugins/other/php-fastcgi | ||
|---|---|---|
| 6 | 6 |
# php_fcgi --- Munin plugin for determining the memory usage and |
| 7 | 7 |
# number of PHP FastCGI processes. |
| 8 | 8 |
|
| 9 |
# Copyright (C) 2010 António P. P. Almeida <appa@perusio.net>
|
|
| 9 |
# Copyright (C) 2010 Antonio P. P. Almeida <appa@perusio.net>
|
|
| 10 | 10 |
|
| 11 |
# Author: António P. P. Almeida <appa@perusio.net>
|
|
| 11 |
# Author: Antonio P. P. Almeida <appa@perusio.net>
|
|
| 12 | 12 |
|
| 13 | 13 |
# Permission is hereby granted, free of charge, to any person obtaining a |
| 14 | 14 |
# copy of this software and associated documentation files (the "Software"), |
| ... | ... | |
| 51 | 51 |
|
| 52 | 52 |
1.0 |
| 53 | 53 |
|
| 54 |
=head1 CONFIGURATION |
|
| 55 |
|
|
| 56 |
This shows the default configuration of this plugin. You can override |
|
| 57 |
the process name of php-fcgi. |
|
| 58 |
|
|
| 59 |
[php-fcgi] |
|
| 60 |
env.pname php-cgi |
|
| 61 |
|
|
| 54 | 62 |
=head1 BUGS |
| 55 | 63 |
|
| 56 | 64 |
None known |
| 57 | 65 |
|
| 58 | 66 |
=head1 AUTHOR |
| 59 | 67 |
|
| 60 |
António Almeida <appa@perusio.net>
|
|
| 68 |
Antonio Almeida <appa@perusio.net>
|
|
| 61 | 69 |
|
| 62 | 70 |
=head1 REPOSITORY |
| 63 | 71 |
|
| ... | ... | |
| 72 | 80 |
## Support for rounding functions. |
| 73 | 81 |
use POSIX; |
| 74 | 82 |
|
| 83 |
## Environment defined variables. |
|
| 84 |
## The default process name if different set it in the environment. |
|
| 85 |
|
|
| 86 |
my $PROCESS_NAME = exists $ENV{'pname'} ? $ENV{'pname'} : "php-cgi";
|
|
| 87 |
|
|
| 75 | 88 |
## Munin config method. |
| 76 | 89 |
if (exists $ARGV[0] and $ARGV[0] eq "config") {
|
| 77 | 90 |
|
| ... | ... | |
| 86 | 99 |
|
| 87 | 100 |
exit 0; |
| 88 | 101 |
} else {
|
| 89 |
my ($pp, $pm) = eval(`ps u -p \$(pidof php-cgi) | awk 'NR > 1 {pm += \$5} END {print "("NR-1","pm/1024")"}'`);
|
|
| 102 |
my ($pp, $pm) = eval(`ps u -p \$(pidof $PROCESS_NAME) | awk 'NR > 1 {pm += \$5} END {print "("NR-1","pm/1024")"}'`);
|
|
| 90 | 103 |
printf("php_cgi_ram.value %d\n", ceil($pm));
|
| 91 | 104 |
print "php_cgi_processes.value $pp\n"; |
| 92 |
} |
|
| 105 |
} |
|
Formats disponibles : Unified diff