Added 'acknowledged' property to LiveHost and LiveService
Change-Id: Ief2c20b356316e572a6c9195f09e560a172d0901
This commit is contained in:
parent
0535a5b009
commit
e2f08997cf
@ -28,6 +28,9 @@ class LiveHost(types.Base):
|
||||
state = wsme.wsattr(int, mandatory=False)
|
||||
"""The current state of the host"""
|
||||
|
||||
acknowledged = wsme.wsattr(int, mandatory=False)
|
||||
"""Wether or not the problem, if any, has been acknowledged"""
|
||||
|
||||
last_check = wsme.wsattr(int, mandatory=False)
|
||||
"""The last time the host was checked"""
|
||||
|
||||
|
@ -31,6 +31,9 @@ class LiveService(types.Base):
|
||||
state = wsme.wsattr(int, mandatory=False)
|
||||
"""The current state of the service"""
|
||||
|
||||
acknowledged = wsme.wsattr(int, mandatory=False)
|
||||
"""Wether or not the problem, if any, has been acknowledged"""
|
||||
|
||||
last_check = wsme.wsattr(int, mandatory=False)
|
||||
"""The last time the service was checked"""
|
||||
|
||||
|
@ -37,6 +37,7 @@ class HostHandler(handler.Handler):
|
||||
"host_name": item[0][1]['host_name'],
|
||||
"description": item[0][1]['host_name'],
|
||||
"state": first_entry['state'],
|
||||
"acknowledged": first_entry['acknowledged'],
|
||||
"last_check": int(first_entry['last_check']),
|
||||
"last_state_change": int(first_entry['last_state_change']),
|
||||
"plugin_output": first_entry['output']
|
||||
|
@ -43,6 +43,7 @@ class ServiceHandler(handler.Handler):
|
||||
"host_name": item[0][1]['host_name'],
|
||||
"description": item[0][1]['service_description'],
|
||||
"state": first_entry['state'],
|
||||
"acknowledged": first_entry['acknowledged'],
|
||||
"last_check": int(first_entry['last_check']),
|
||||
"last_state_change": int(first_entry['last_state_change']),
|
||||
"plugin_output": first_entry['output']
|
||||
|
@ -24,20 +24,20 @@ class TestStatusHosts(functionalTest.FunctionalTest):
|
||||
def setUp(self):
|
||||
super(TestStatusHosts, self).setUp()
|
||||
self.influxdb_response = (
|
||||
'{"results":[{"series":[{"name":"HOST_STATE","tags":{"host_nam'
|
||||
'e":"localhost"},"columns":["time","last_check","last_state_chan'
|
||||
'ge","output","state","state_type"],"values":[["201'
|
||||
'5-04-19T01:09:24Z",1.429405764e+09,1.429405765316929e+09,"OK '
|
||||
'- localhost: rta 0.033ms, lost 0%",0,"HARD"]]},{"name":"'
|
||||
'HOST_STATE","tags":{"host_name":"test_keystone"},"columns":["'
|
||||
'time","last_check","last_state_change","output","state",'
|
||||
'"state_type"],"values":[["2015-04-19T01:09:23Z",1.4294057'
|
||||
'63e+09,1.429405765317144e+09,"OK - 127.0.0.1: rta 0.032ms, lo'
|
||||
'st 0%",0,"HARD"]]},{"name":"HOST_STATE","tags":{"host_na'
|
||||
'me":"ws-arbiter"},"columns":["time","last_check","last_state_ch'
|
||||
'ange","output","state","state_type"],"values":[["2'
|
||||
'015-04-19T01:09:24Z",1.429405764e+09,1.429405765317063e+09,"O'
|
||||
'K - localhost: rta 0.030ms, lost 0%",0,"HARD"]]}]}]}'
|
||||
'{"results":[{"series":[{"name":"HOST_STATE","tags":{"host_name":'
|
||||
'"localhost"},"columns":["time","last_check","last_state_change",'
|
||||
'"output","state","state_type", "acknowledged"],"values":[["2015-'
|
||||
'04-19T01:09:24Z",1.429405764e+09,1.429405765316929e+09,"OK - loc'
|
||||
'alhost: rta 0.033ms, lost 0%",0,"HARD",0]]},{"name":"HOST_STATE"'
|
||||
',"tags":{"host_name":"test_keystone"},"columns":["time","last_ch'
|
||||
'eck","last_state_change","output","state","state_type", "acknowl'
|
||||
'edged"],"values":[["2015-04-19T01:09:23Z",1.429405763e+09,1.4294'
|
||||
'05765317144e+09,"OK - 127.0.0.1: rta 0.032ms, lost 0%",0,"HARD",'
|
||||
'0]]},{"name":"HOST_STATE","tags":{"host_name":"ws-arbiter"},"col'
|
||||
'umns":["time","last_check","last_state_change","output","state",'
|
||||
'"state_type","acknowledged"],"values":[["2015-04-19T01:09:24Z",1'
|
||||
'.429405764e+09,1.429405765317063e+09,"OK - localhost: rta 0.030m'
|
||||
's, lost 0%",0,"HARD",0]]}]}]}'
|
||||
)
|
||||
|
||||
@httpretty.activate
|
||||
@ -54,18 +54,21 @@ class TestStatusHosts(functionalTest.FunctionalTest):
|
||||
"plugin_output": "OK - localhost: rta 0.033ms, lost 0%",
|
||||
"last_check": 1429405764,
|
||||
"state": 0,
|
||||
"acknowledged": 0,
|
||||
"host_name": "localhost"},
|
||||
{"description": "test_keystone",
|
||||
"last_state_change": 1429405765,
|
||||
"plugin_output": "OK - 127.0.0.1: rta 0.032ms, lost 0%",
|
||||
"last_check": 1429405763,
|
||||
"state": 0,
|
||||
"acknowledged": 0,
|
||||
"host_name": "test_keystone"},
|
||||
{"description": "ws-arbiter",
|
||||
"last_state_change": 1429405765,
|
||||
"plugin_output": "OK - localhost: rta 0.030ms, lost 0%",
|
||||
"last_check": 1429405764,
|
||||
"state": 0,
|
||||
"acknowledged": 0,
|
||||
"host_name": "ws-arbiter"}]
|
||||
|
||||
self.assertEqual(json.loads(response.body), expected)
|
||||
|
@ -27,14 +27,15 @@ class TestStatusServices(functionalTest.FunctionalTest):
|
||||
'{"results":[{"series":[{"name":"SERVICE_STATE","tags":{"host_nam'
|
||||
'e":"test_keystone","service_description":"Check KeyStone service'
|
||||
'."},"columns":["time","last_check","last_state_change","output",'
|
||||
'"state","state_type"],"values":[["2015-04-19T18:20:34Z",1.429467'
|
||||
'634e+09,1.429467636632134e+09,"There was no suitable authenticat'
|
||||
'ion url for this request",3,"SOFT"]]},{"name":"SERVICE_STATE","t'
|
||||
'ags":{"host_name":"ws-arbiter","service_description":"check-ws-a'
|
||||
'rbiter"},"columns":["time","last_check","last_state_change","out'
|
||||
'put","state","state_type"],"values":[["2015-04-19T18:20:33Z",1.4'
|
||||
'29467633e+09,1.429467635629833e+09,"TCP OK - 0.000 second respon'
|
||||
'se time on port 7760",0,"HARD"]]}]}]}'
|
||||
'"state","state_type","acknowledged"],"values":[["2015-04-19T18:2'
|
||||
'0:34Z",1.429467634e+09,1.429467636632134e+09,"There was no suita'
|
||||
'ble authentication url for this request",3,"SOFT",0]]},{"name":"'
|
||||
'SERVICE_STATE","tags":{"host_name":"ws-arbiter","service_descrip'
|
||||
'tion":"check-ws-arbiter"},"columns":["time","last_check","last_s'
|
||||
'tate_change","output","state","state_type","acknowledged"],"valu'
|
||||
'es":[["2015-04-19T18:20:33Z",1.429467633e+09,1.429467635629833e+'
|
||||
'09,"TCP OK - 0.000 second response time on port 7760",0,"HARD",0'
|
||||
']]}]}]}'
|
||||
)
|
||||
|
||||
@httpretty.activate
|
||||
@ -52,6 +53,7 @@ class TestStatusServices(functionalTest.FunctionalTest):
|
||||
'There was no suitable authentication url for this request',
|
||||
'last_check': 1429467634,
|
||||
'state': 3,
|
||||
"acknowledged": 0,
|
||||
'host_name': 'test_keystone',
|
||||
'service_description': 'Check KeyStone service.'},
|
||||
{'description': 'check-ws-arbiter',
|
||||
@ -60,6 +62,7 @@ class TestStatusServices(functionalTest.FunctionalTest):
|
||||
'TCP OK - 0.000 second response time on port 7760',
|
||||
'last_check': 1429467633,
|
||||
'state': 0,
|
||||
"acknowledged": 0,
|
||||
'host_name': 'ws-arbiter',
|
||||
'service_description': 'check-ws-arbiter'}
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user