Thanks for the answer, I had forgotten that we used netcat instead of unixcat. I have still to confirm this, but i'm think we have a problem because we're not correctly closing the connection with netcat.

I'm going to code it in python in order to do this in a proper way.

I'll keep you posted if this is not the issue but I'm pretty sure that this is our problem.



2011/10/26 Gerhard Lausser <Gerhard.Lausser@consol.de>


which version of Shinken do you use?

I have here a 0.8 and canít reproduce your error. Thereís one host (omd-disco) which I made DOWN by submitting a passive command and which has two comments attached.

OMD[disco]:~$† printf "GET hosts\nFilter: state = 1\nColumns: name comments\n"|unixcat /omd/sites/disco/tmp/run/live


OMD[disco]:~$ printf 'GET comments\nColumns: comment_id comment\n' | unixcat /omd/sites/disco/tmp/run/live

3;i bi hi

4;i kos ned oft gnou sogn, i bi hi

OMD[disco]:~$ printf 'GET comments\nColumns: comment_id comment\nFilter: comment_id = 3\n' | unixcat /omd/sites/disco/tmp/run/live

3;i bi hi


Von: Denis GERMAIN [mailto:dt.germain@gmail.com]
Gesendet: Mittwoch, 26. Oktober 2011 16:40
An: shinken-devel@lists.sourceforge.net
Betreff: [Shinken-devel] Slight problem with livestatus module with direct queries

Hello list,

For historic reporting purpose, we have a developper in our team that directly execute queries to the livestatus module via commands like
printf 'GET hosts\nFilter: state = 1' | nc 50000 > /data/ftptrace/nagios/thruk.txt
printf 'GET comments\nFilter comment_id = '$commid | nc 50000 | tail -1 | awk -F";" '{print $2}'

This gives us informations about hosts down which are then reformatted in a dusty old report sent to our client.
At the beginning we used only the first request for our report, as comments were directly available from the host information given by the query. After an update, we didn't realised that the comments were not directly in the query result, but only the comment ID (which I grant you is much more "clean")

1) Problem is that now, we need to query for the comments (selecting good comment ID) and that it constantly break livestatus module (which doesn't always manage to relaunch itself)

2) We also noted that when we use the Column statement (to select only the columns we need), the livestatus module instantly crash

I realise that our problem is a little exotic, as the vast majority of livestatus users only use it through Thruk, but if something could be done (or as already been done), we would be grateful (our developper mostly :-p)


PS: An example traceback. I don't have much more yet, we are running Shinken on production (I already see admins frowning eyes, but it's stable enough if you don't try strange things like us) and my manager don't really like us crashing it on purpose. We'll try to reproduce on preproduction ASAP, but if this can help pinpointing the issue...

[1319536549] [broker-1] Traceback (most recent call last):
† File "/usr/lib/python2.6/site-packages/shinken/modules/livestatus_broker/livestatus_broker.py", line 828, in main
††† self.do_main()
† File "/usr/lib/python2.6/site-packages/shinken/modules/livestatus_broker/livestatus_broker.py", line 1052, in do_main
††† response, keepalive = self.livestatus.handle_request(open_connections[socketid]['buffer'])
† File "/usr/lib/python2.6/site-packages/shinken/modules/livestatus_broker/livestatus.py", line 129, in handle_request
††† request.parse_input(data)
† File "/usr/lib/python2.6/site-packages/shinken/modules/livestatus_broker/livestatus_request.py", line 96, in parse_input
††† query.parse_input('\n'.join(query_cmds))
† File "/usr/lib/python2.6/site-packages/shinken/modules/livestatus_broker/livestatus_query.py", line 259, in parse_input
††† self.filter_stack.put(self.make_filter(operator, attribute, reference))
† File "/usr/lib/python2.6/site-packages/shinken/modules/livestatus_broker/livestatus_query.py", line 786, in make_filter
††† converter = self.find_converter(attribute)
† File "/usr/lib/python2.6/site-packages/shinken/modules/livestatus_broker/livestatus_query.py", line 102, in find_converter
††† out_map = LSout_map[self.out_map_name]
KeyError: 'hosts'

The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
Shinken-devel mailing list