Open nanomad opened 9 years ago
I am also seeing this issue.
To add some more data to this issue, I added a debug line before:
File "/var/lib/shinken/modules/livestatus/livestatus_response.py", line 183, in _json_end_row
return (',' if line_nr else '') + dumps(row)
It produces the following output:
[1424984369] INFO: [broker-master] row = ['name', 'alias', 'email', 'pager', 'service_notification_period', 'host_notification_period']
[1424984369] INFO: [broker-master] row = [u'admin', 'none', u'shinken@localhost', u'0600000000', <object object at 0x7f3e9b74aaa0>, <object object at 0x7f3e9b74aaa0>]
So it looks like Thruk is querying the service_notification_period and host_notification_period when it is generating the contact list. Those are both objects that get passed to the json serializer and that causes the error.
Here is a patch to address this bug. Can you validate that it is working ?
--- mapping.py.orig 2015-04-04 09:55:11.586885213 +0200
+++ mapping.py 2015-04-04 09:55:48.633657815 +0200
@@ -1726,7 +1726,7 @@
},
'host_notification_period': {
'description': 'The time period in which the contact will be notified about host problems',
- 'function': lambda item, req: item.host_notification_period,
+ 'function': lambda item, req: item.host_notification_period.get_name(),
},
'host_notifications_enabled': {
'description': 'Whether the contact will be notified about host problems in general (0/1)',
@@ -1763,7 +1763,7 @@
},
'service_notification_period': {
'description': 'The time period in which the contact will be notified about service problems',
- 'function': lambda item, req: item.service_notification_period,
+ 'function': lambda item, req: item.service_notification_period.get_name(),
},
'service_notifications_enabled': {
'description': 'Whether the contact will be notified about service problems in general (0/1)',
create the patch file (say file.patch for exemple) and run the following command
patch < file.patch
Patch submited as PR : https://github.com/shinken-monitoring/mod-livestatus/pull/51
This patch does fix the error condition that had been introduced and the livestatus module now returns results consistent to the previous version. While this has fixed the crashing issue, it doesn't appear to actually return any valid data. In my tests, the time period names are always returned as nothing. I was expecting time period names like 24x7, etc...
did not notice that. Sorry i reopen until it is fixed.
Confirmed as a livestatus bug since contacts notification periods are handled corectly internaly (from a shinken point of view). Need to dig a little ....
spent some time trying to track this down, couldn't figure out where the host_notification_period was coming from. Traced it back to the input to manage_initial_contact_status_brok
, but I couldn't find who call calls that
@ryepup
manage_initial_contact_status_brok
(and any other manage_
XXX_brok
) is (indirectly) called by the broker daemon :
there : https://github.com/naparuba/shinken/blob/master/shinken/daemons/brokerdaemon.py#L272 :
for mod in self.modules_manager.get_internal_instances():
try:
mod.manage_brok(b)
and the module manage_brok
is defined here : https://github.com/naparuba/shinken/blob/master/shinken/basemodule.py#L248 :
def manage_brok(self, brok):
"""Request the module to manage the given brok.
There a lot of different possible broks to manage.
"""
manage = getattr(self, 'manage_' + brok.type + '_brok', None)
if manage:
# Be sure the brok is prepared before call it
brok.prepare()
return manage(brok)
This happens while thruk tries to retrieve contacts info via livestatus
Also, running:
Results in
This happens with: