zorkian / nagios-api

A REST-like, JSON interface to Nagios
BSD 3-Clause "New" or "Revised" License
586 stars 173 forks source link

on nagios-api startup, AttributeError: 'NoneType' object has no attribute 'attach_comment' #17

Closed rincebrain closed 11 years ago

rincebrain commented 11 years ago

I'm reasonably confident I'm not calling it wrong.

$ nagios-api -c '/var/nagios/rw/nagios.cmd' -s /var/nagios/retention.dat -l /var/log/nagios/nagios.log -p 8080 [2013/01/04 19:56:50] {diesel} INFO:Listening on port 8080, starting to rock and roll! [2013/01/04 19:56:50] {diesel} WARNING:Starting diesel <hand-rolled select.epoll> [2013/01/04 19:56:50] {diesel} ERROR:-- Unhandled Exception in local loop <<function read_status at 0x1ae0410>> -- Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/diesel/core.py", line 178, in run self.loop_callable(*self.args, **self.kw) File "/usr/bin/nagios-api", line 742, in read_status NAGIOS = Nagios(statusfile) File "/usr/lib/python2.6/site-packages/nagios/core.py", line 21, in __init__ self._update(statusfile) File "/usr/lib/python2.6/site-packages/nagios/core.py", line 81, in _update self.host_or_service(c.host, c.service).attach_comment(c) AttributeError: 'NoneType' object has no attribute 'attach_comment' [2013/01/04 19:56:50] {diesel} WARNING:(Keep-Alive loop <Loop id=1 callable=<function read_status at 0x1ae0410>> died; restarting) [2013/01/04 19:56:50] {diesel} ERROR:-- Unhandled Exception in local loop <<function read_status at 0x1ae0410>> -- Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/diesel/core.py", line 178, in run self.loop_callable(*self.args, **self.kw) File "/usr/bin/nagios-api", line 742, in read_status NAGIOS = Nagios(statusfile) File "/usr/lib/python2.6/site-packages/nagios/core.py", line 21, in __init__ self._update(statusfile) File "/usr/lib/python2.6/site-packages/nagios/core.py", line 81, in _update self.host_or_service(c.host, c.service).attach_comment(c) AttributeError: 'NoneType' object has no attribute 'attach_comment' [2013/01/04 19:56:50] {diesel} WARNING:(Keep-Alive loop <Loop id=1 callable=<function read_status at 0x1ae0410>> died; restarting) [2013/01/04 19:56:50] {diesel} WARNING:-- KeyboardInterrupt raised.. exiting main loop -- [2013/01/04 19:56:50] {diesel} INFO:Ending diesel application

Nagios 3.4.1, Python 2.6, latest Git for nagios-api (898e...bec2)

rincebrain commented 11 years ago

Relevant segment of the retention.dat file: servicecomment { host_name=localhost service_description=HTTP entry_type=4 comment_id=1 source=0 persistent=0 entry_time=1342718407 expires=0 expire_time=0 author=Nagios Admin comment_data=Duh? No content here. }

zorkian commented 11 years ago

Closing; I think you already know, but you should use "-s status.dat" not the retention file.