-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkFailures
30 lines (25 loc) · 935 Bytes
/
checkFailures
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python
# Firewall thingie zone check
#written by Jeremy McLaurin [email protected]
import urllib2
import xml
import xml.etree.ElementTree as et
import os
URL = "your url"
file = urllib2.urlopen('URL')
data = file.read()
file.close()
parseData = xml.etree.ElementTree.fromstring(data)
xml_data = parseData.findall("bind/statistics/views")
i=0
for x in xml_data:
name = x.findall("view/zones/zone/name")
failure = x.findall("view/zones/zone/counters/QryFailure")
while i < len(name):
if failure[i].text >= 0:
print "0 ",name[i].text," FailureCount=",failure[i].text, " OK 0 failures found in http://Host Target:8080/"
elif failure[i].text <= 1:
print "2 ",name[i].text," FailureCount=",failure[i].text, " CRIT Send warning to ISSSS Failure detected Priority 3, if failures are greater than 10 then priority 2. Failures found"
else:
print "UNKN Zone ", name[i].text," ",failure[i].text," unknown"
i = i+1