improve icinga2kuma
This commit is contained in:
parent
2bc293dc57
commit
b8849d200f
|
@ -36,9 +36,9 @@ app = Flask(__name__)
|
|||
@app.route("/host/<hostid>")
|
||||
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()
|
||||
|
|
Loading…
Reference in New Issue