perfdata
added some simple perf data
This commit is contained in:
parent
d26aeed784
commit
057319b324
19
check_extended_dns.py
Normal file → Executable file
19
check_extended_dns.py
Normal file → Executable file
@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/env python
|
||||||
|
"""Active Nagios chheck for whois database for matching DNS servers."""
|
||||||
|
|
||||||
import pythonwhois
|
import pythonwhois
|
||||||
import argparse
|
import argparse
|
||||||
@ -13,6 +14,7 @@ args = parser.parse_args()
|
|||||||
nsargs = args.nameserver
|
nsargs = args.nameserver
|
||||||
# how many ns servers should we expect?
|
# how many ns servers should we expect?
|
||||||
nsargscount = len(nsargs)
|
nsargscount = len(nsargs)
|
||||||
|
# whoiscount = []
|
||||||
|
|
||||||
try:
|
try:
|
||||||
whois = pythonwhois.get_whois(args.domain[0])
|
whois = pythonwhois.get_whois(args.domain[0])
|
||||||
@ -21,6 +23,8 @@ try:
|
|||||||
for key, value in whois.iteritems():
|
for key, value in whois.iteritems():
|
||||||
if key == "nameservers":
|
if key == "nameservers":
|
||||||
whoiscount.append(value)
|
whoiscount.append(value)
|
||||||
|
# I know this is bad W0702; used as a catch-all
|
||||||
|
# Ill get to it someday
|
||||||
except:
|
except:
|
||||||
#something happened, raise an erro
|
#something happened, raise an erro
|
||||||
print "3 Unexpected_error: ", sys.exc_info()[0]
|
print "3 Unexpected_error: ", sys.exc_info()[0]
|
||||||
@ -33,11 +37,12 @@ nscount = list(itertools.chain.from_iterable(whoiscount))
|
|||||||
#print len(nscount)
|
#print len(nscount)
|
||||||
|
|
||||||
if len(nscount) < nsargscount:
|
if len(nscount) < nsargscount:
|
||||||
print("Extended_DNS_Check CRITICAL - WHOIS DNS servers do not match provided DNS nameservers.")
|
print "Extended_DNS_Check " + str(nsargscount) + "; whoiscount=" + str(len(nscount)) + " CRITICAL - WHOIS DNS servers do not match provided DNS nameservers."
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
elif len(nscount) > nsargscount:
|
elif len(nscount) > nsargscount:
|
||||||
print("Extended_DNS_Check WARNING - WHOIS DNS servers do not match. There are more DNS servers from the WHOIS datbase than in your query.")
|
print "Extended_DNS_Check " + str(nsargscount) + "; whoiscount=" + str(len(nscount)) + " WARNING - WHOIS DNS servers do not match. \
|
||||||
sys.exit(1)
|
There are more DNS servers from the WHOIS datbase than in your query."
|
||||||
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
print("Extended_DNS_Check OK - all DNS server match")
|
print("0 Extended_DNS_Check nscount=" + str(nsargscount) + "; whoiscount=" + str(len(nscount)) + " OK - all DNS server match")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
Loading…
Reference in New Issue
Block a user