summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d0782e4)
raw | patch | inline | side by side (parent: d0782e4)
author | Sven Velt <sven@velt.de> | |
Thu, 23 Sep 2010 11:12:13 +0000 (13:12 +0200) | ||
committer | Sven Velt <sven@velt.de> | |
Thu, 23 Sep 2010 11:12:13 +0000 (13:12 +0200) |
Signed-off-by: Sven Velt <sven@velt.de>
nagixsc/__init__.py | patch | blob | history | |
nagixsc_http2nagios.py | patch | blob | history |
diff --git a/nagixsc/__init__.py b/nagixsc/__init__.py
index 8f886ac5a9e46c8a75ddc2a2c449204199aabdc2..5bdde6815d5cfcbc99cebdeeebc0e72d044ecf1a 100644 (file)
--- a/nagixsc/__init__.py
+++ b/nagixsc/__init__.py
timestamp = check['timestamp']
else:
timestamp = xmltimestamp
- count_services += 1
if check['service_description'] == None or check['service_description'] == '':
# Host check
diff --git a/nagixsc_http2nagios.py b/nagixsc_http2nagios.py
index c1ec000697f103a250c2fd61eec1feac3901a091..b8e39b84aaa9a3216fc947a10843cb604b1f083c 100755 (executable)
--- a/nagixsc_http2nagios.py
+++ b/nagixsc_http2nagios.py
elif config['mode']=='passive':
try:
- config['mode_pipe'] = cfgread.get('mode_passive','pipe')
+ config['pipe'] = cfgread.get('mode_passive','pipe')
except ConfigParser.NoOptionError:
print 'No "pipe" in section "mode_passive" specified!'
sys.exit(127)
doc = read_xml_from_string(xmltext)
checks = xml_to_dict(doc)
- (count_services, count_failed, list_failed) = dict2out_checkresult(checks, xml_get_timestamp(doc), config['checkresultdir'], 0)
+ if config['mode'] == 'checkresult':
+ (count_services, count_failed, list_failed) = dict2out_checkresult(checks, xml_get_timestamp(doc), config['checkresultdir'])
+
+ if count_failed < count_services:
+ self.send_response(200)
+ self.send_header('Content-Type', 'text/plain')
+ self.end_headers()
+ self.wfile.write('Wrote %s check results, %s failed' % (count_services, count_failed))
+ return
+ else:
+ self.http_error(501, 'Could not write all %s check results' % count_services)
+ return
+
+ elif config['mode'] == 'passive':
+ count_services = dict2out_passive(checks, xml_get_timestamp(doc), config['pipe'])
- if count_failed < count_services:
self.send_response(200)
self.send_header('Content-Type', 'text/plain')
self.end_headers()
- self.wfile.write('Wrote %s check results, %s failed' % (count_services, count_failed))
- return
- else:
- self.http_error(501, 'Could not write all %s check results' % count_services)
+ self.wfile.write('Wrote %s check results' % count_services)
return
else: