[Pkg-nagios-changes] [pkg-nagios-plugins-contrib] 01/05: check_whois: Update to latest version 1.21

Jan Wagner waja at moszumanska.debian.org
Sat Apr 16 15:34:57 UTC 2016


This is an automated email from the git hooks/post-receive script.

waja pushed a commit to branch master
in repository pkg-nagios-plugins-contrib.

commit 1d05b14267cd5120a28f6a6485165f8889974b07
Author: Jan Wagner <waja at cyconet.org>
Date:   Sat Apr 16 15:48:27 2016 +0200

    check_whois: Update to latest version 1.21
---
 check_whois/check_whois | 16 ++++++++++++++--
 check_whois/control     |  2 +-
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/check_whois/check_whois b/check_whois/check_whois
index 0190364..c103f88 100644
--- a/check_whois/check_whois
+++ b/check_whois/check_whois
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 # nagios: -epn
 
-# $Id: check_whois,v 1.19 2015/10/06 14:22:02 wessels Exp $
+# $Id: check_whois,v 1.21 2015/10/12 16:44:13 wessels Exp $
 #
 # check_whois
 #
@@ -80,6 +80,7 @@ my $string_found = 0;
 my $name = shift or die usage();
 $name =~ s/^zone\.//;
 my $whoiscmd = findwhois();
+print STDERR "$0 version ". '$Id: check_whois,v 1.21 2015/10/12 16:44:13 wessels Exp $'. "\n" if $opts{d};
 print STDERR "Whois command = $whoiscmd\n" if $opts{d};
 grok($whoiscmd, $name);
 exit 0;
@@ -128,7 +129,7 @@ sub grok {
         print STDERR "checking $name\n" if $opts{d};
         while (<CMD>) {
                 tr/A-Z/a-z/;
-		print if $opts{d};
+		print STDERR "# $_" if $opts{d};
                 $registrar = $1 if (/registrar:\s*(\S.*)/);
                 if (!defined($registrar)) {
                         $registrar = $1 if (/registrar id:\s*(\S.*)/);
@@ -170,10 +171,17 @@ sub grok {
 		}
         }
         close(CMD);
+	printf STDERR "Line %d: expires='%s'\n", __LINE__, $expires if $opts{d};
+
+	# Remove any leading/trailing whitespace
+	#
+	$expires =~ s/^\s+// if defined $expires;
+	$expires =~ s/\s+$// if defined $expires;
 
 	# Remove any trailing dot from the expire time
 	#
 	$expires =~ s/\.$// if defined $expires;
+	printf STDERR "Line %d: expires='%s'\n", __LINE__, $expires if $opts{d};
 
 	if (defined $registrar) {
             $registrar = 'gandi' if ($registrar eq 'r42-lror');
@@ -208,6 +216,7 @@ sub grok {
 			$expires = join('-', $p[2], $p[1], $p[0]);
 		}
 	}
+	printf STDERR "Line %d: expires='%s'\n", __LINE__, $expires if $opts{d};
 
 	# Network Solutions has a bug in their whois output, returning dates like this:
 	# Registrar Registration Expiration Date: Fri Jul 21 00:00:00 EDT 2023T00:00:00Z
@@ -215,6 +224,7 @@ sub grok {
 	if ($expires =~ /[a-z]{3} ([a-z]{3}) (\d\d) 00:00:00 \S+ (\d\d\d\d)T/i) {
 		$expires = join('-', $2,$1,$3);
 	}
+	printf STDERR "Line %d: expires='%s'\n", __LINE__, $expires if $opts{d};
 
 	# Name.com returns dates like this: 2018-12-13T21:27:28-07:00Z
 	# Just remove the timezone offset and call it good enough
@@ -222,11 +232,13 @@ sub grok {
 	if ($expires =~ /(\d{4}-\d\d-\d\dt\d\d:\d\d:\d\d)-\d\d:\d\dz/i) {
 		$expires = $1;
 	}
+	printf STDERR "Line %d: expires='%s'\n", __LINE__, $expires if $opts{d};
 
 	my $t;
 	if (defined $expires) {
 	    $expires =~ s/-t/ /i;
 	    $expires =~ s/z$//i;
+	    printf STDERR "Line %d: expires='%s'\n", __LINE__, $expires if $opts{d};
             $t = UnixDate($expires, "%s");
             critical("Invalid expiration time '$expires'") unless defined $t;
             critical("Invalid expiration time '$expires' (t=$t)") if ($t < 0);
diff --git a/check_whois/control b/check_whois/control
index 96178a2..e148f87 100644
--- a/check_whois/control
+++ b/check_whois/control
@@ -6,4 +6,4 @@ Description: plugin to check for the expiration of a domain.
  output formats differ or there is no expiration date in the
  whois output.
 Recommends: libdate-manip-perl
-Version: 1.19
+Version: 1.21

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-nagios/pkg-nagios-plugins-contrib.git



More information about the Pkg-nagios-changes mailing list