[Pkg-nagios-changes] [pkg-nagios-plugins-contrib] 03/03: check_whois: Update to latest version 1.19

Jan Wagner waja at moszumanska.debian.org
Sun Oct 11 13:37:29 UTC 2015


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 fd2e6793c32969869b62586eebfe2fc8b5551ce8
Author: Jan Wagner <waja at cyconet.org>
Date:   Sun Oct 11 15:31:57 2015 +0200

    check_whois: Update to latest version 1.19
---
 check_whois/check_whois | 24 ++++++++++++++++++++++--
 check_whois/control     |  2 +-
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/check_whois/check_whois b/check_whois/check_whois
index 8f999b0..0190364 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.16 2014/12/16 00:09:36 wessels Exp $
+# $Id: check_whois,v 1.19 2015/10/06 14:22:02 wessels Exp $
 #
 # check_whois
 #
@@ -96,6 +96,19 @@ sub findwhois {
 	die "Could not find a whois command!\n";
 }
 
+# 
+# the ~ 2013-14-15 era New GTLDs have whois servers at whois.nic.$tld
+# and they are slow to be configured in either whois clients or the
+# whois-servers.net zone.
+#
+sub findnewgtldwhois($) {
+	my $name = shift;
+	my @x = split /\./, $name;
+	my $tld = pop @x;
+	my $whois = "whois.nic.$tld";
+	return gethostbyname($whois) ? $whois : undef;
+}
+
 sub grok {
 	my $whoiscmd = shift || die;
         my $name = shift || die;
@@ -168,6 +181,11 @@ sub grok {
             $registrar = 'go daddy' if ($registrar eq 'r91-lror');
         } elsif (defined $whoisservice) {
             $registrar = $whoisservice . ' whois service';
+	} elsif ((my $newgltdwhois = findnewgtldwhois($name)) && $whoiscmd !~ / -h /) {
+		print STDERR "retrying with -h $newgltdwhois\n" if $opts{d};
+		$whoiscmd .= " -h $newgltdwhois";
+		grok($whoiscmd, $name);
+		return;
 	} elsif (defined $opts{x}) {
 	    $registrar = 'UNKNOWN';
 	} else {
@@ -207,9 +225,11 @@ sub grok {
 
 	my $t;
 	if (defined $expires) {
+	    $expires =~ s/-t/ /i;
+	    $expires =~ s/z$//i;
             $t = UnixDate($expires, "%s");
             critical("Invalid expiration time '$expires'") unless defined $t;
-            critical("Invalid expiration time '$expires'") if ($t < 0);
+            critical("Invalid expiration time '$expires' (t=$t)") if ($t < 0);
             $expires = strftime("%Y-%m-%d", localtime($t));
 	} elsif (defined $opts{x}) {
 	    $t = time + (86400 * 90);
diff --git a/check_whois/control b/check_whois/control
index 8bc50fe..96178a2 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.16
+Version: 1.19

-- 
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