Nagios external commands getting processed intermittently
Posted: Mon Jun 16, 2014 8:47 pm
I have a script that runs every 10 mins that updates the Host Comments field in Nagios. There are about 600 hosts and I am seeing some issues. The script deletes the previous comments and adds new ones. The issue I am seeing is that the comments are getting deleted intermittently.
I am using Nagios 3.2.2
Here is the script -
The Nagios log shows that the comment was read -
I am using Nagios 3.2.2
Here is the script -
Code: Select all
FILE = open("/var/log/nagios/rw/nagios.cmd","w")
NOW = int(time.time())
HOSTS = ["host1", "host2",etc]
for hosts in HOSTS:
DEL_COMMENT = "["+str(NOW)+"] DEL_ALL_HOST_COMMENTS;"+hosts+"\n"
FILE.write(DEL_COMMENT)
FILE.close()Code: Select all
[1402964971] EXTERNAL COMMAND: DEL_ALL_HOST_COMMENTS;host1
[1402964971] EXTERNAL COMMAND: DEL_ALL_HOST_COMMENTS;host2
[1402964971] EXTERNAL COMMAND: DEL_ALL_HOST_COMMENTS;host3