diff --git a/Other/icinga2kuma.py b/Other/icinga2kuma.py index 16caf31..a8ceb7d 100755 --- a/Other/icinga2kuma.py +++ b/Other/icinga2kuma.py @@ -36,9 +36,9 @@ app = Flask(__name__) @app.route("/host/") def get_host_state(hostid=None): path = Path(request.base_url) - args_service = request.args.getlist('service') - args_exclude_service = request.args.getlist('exclude') # do not list these services - args_ignore_service = request.args.getlist('ignore') # do not trigger a fail if these services fail + args_service = request.args.get('service', '').split(',') + args_exclude_service = request.args.get('exclude', '').split(',') # do not list these services + args_ignore_service = request.args.get('ignore', '').split(',') # do not trigger a fail if these services fail kuma_mode = True if request.args.get('kuma') == 'true' else False if not hostid: @@ -81,6 +81,10 @@ def get_host_state(hostid=None): } } + for i in range(len(args_service)): + if '+' in args_service[i]: + args_service[i].replace('+', ' ') + if len(args_service): services = {} for service in args_service: @@ -101,3 +105,7 @@ def get_host_state(hostid=None): return Response(json.dumps(result), status=410, mimetype='application/json') else: return result + + +if __name__ == '__main__': + app.run()