Page 1 of 1

External Commands and XI

Posted: Fri Feb 28, 2014 11:22 am
by gpburdell93
Does XI support External Commands via the nagios.cmd file like I see mentioned in so many pages?

I've fired dozens of commands at my Nagios XI nagios.cmd file, and even though the config files all seem to indicate that Nagios is configured to accept External Commands, nothing ever happens. I used the command templates from the old.nagios.org page.

The current setting is to poll this pipe 'as often as possible', but how often is that? Every second? Every minute? Once an hour?

Is there some log of this activity so I can begin debugging why it isn't working?

Assuming this is not actually supported by XI, how does everyone recommend making changes to hundreds or thousands of services in Nagios? Grinding through thousands of web-page clicks is not an efficient way to do this, but appears to be the only option offered.

Regards,

Chris

Re: External Commands and XI

Posted: Fri Feb 28, 2014 1:06 pm
by scottwilkerson
It does, one thing of note is that in XI the command pipe is located at
/usr/local/nagios/var/rw/nagios.cmd

Re: External Commands and XI

Posted: Fri Feb 28, 2014 1:28 pm
by gpburdell93
Sure, I'm writing the data to the correct nagios.cmd file. I've verified that the nagios daemon does have the pipe open, too.

When I send this into the FIFO:

[1393611791] CHANGE_MAX_SVC_CHECK_ATTEMPTS;host.subdomain.domain.com;Weblogic JMSRuntime;1

absolutely nothing happens.

How long should I have to wait before noticing the change? I've even gone so far as to restart the nagios daemon to no effect.

Re: External Commands and XI

Posted: Fri Feb 28, 2014 1:33 pm
by sreinhardt
Your submission looks correct, however could you try it via a shell script like this page suggests?

This would be the printf statement for your setup

Code: Select all

/bin/printf "[%lu] CHANGE_MAX_SVC_CHECK_ATTEMPTS;host.subdomain.domain.com;Weblogic JMSRuntime;1\n" $now > $commandfile
Also are you seeing any entries for unknown commands, hosts or services in the nagios.log or /var/log/messages?

Re: External Commands and XI

Posted: Fri Feb 28, 2014 1:36 pm
by gpburdell93
Yes, I was using the shell script, copied from the website. I just temporarily modified it to print to the screen whatever it was sending to the FIFO.

No, there are no errors in the messages log.

Like I said--data pumped into the nagios.cmd file just disappears without a trace.

Re: External Commands and XI

Posted: Fri Feb 28, 2014 1:45 pm
by scottwilkerson
If you want to see them in the log you will need to set the following in the /usr/local/nagios/etc/nagios.cfg

Code: Select all

log_external_commands=1
Then you should see the command being processed when you run

Code: Select all

tail -f /usr/local/nagios/var/nagios.log
One thing to note, these external commands are runtime commands and will take the top precedence, but will not change the values in the configuration for the service, so you will not see the changes anywhere in the UI, (they will appear in the status.dat file)

Re: External Commands and XI

Posted: Fri Feb 28, 2014 1:55 pm
by gpburdell93
OK, I had turned on debug_leve=1, so I went ahead and also changed the log_external_commands=1. I see the command recorded without error, but I think you got to the real gist of the problem with your statement
One thing to note, these external commands are runtime commands and will take the top precedence, but will not change the values in the configuration for the service, so you will not see the changes anywhere in the UI, (they will appear in the status.dat file)
So my next question is, how do I make permanent changes to the Nagios configs in bulk? I do wish the page with the External Command info had made explicit mention that the changes were temporary.

Re: External Commands and XI

Posted: Fri Feb 28, 2014 2:36 pm
by gpburdell93
OK, I've found the answer to my own question, just for anyone else coming along with the same problem.

Drill through the Nagios XI GUI to: Core Config Manager -> Tools -> Bulk Modifications -> Change A Single Config Option

there you can select the config option you'd like to change (in my case max_check_attempts), select the services or the hosts you'd like it applied to, and Save, then Apply as usual.

My thanks to the Nagios staff who commented on this topic.

Regards,

Chris

Re: External Commands and XI

Posted: Fri Feb 28, 2014 2:38 pm
by slansing
Awesome, Bulk Modifications are very handy.