check_phpfpm_status: Update to 0.11

This commit is contained in:
Jan Wagner 2016-06-12 15:58:36 +02:00
parent 7eb6cc05d9
commit f7e67c0f74
2 changed files with 18 additions and 11 deletions

View file

@ -1,6 +1,6 @@
#!/usr/bin/perl -w #!/usr/bin/perl -w
# check_phpfpm_status.pl # check_phpfpm_status.pl
# Version : 0.10 # Version : 0.11
# Author : regis.leroy at makina-corpus.com # Author : regis.leroy at makina-corpus.com
# based on previous apache status work by Dennis D. Spreen (dennis at spreendigital.de) # based on previous apache status work by Dennis D. Spreen (dennis at spreendigital.de)
# Based on check_apachestatus.pl v1.4 by # Based on check_apachestatus.pl v1.4 by
@ -23,6 +23,8 @@ use Digest::MD5 qw(md5 md5_hex);
# Nagios specific # Nagios specific
# Update Nagios Plugin path according to your platform/installation # Update Nagios Plugin path according to your platform/installation
use lib "/usr/local/nagios/libexec"; use lib "/usr/local/nagios/libexec";
use lib "/usr/local/icinga/libexec";
use lib "/usr/lib/nagios/plugins";
use utils qw($TIMEOUT); use utils qw($TIMEOUT);
# Globals # Globals
@ -49,6 +51,7 @@ my $o_crit_thresold=undef; # critical thresolds entry
my $o_debug= undef; # debug mode my $o_debug= undef; # debug mode
my $o_servername= undef; # ServerName (host header in http request) my $o_servername= undef; # ServerName (host header in http request)
my $o_https= undef; # SSL (HTTPS) mode my $o_https= undef; # SSL (HTTPS) mode
my $o_verify_hostname= 0; # SSL Hostname verification, False by default
my $TempPath = '/tmp/'; # temp path my $TempPath = '/tmp/'; # temp path
my $MaxUptimeDif = 60*30; # Maximum uptime difference (seconds), default 30 minutes my $MaxUptimeDif = 60*30; # Maximum uptime difference (seconds), default 30 minutes
@ -122,6 +125,8 @@ sub help {
-1 for no CRITICAL -1 for no CRITICAL
-V, --version -V, --version
prints version number prints version number
-x, --verifyhostname
verify hostname from ssl cert, set it to 0 to ignore bad hostname from cert
Note : Note :
3 items can be managed on this check, this is why -w and -c parameters are using 3 values thresolds 3 items can be managed on this check, this is why -w and -c parameters are using 3 values thresolds
@ -165,9 +170,10 @@ sub check_options {
'r:s' => \$o_realm, 'realm:s' => \$o_realm, 'r:s' => \$o_realm, 'realm:s' => \$o_realm,
'p:i' => \$o_port, 'port:i' => \$o_port, 'p:i' => \$o_port, 'port:i' => \$o_port,
'V' => \$o_version, 'version' => \$o_version, 'V' => \$o_version, 'version' => \$o_version,
'w=s' => \$o_warn_thresold,'warn=s' => \$o_warn_thresold, 'w=s' => \$o_warn_thresold, 'warn=s' => \$o_warn_thresold,
'c=s' => \$o_crit_thresold,'critical=s' => \$o_crit_thresold, 'c=s' => \$o_crit_thresold, 'critical=s' => \$o_crit_thresold,
't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout,
'x:i' => \$o_verify_hostname, 'verifyhostname:i' => \$o_verify_hostname,
); );
if (defined ($o_help)) { if (defined ($o_help)) {
@ -215,7 +221,8 @@ check_options();
my $override_ip = $o_host; my $override_ip = $o_host;
my $ua = LWP::UserAgent->new( my $ua = LWP::UserAgent->new(
protocols_allowed => ['http', 'https'], protocols_allowed => ['http', 'https'],
timeout => $o_timeout timeout => $o_timeout,
ssl_opts => { verify_hostname => $o_verify_hostname }
); );
# we need to enforce the HTTP request is made on the Nagios Host IP and # we need to enforce the HTTP request is made on the Nagios Host IP and
# not on the DNS related IP for that domain # not on the DNS related IP for that domain
@ -282,7 +289,7 @@ my $PerfData = '';
my $webcontent = undef; my $webcontent = undef;
if ($response->is_success) { if ($response->is_success) {
$webcontent=$response->decoded_content; $webcontent=$response->decoded_content( charset_strict=>1, raise_error => 1, alt_charset => 'none' );
if (defined ($o_debug)) { if (defined ($o_debug)) {
print "\nDEBUG: HTTP response:"; print "\nDEBUG: HTTP response:";
print $response->status_line; print $response->status_line;
@ -432,8 +439,8 @@ if ($response->is_success) {
,$MaxActiveProcesses,$MaxChildrenReachedNew ,$MaxActiveProcesses,$MaxChildrenReachedNew
,$ReqPerSec,$ListenQueue,$ListenQueueLen,$MaxListenQueueNew); ,$ReqPerSec,$ListenQueue,$ListenQueueLen,$MaxListenQueueNew);
$PerfData = sprintf ("Idle=%d;Busy=%d;MaxProcesses=%d;MaxProcessesReach=%d;" $PerfData = sprintf ("Idle=%d Busy=%d MaxProcesses=%d MaxProcessesReach=%d "
."Queue=%d;MaxQueueReach=%d;QueueLen=%d;ReqPerSec=%f" ."Queue=%d MaxQueueReach=%d QueueLen=%d ReqPerSec=%f"
,($IdleProcesses),($ActiveProcesses),($MaxActiveProcesses) ,($IdleProcesses),($ActiveProcesses),($MaxActiveProcesses)
,($MaxChildrenReachedNew),($ListenQueue),($MaxListenQueueNew) ,($MaxChildrenReachedNew),($ListenQueue),($MaxListenQueueNew)
,($ListenQueueLen),$ReqPerSec); ,($ListenQueueLen),$ReqPerSec);

View file

@ -1,6 +1,6 @@
Homepage: https://raw.github.com/regilero/check_phpfpm_status/master/check_phpfpm_status.pl Homepage: https://raw.github.com/regilero/check_phpfpm_status/master/check_phpfpm_status.pl
Watch: https://raw.github.com/regilero/check_phpfpm_status/master/check_phpfpm_status.pl Version\ :\ ([0-9.]+) Watch: https://raw.github.com/regilero/check_phpfpm_status/master/check_phpfpm_status.pl Version\ :\ ([0-9.]+)
Recommends: libwww-perl, monitoring-plugins-common | nagios-plugins-common Recommends: libwww-perl, monitoring-plugins-common | nagios-plugins-common
Version: 0.10 Version: 0.11
Uploaders: Jan Wagner <waja@cyconet.org> Uploaders: Jan Wagner <waja@cyconet.org>
Description: plugin to check the fpm-status page report from php-fpm Description: plugin to check the fpm-status page report from php-fpm