- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
#!/usr/bin/perl
# -*- perl -*-
my $PHP_BIN = exists $ENV{'phpbin'} ? $ENV{'phpbin'} : "php-fpm";
my $PHP_POOL = exists $ENV{'phppool'} ? $ENV{'phppool'} : "www";
if ( defined $ARGV[0] and $ARGV[0] eq "autoconf" )
{
print "yes\n";
exit 0;
}
if ( exists $ARGV[0] and $ARGV[0] eq "config" ) {
print "graph_title PHP-FPM Memory Usage\n";
print "graph_vlabel RAM\n";
print "graph_category PHP\n";
print "ram.label ram\n";
print "graph_args --base 1024\n";
} else {
my $i = Integer;
@cmd = `ps auwx | grep "$PHP_BIN: pool $PHP_POOL" | grep -v grep | grep -v phpfpm_memory`;
foreach (@cmd) {
@return = split(/ +/, $_);
$i += @return[5]*1024;
}
print "ram.value ".$i."\n";
}
Комментарии (0) RSS
Добавить комментарий