diff --git a/nagixsc_http2nagios.py b/nagixsc_http2nagios.py
index ad86b65eba536feb843e40198c1f06af8a55a11d..0a709a585b9ea745d5e376c480808ddcbf22d85e 100755 (executable)
--- a/nagixsc_http2nagios.py
+++ b/nagixsc_http2nagios.py
parser = optparse.OptionParser()
parser.add_option('-c', '', dest='cfgfile', help='Config file')
+parser.add_option('-d', '--daemon', action='store_true', dest='daemon', help='Daemonize, go to background')
parser.add_option('', '--nossl', action='store_true', dest='nossl', help='Disable SSL (overwrites config file)')
parser.set_defaults(cfgfile='http2nagios.cfg')
print 'Config file error: %s ' % e
sys.exit(1)
+if os.access(config['checkresultdir'],os.W_OK) == False:
+ print 'Checkresult directory "%s" is not writable.' % config['checkresultdir']
+ sys.exit(1)
+
users = {}
for u in cfgread.options('users'):
users[u] = cfgread.get('users', u)
print 'SSL certificate "%s" not found!' % config['cert']
sys.exit(127)
+ if options.daemon:
+ daemonize(pidfile='/var/run/nagixsc_http2nagios.pid')
+
server = MyHTTPServer((config['ip'], config['port']), HTTP2NagiosHandler, ssl=config['ssl'], sslpemfile=config['cert'])
try:
server.serve_forever()