Nagios external commands getting processed intermittently

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
sidd
Posts: 2
Joined: Mon Jun 16, 2014 8:43 pm

Nagios external commands getting processed intermittently

Post by sidd »

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 -

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()
The Nagios log shows that the comment was read -

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
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Nagios external commands getting processed intermittentl

Post by sreinhardt »

How long have you been running this script, and how long has it been having issues? Have you made any changes, updates, etc since the issues started?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
sidd
Posts: 2
Joined: Mon Jun 16, 2014 8:43 pm

Re: Nagios external commands getting processed intermittentl

Post by sidd »

I just started yesterday. It seems the problem is not with the scripts but the way the hosts are setup in Nagios or something. When I issue an external command just to a single host that is having issues with comments, to delete all comments, it doesn't work. Same thing with the WebUI. The "Delete all comments" for certain hosts doesn't work. I can delete comments using comment ids.

I ended up getting the comment ids using live status and writing a script around that.

I don't have the rights to change the debug mode for Nagios otherwise I would have posted 128 debug level.
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Nagios external commands getting processed intermittentl

Post by eloyd »

"And nothing's changed."
I know you didn't say that, but that's something I hear all the time. :mrgreen:

It's time to start figuring out what changed on your system. Does the package updater run automatically, possibly having changed one of the packages on your machine? Did your code repository get updated and now your shell script is broken? Lots of things along those lines. Also, make sure you're not running out of disk space and/or quota on the filesystem.

These are long shots, but if it was working and now it's not working, then something changed. Figure out what that was.
Last edited by eloyd on Thu Jun 26, 2014 1:59 pm, edited 1 time in total.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Nagios external commands getting processed intermittentl

Post by slansing »

Hey sidd,

Did you come up with anything? Find out who may have altered system level options?
Locked