Browse Source

check_whois: Updating to 1.24

tags/debian/22.20181105
Jan Wagner 2 years ago
parent
commit
be6e9e80d2
2 changed files with 15 additions and 3 deletions
  1. +14
    -2
      check_whois/check_whois
  2. +1
    -1
      check_whois/control

+ 14
- 2
check_whois/check_whois View File

@@ -1,7 +1,7 @@
#!/usr/bin/perl
# nagios: -epn

# $Id: check_whois,v 1.23 2017/03/31 23:37:49 wessels Exp $
# $Id: check_whois,v 1.24 2018/05/01 17:31:04 wessels Exp $
#
# check_whois
#
@@ -80,7 +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.23 2017/03/31 23:37:49 wessels Exp $'. "\n" if $opts{d};
print STDERR "$0 version ". '$Id: check_whois,v 1.24 2018/05/01 17:31:04 wessels Exp $'. "\n" if $opts{d};
print STDERR "Whois command = $whoiscmd\n" if $opts{d};
grok($whoiscmd, $name);
exit 0;
@@ -110,6 +110,13 @@ sub findnewgtldwhois($) {
return gethostbyname($whois) ? $whois : undef;
}

sub not_in_whois($) {
my $line = shift;
return 1 if $line =~ /^no match for/;
return 1 if $line =~ /^not found/;
return 0;
}

sub grok {
my $whoiscmd = shift || die;
my $name = shift || die;
@@ -126,10 +133,15 @@ sub grok {
my $expires = undef;
my $status = '';
my $state = 0;
my $lineno = 0;
print STDERR "checking $name\n" if $opts{d};
while (<CMD>) {
$lineno++;
tr/A-Z/a-z/;
print STDERR "# $_" if $opts{d};
if ($lineno == 1 && not_in_whois($_)) {
critical("$name not found in whois");
}
$registrar = $1 if (/registrar:\s*(\S.*)/);
if (!defined($registrar)) {
$registrar = $1 if (/registrar id:\s*(\S.*)/);


+ 1
- 1
check_whois/control View File

@@ -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.23
Version: 1.24

Loading…
Cancel
Save