External Commands and XI
-
gpburdell93
- Posts: 8
- Joined: Wed Feb 12, 2014 3:36 pm
External Commands and XI
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
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
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: External Commands and XI
It does, one thing of note is that in XI the command pipe is located at
/usr/local/nagios/var/rw/nagios.cmd
/usr/local/nagios/var/rw/nagios.cmd
-
gpburdell93
- Posts: 8
- Joined: Wed Feb 12, 2014 3:36 pm
Re: External Commands and XI
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.
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.
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: External Commands and XI
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
Also are you seeing any entries for unknown commands, hosts or services in the nagios.log or /var/log/messages?
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 > $commandfileNagios-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.
-
gpburdell93
- Posts: 8
- Joined: Wed Feb 12, 2014 3:36 pm
Re: External Commands and XI
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.
No, there are no errors in the messages log.
Like I said--data pumped into the nagios.cmd file just disappears without a trace.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: External Commands and XI
If you want to see them in the log you will need to set the following in the /usr/local/nagios/etc/nagios.cfg
Then you should see the command being processed when you run
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)
Code: Select all
log_external_commands=1Code: Select all
tail -f /usr/local/nagios/var/nagios.log-
gpburdell93
- Posts: 8
- Joined: Wed Feb 12, 2014 3:36 pm
Re: External Commands and XI
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
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.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)
-
gpburdell93
- Posts: 8
- Joined: Wed Feb 12, 2014 3:36 pm
Re: External Commands and XI
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
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
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: External Commands and XI
Awesome, Bulk Modifications are very handy.