When using the latest nagios (4.1.1) on Ubuntu Precise 64 with Python 2.7.3, I get the following error when trying to start the API:
vagrant@precise64:~/nagios-api$ sudo ./nagios-api -p 3000 -c /usr/local/nagios/var/rw/nagios.cmd -s /usr/local/nagios/var/status.dat -l /usr/local/nagios/var/nagios.log &
[2] 25705
vagrant@precise64:~/nagios-api$ [2016/07/15 16:49:57] {diesel} INFO:Listening on port 3000, starting to rock and roll!
[2016/07/15 16:49:57] {diesel} WARNING:Starting diesel <hand-rolled select.epoll>
-1
You appear to have handed me a malformed status file - possibly the state retention file. Please check your arguments and try again.
[2016/07/15 16:49:57] {diesel} WARNING:-- SystemExit raised.. exiting main loop --
Cleaning up PID.
Exiting.
Exception KeyError: KeyError(139771800704768,) in <module 'threading' from '/usr/lib/python2.7/threading.pyc'> ignored
[2]- Done sudo ./nagios-api -p 3000 -c /usr/local/nagios/var/rw/nagios.cmd -s /usr/local/nagios/var/status.dat -l /usr/local/nagios/var/nagios.log
I hacked around a bit, and found that this line in ./nagios/core.py was failing:
if line.find("NAGIOS STATE RETENTION FILE") is not -1.0:
It seems that the version of string.find in this python version returns a -1 (non-float) and that caused the API to assume that it was the retention file by mistake. Maybe casting the output would ensure that the result is standardized among versions? Happy to submit a pull request if you'd like.
Hi,
When using the latest nagios (4.1.1) on Ubuntu Precise 64 with Python 2.7.3, I get the following error when trying to start the API:
I hacked around a bit, and found that this line in ./nagios/core.py was failing:
It seems that the version of string.find in this python version returns a -1 (non-float) and that caused the API to assume that it was the retention file by mistake. Maybe casting the output would ensure that the result is standardized among versions? Happy to submit a pull request if you'd like.
Thanks!