diff --git a/node.json b/node.json index c6f350b..beff3d3 100644 --- a/node.json +++ b/node.json @@ -69,9 +69,16 @@ "name": "background_color", "type": "color", "default": [0,0,0,1] + }, { + "title": "Show ACK", + "ui_width": 2, + "name": "show_ack", + "type": "boolean", + "default": true, + "hint": "Show acknowledged problems (adds a note, too)" }, { "title": "instance name", - "ui_width": 9, + "ui_width": 7, "name": "instance_name", "type": "string", "default": "icinga2", diff --git a/node.lua b/node.lua index c143722..30ea8d6 100644 --- a/node.lua +++ b/node.lua @@ -91,8 +91,7 @@ function node.render() y = y+CONFIG.header_size+CONFIG.output_size*0.5 - --debug output - --CONFIG.font:write(10, y, serv.sort, 10, c_text[serv.state][1],c_text[serv.state][2],c_text[serv.state][2],1) + CONFIG.output_font:write(10, y, serv.ack, CONFIG.output_size, c_text[serv.state][1],c_text[serv.state][2],c_text[serv.state][2],1) for idx, line in ipairs(serv.output) do CONFIG.output_font:write(indent, y, line, CONFIG.output_size, c_text[serv.state][1],c_text[serv.state][2],c_text[serv.state][3],1) diff --git a/service b/service index 5b0f500..a9e201a 100755 --- a/service +++ b/service @@ -53,12 +53,21 @@ def regenerate(): if host['attrs']['downtime_depth'] > 0: continue + if host['attrs']['acknowledgement'] == 1: + if not CONFIG['show_ack']: + continue + + ack = 'ACKNOWLEDGED' + else: + ack = '' + services['services'].append({ 'host': host['attrs']['display_name'], 'service': '-- HOST --', 'state': 2, 'type': int(host['attrs']['state_type']), 'output': host['attrs']['last_check_result']['output'].splitlines(), + 'ack': ack, 'sort': '{}{}{}{}'.format( int(host['attrs']['state_type'])*-1, SORT_ORDER[2], @@ -72,12 +81,21 @@ def regenerate(): if svc['attrs']['downtime_depth'] > 0 or svc['attrs']['host_name'] in broken_hosts: continue + if svc['attrs']['acknowledgement'] == 1: + if not CONFIG['show_ack']: + continue + + ack = 'ACKNOWLEDGED' + else: + ack = '' + services['services'].append({ 'host': svc['attrs']['host_name'], 'service': svc['attrs']['display_name'], 'state': int(svc['attrs']['state']), 'type': int(svc['attrs']['state_type']), 'output': svc['attrs']['last_check_result']['output'].splitlines(), + 'ack': ack, 'sort': '{}{}{}{}'.format( int(svc['attrs']['state_type'])*-1, SORT_ORDER[int(svc['attrs']['state'])], @@ -91,6 +109,7 @@ def regenerate(): 'service': 'INTERNAL', 'state': 2, 'type': 1, + 'ack': '', 'output': [repr(e)], 'sort': 999, }) @@ -101,6 +120,7 @@ def regenerate(): 'service': 'icinga2', 'state': 0, 'type': 1, + 'ack': '', 'output': ['Everything is fine. Go get some coffee.'], 'sort': 1000, })