Add 'long_output' field to status API

Change-Id: I51a0c8111e507ce7b07644e17e37e6d13cc33081
This commit is contained in:
Frédéric Vachon 2015-05-27 11:58:00 -04:00
parent 58a3acf1f8
commit c041106b12
4 changed files with 25 additions and 3 deletions

View File

@ -49,6 +49,9 @@ class LiveHost(types.Base):
plugin_output = wsme.wsattr(wtypes.text, mandatory=False) plugin_output = wsme.wsattr(wtypes.text, mandatory=False)
"""Plugin output of the last check""" """Plugin output of the last check"""
long_output = wsme.wsattr(wtypes.text, mandatory=False)
"""Plugin long ouput of the last check"""
@classmethod @classmethod
def sample(cls): def sample(cls):
return cls( return cls(
@ -61,5 +64,6 @@ class LiveHost(types.Base):
acknowledged=True, acknowledged=True,
last_check=1429220785, last_check=1429220785,
last_state_change=1429220785, last_state_change=1429220785,
plugin_output='PING OK - Packet loss = 0%, RTA = 0.02 ms' plugin_output='PING OK - Packet loss = 0%, RTA = 0.02 ms',
long_output='The ping was great\nI love epic ping-pong games'
) )

View File

@ -43,6 +43,9 @@ class LiveService(types.Base):
plugin_output = wsme.wsattr(wtypes.text, mandatory=False) plugin_output = wsme.wsattr(wtypes.text, mandatory=False)
"""Plugin output of the last check""" """Plugin output of the last check"""
long_output = wsme.wsattr(wtypes.text, mandatory=False)
"""Plugin long ouput of the last check"""
@classmethod @classmethod
def sample(cls): def sample(cls):
return cls( return cls(
@ -54,4 +57,5 @@ class LiveService(types.Base):
last_state_change=1429220785, last_state_change=1429220785,
plugin_output='HTTP OK - GOT NICE RESPONSE', plugin_output='HTTP OK - GOT NICE RESPONSE',
acknowledged=True, acknowledged=True,
long_output='Serves /var/www/\nServes /home/webserver/www/'
) )

View File

@ -31,6 +31,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
"last_chk": 1.429405764e+09, "last_chk": 1.429405764e+09,
"last_state_change": 1.429405765316929e+09, "last_state_change": 1.429405765316929e+09,
"plugin_output": "OK - localhost: rta 0.033ms, lost 0%", "plugin_output": "OK - localhost: rta 0.033ms, lost 0%",
"long_output": "This is\na\nlong\noutput",
"state": "OK", "state": "OK",
"state_type": "HARD", "state_type": "HARD",
"problem_has_been_acknowledged": True, "problem_has_been_acknowledged": True,
@ -44,6 +45,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
"last_chk": 1.429405763e+09, "last_chk": 1.429405763e+09,
"last_state_change": 1.429405765317144e+09, "last_state_change": 1.429405765317144e+09,
"plugin_output": "OK - 127.0.0.1: rta 0.032ms, lost 0%", "plugin_output": "OK - 127.0.0.1: rta 0.032ms, lost 0%",
"long_output": "Another very\nlong\noutput",
"state": "OK", "state": "OK",
"state_type": "HARD", "state_type": "HARD",
"problem_has_been_acknowledged": True, "problem_has_been_acknowledged": True,
@ -57,6 +59,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
"last_chk": 1.429405764e+09, "last_chk": 1.429405764e+09,
"last_state_change": 1.429405765317063e+09, "last_state_change": 1.429405765317063e+09,
"plugin_output": "OK - localhost: rta 0.030ms, lost 0%", "plugin_output": "OK - localhost: rta 0.030ms, lost 0%",
"long_output": "What a;\nlong;\noutput;",
"state": "OK", "state": "OK",
"state_type": "HARD", "state_type": "HARD",
"problem_has_been_acknowledged": True, "problem_has_been_acknowledged": True,
@ -75,7 +78,8 @@ class TestStatusHosts(functionalTest.FunctionalTest):
"state": 'OK', "state": 'OK',
"last_check": 1429220785, "last_check": 1429220785,
"last_state_change": 1429220785, "last_state_change": 1429220785,
"plugin_output": 'HTTP OK - GOT NICE RESPONSE' "plugin_output": 'HTTP OK - GOT NICE RESPONSE',
"long_output": 'This has\n a long\noutput'
}, },
{ {
"host_name": 'someserver', "host_name": 'someserver',
@ -84,7 +88,8 @@ class TestStatusHosts(functionalTest.FunctionalTest):
"state": 'OK', "state": 'OK',
"last_check": 1429220785, "last_check": 1429220785,
"last_state_change": 1429220785, "last_state_change": 1429220785,
"plugin_output": 'Hi there' "plugin_output": 'Hi there',
"long_output": 'My output;\nis better;\nthan yours;'
}, },
] ]
@ -102,6 +107,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
"parents": ['parent.com'], "parents": ['parent.com'],
"last_state_change": 1429405765, "last_state_change": 1429405765,
"plugin_output": "OK - localhost: rta 0.033ms, lost 0%", "plugin_output": "OK - localhost: rta 0.033ms, lost 0%",
"long_output": "This is\na\nlong\noutput",
"last_check": 1429405764, "last_check": 1429405764,
"state": "OK", "state": "OK",
"acknowledged": True, "acknowledged": True,
@ -112,6 +118,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
"parents": ['parent.com'], "parents": ['parent.com'],
"last_state_change": 1429405765, "last_state_change": 1429405765,
"plugin_output": "OK - 127.0.0.1: rta 0.032ms, lost 0%", "plugin_output": "OK - 127.0.0.1: rta 0.032ms, lost 0%",
"long_output": "Another very\nlong\noutput",
"last_check": 1429405763, "last_check": 1429405763,
"state": "OK", "state": "OK",
"acknowledged": True, "acknowledged": True,
@ -122,6 +129,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
"parents": ['parent.com'], "parents": ['parent.com'],
"last_state_change": 1429405765, "last_state_change": 1429405765,
"plugin_output": "OK - localhost: rta 0.030ms, lost 0%", "plugin_output": "OK - localhost: rta 0.030ms, lost 0%",
"long_output": "What a;\nlong;\noutput;",
"last_check": 1429405764, "last_check": 1429405764,
"state": "OK", "state": "OK",
"acknowledged": True, "acknowledged": True,
@ -158,6 +166,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
"last_state_change": 1429812192, "last_state_change": 1429812192,
"acknowledged": True, "acknowledged": True,
"plugin_output": "OK - localhost: rta 0.044ms, lost 0%", "plugin_output": "OK - localhost: rta 0.044ms, lost 0%",
"long_output": "This is\na\nlong\noutput",
"last_check": 1429812191, "last_check": 1429812191,
"state": "OK", "state": "OK",
"host_name": "localhost", "host_name": "localhost",
@ -174,6 +183,7 @@ class TestStatusHosts(functionalTest.FunctionalTest):
'last_state_change': 1429823532, 'last_state_change': 1429823532,
'plugin_output': ('TCP OK - 0.000 second ' 'plugin_output': ('TCP OK - 0.000 second '
'response time on port 7760'), 'response time on port 7760'),
"long_output": 'My output;\nis better;\nthan yours;',
'last_check': 1429823531, 'last_check': 1429823531,
'state': 'OK', 'state': 'OK',
'host_name': 'ws-arbiter', 'host_name': 'ws-arbiter',

View File

@ -31,6 +31,7 @@ class TestStatusServices(functionalTest.FunctionalTest):
"last_chk": 1429220785, "last_chk": 1429220785,
"last_state_change": 1429220785, "last_state_change": 1429220785,
"plugin_output": 'HTTP OK - GOT NICE RESPONSE', "plugin_output": 'HTTP OK - GOT NICE RESPONSE',
"long_output": 'The response\nwas really\nnice',
"problem_has_been_acknowledged": True, "problem_has_been_acknowledged": True,
}, },
{ {
@ -41,6 +42,7 @@ class TestStatusServices(functionalTest.FunctionalTest):
"last_chk": 1429220785, "last_chk": 1429220785,
"last_state_change": 1429220785, "last_state_change": 1429220785,
"plugin_output": 'Hi there', "plugin_output": 'Hi there',
"long_output": 'I am;\nthe servicessomthing;\noutput;',
"problem_has_been_acknowledged": False, "problem_has_been_acknowledged": False,
}, },
] ]
@ -60,6 +62,7 @@ class TestStatusServices(functionalTest.FunctionalTest):
"last_check": 1429220785, "last_check": 1429220785,
"last_state_change": 1429220785, "last_state_change": 1429220785,
"plugin_output": 'HTTP OK - GOT NICE RESPONSE', "plugin_output": 'HTTP OK - GOT NICE RESPONSE',
"long_output": 'The response\nwas really\nnice',
'acknowledged': True, 'acknowledged': True,
}, },
{ {
@ -70,6 +73,7 @@ class TestStatusServices(functionalTest.FunctionalTest):
"last_check": 1429220785, "last_check": 1429220785,
"last_state_change": 1429220785, "last_state_change": 1429220785,
"plugin_output": 'Hi there', "plugin_output": 'Hi there',
"long_output": 'I am;\nthe servicessomthing;\noutput;',
'acknowledged': False, 'acknowledged': False,
}, },
] ]