From f7e67c0f74284ed2638e7dbf885153213224d12a Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 12 Jun 2016 15:58:36 +0200 Subject: [PATCH] check_phpfpm_status: Update to 0.11 --- check_phpfpm_status/check_phpfpm_status | 27 ++++++++++++++++--------- check_phpfpm_status/control | 2 +- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/check_phpfpm_status/check_phpfpm_status b/check_phpfpm_status/check_phpfpm_status index 678170b..779c673 100644 --- a/check_phpfpm_status/check_phpfpm_status +++ b/check_phpfpm_status/check_phpfpm_status @@ -1,6 +1,6 @@ #!/usr/bin/perl -w # check_phpfpm_status.pl -# Version : 0.10 +# Version : 0.11 # Author : regis.leroy at makina-corpus.com # based on previous apache status work by Dennis D. Spreen (dennis at spreendigital.de) # Based on check_apachestatus.pl v1.4 by @@ -23,6 +23,8 @@ use Digest::MD5 qw(md5 md5_hex); # Nagios specific # Update Nagios Plugin path according to your platform/installation use lib "/usr/local/nagios/libexec"; +use lib "/usr/local/icinga/libexec"; +use lib "/usr/lib/nagios/plugins"; use utils qw($TIMEOUT); # Globals @@ -49,6 +51,7 @@ my $o_crit_thresold=undef; # critical thresolds entry my $o_debug= undef; # debug mode my $o_servername= undef; # ServerName (host header in http request) my $o_https= undef; # SSL (HTTPS) mode +my $o_verify_hostname= 0; # SSL Hostname verification, False by default my $TempPath = '/tmp/'; # temp path my $MaxUptimeDif = 60*30; # Maximum uptime difference (seconds), default 30 minutes @@ -122,6 +125,8 @@ sub help { -1 for no CRITICAL -V, --version prints version number +-x, --verifyhostname + verify hostname from ssl cert, set it to 0 to ignore bad hostname from cert Note : 3 items can be managed on this check, this is why -w and -c parameters are using 3 values thresolds @@ -163,11 +168,12 @@ sub check_options { 'U:s' => \$o_user, 'user:s' => \$o_user, 'P:s' => \$o_pass, 'pass:s' => \$o_pass, 'r:s' => \$o_realm, 'realm:s' => \$o_realm, - 'p:i' => \$o_port, 'port:i' => \$o_port, - 'V' => \$o_version, 'version' => \$o_version, - 'w=s' => \$o_warn_thresold,'warn=s' => \$o_warn_thresold, - 'c=s' => \$o_crit_thresold,'critical=s' => \$o_crit_thresold, - 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, + 'p:i' => \$o_port, 'port:i' => \$o_port, + 'V' => \$o_version, 'version' => \$o_version, + 'w=s' => \$o_warn_thresold, 'warn=s' => \$o_warn_thresold, + 'c=s' => \$o_crit_thresold, 'critical=s' => \$o_crit_thresold, + 't:i' => \$o_timeout, 'timeout:i' => \$o_timeout, + 'x:i' => \$o_verify_hostname, 'verifyhostname:i' => \$o_verify_hostname, ); if (defined ($o_help)) { @@ -215,7 +221,8 @@ check_options(); my $override_ip = $o_host; my $ua = LWP::UserAgent->new( 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 # not on the DNS related IP for that domain @@ -282,7 +289,7 @@ my $PerfData = ''; my $webcontent = undef; 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)) { print "\nDEBUG: HTTP response:"; print $response->status_line; @@ -432,8 +439,8 @@ if ($response->is_success) { ,$MaxActiveProcesses,$MaxChildrenReachedNew ,$ReqPerSec,$ListenQueue,$ListenQueueLen,$MaxListenQueueNew); - $PerfData = sprintf ("Idle=%d;Busy=%d;MaxProcesses=%d;MaxProcessesReach=%d;" - ."Queue=%d;MaxQueueReach=%d;QueueLen=%d;ReqPerSec=%f" + $PerfData = sprintf ("Idle=%d Busy=%d MaxProcesses=%d MaxProcessesReach=%d " + ."Queue=%d MaxQueueReach=%d QueueLen=%d ReqPerSec=%f" ,($IdleProcesses),($ActiveProcesses),($MaxActiveProcesses) ,($MaxChildrenReachedNew),($ListenQueue),($MaxListenQueueNew) ,($ListenQueueLen),$ReqPerSec); diff --git a/check_phpfpm_status/control b/check_phpfpm_status/control index 33dc4b3..6d69bcb 100644 --- a/check_phpfpm_status/control +++ b/check_phpfpm_status/control @@ -1,6 +1,6 @@ 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.]+) Recommends: libwww-perl, monitoring-plugins-common | nagios-plugins-common -Version: 0.10 +Version: 0.11 Uploaders: Jan Wagner Description: plugin to check the fpm-status page report from php-fpm