add option to show acknowledged problems
This commit is contained in:
parent
51666ab1fb
commit
d8c55e658f
3 changed files with 29 additions and 3 deletions
|
@ -69,9 +69,16 @@
|
||||||
"name": "background_color",
|
"name": "background_color",
|
||||||
"type": "color",
|
"type": "color",
|
||||||
"default": [0,0,0,1]
|
"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",
|
"title": "instance name",
|
||||||
"ui_width": 9,
|
"ui_width": 7,
|
||||||
"name": "instance_name",
|
"name": "instance_name",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": "icinga2",
|
"default": "icinga2",
|
||||||
|
|
3
node.lua
3
node.lua
|
@ -91,8 +91,7 @@ function node.render()
|
||||||
|
|
||||||
y = y+CONFIG.header_size+CONFIG.output_size*0.5
|
y = y+CONFIG.header_size+CONFIG.output_size*0.5
|
||||||
|
|
||||||
--debug output
|
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)
|
||||||
--CONFIG.font:write(10, y, serv.sort, 10, c_text[serv.state][1],c_text[serv.state][2],c_text[serv.state][2],1)
|
|
||||||
|
|
||||||
for idx, line in ipairs(serv.output) do
|
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)
|
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
20
service
|
@ -53,12 +53,21 @@ def regenerate():
|
||||||
if host['attrs']['downtime_depth'] > 0:
|
if host['attrs']['downtime_depth'] > 0:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if host['attrs']['acknowledgement'] == 1:
|
||||||
|
if not CONFIG['show_ack']:
|
||||||
|
continue
|
||||||
|
|
||||||
|
ack = 'ACKNOWLEDGED'
|
||||||
|
else:
|
||||||
|
ack = ''
|
||||||
|
|
||||||
services['services'].append({
|
services['services'].append({
|
||||||
'host': host['attrs']['display_name'],
|
'host': host['attrs']['display_name'],
|
||||||
'service': '-- HOST --',
|
'service': '-- HOST --',
|
||||||
'state': 2,
|
'state': 2,
|
||||||
'type': int(host['attrs']['state_type']),
|
'type': int(host['attrs']['state_type']),
|
||||||
'output': host['attrs']['last_check_result']['output'].splitlines(),
|
'output': host['attrs']['last_check_result']['output'].splitlines(),
|
||||||
|
'ack': ack,
|
||||||
'sort': '{}{}{}{}'.format(
|
'sort': '{}{}{}{}'.format(
|
||||||
int(host['attrs']['state_type'])*-1,
|
int(host['attrs']['state_type'])*-1,
|
||||||
SORT_ORDER[2],
|
SORT_ORDER[2],
|
||||||
|
@ -72,12 +81,21 @@ def regenerate():
|
||||||
if svc['attrs']['downtime_depth'] > 0 or svc['attrs']['host_name'] in broken_hosts:
|
if svc['attrs']['downtime_depth'] > 0 or svc['attrs']['host_name'] in broken_hosts:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if svc['attrs']['acknowledgement'] == 1:
|
||||||
|
if not CONFIG['show_ack']:
|
||||||
|
continue
|
||||||
|
|
||||||
|
ack = 'ACKNOWLEDGED'
|
||||||
|
else:
|
||||||
|
ack = ''
|
||||||
|
|
||||||
services['services'].append({
|
services['services'].append({
|
||||||
'host': svc['attrs']['host_name'],
|
'host': svc['attrs']['host_name'],
|
||||||
'service': svc['attrs']['display_name'],
|
'service': svc['attrs']['display_name'],
|
||||||
'state': int(svc['attrs']['state']),
|
'state': int(svc['attrs']['state']),
|
||||||
'type': int(svc['attrs']['state_type']),
|
'type': int(svc['attrs']['state_type']),
|
||||||
'output': svc['attrs']['last_check_result']['output'].splitlines(),
|
'output': svc['attrs']['last_check_result']['output'].splitlines(),
|
||||||
|
'ack': ack,
|
||||||
'sort': '{}{}{}{}'.format(
|
'sort': '{}{}{}{}'.format(
|
||||||
int(svc['attrs']['state_type'])*-1,
|
int(svc['attrs']['state_type'])*-1,
|
||||||
SORT_ORDER[int(svc['attrs']['state'])],
|
SORT_ORDER[int(svc['attrs']['state'])],
|
||||||
|
@ -91,6 +109,7 @@ def regenerate():
|
||||||
'service': 'INTERNAL',
|
'service': 'INTERNAL',
|
||||||
'state': 2,
|
'state': 2,
|
||||||
'type': 1,
|
'type': 1,
|
||||||
|
'ack': '',
|
||||||
'output': [repr(e)],
|
'output': [repr(e)],
|
||||||
'sort': 999,
|
'sort': 999,
|
||||||
})
|
})
|
||||||
|
@ -101,6 +120,7 @@ def regenerate():
|
||||||
'service': 'icinga2',
|
'service': 'icinga2',
|
||||||
'state': 0,
|
'state': 0,
|
||||||
'type': 1,
|
'type': 1,
|
||||||
|
'ack': '',
|
||||||
'output': ['Everything is fine. Go get some coffee.'],
|
'output': ['Everything is fine. Go get some coffee.'],
|
||||||
'sort': 1000,
|
'sort': 1000,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue