add option to show acknowledged problems

This commit is contained in:
Franzi 2021-01-02 11:49:59 +01:00
parent 51666ab1fb
commit d8c55e658f
Signed by: kunsi
GPG key ID: 12E3D2136B818350
3 changed files with 29 additions and 3 deletions

View file

@ -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",

View file

@ -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)

20
service
View file

@ -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,
})