Page 1 of 2

Script Execution Via Nagios

Posted: Fri Sep 20, 2013 12:58 am
by lafargeuser
Using Nagios Can I able to execute script from Nagios ?
Can I push script to endpoint using Nagios ?

If yes how do I do that. Any document or method is available in Nagios.

Re: Script Execution Via Nagios

Posted: Fri Sep 20, 2013 11:23 am
by sreinhardt
Could you explain a bit more what you are looking to do, and on what type of devices? Yes nagios absolutely can run scripts, just place them in the /usr/local/nagios/libexec directory and apply the correct permissions. Setup a service and command definition and let it go! As for pushing things, that definitely needs a bit more clarification as stated above.

Re: Script Execution Via Nagios

Posted: Mon Sep 30, 2013 8:54 am
by lafargeuser
Actually, My Prominent purpose is to deploy scripts remotely on monitoring nodes using Nagios & execute it from Nagios.

Re: Script Execution Via Nagios

Posted: Mon Sep 30, 2013 9:09 am
by slansing
Yes, this is what agent such as NRPE are for. I would install this on the remote system and use it to execute the plugins.

http://nagios.sourceforge.net/docs/nrpe/NRPE.pdf

Re: Script Execution Via Nagios

Posted: Mon Sep 30, 2013 9:14 am
by tmcdonald
Just to clarify, there is not a way I know of in Nagios to push scripts to hosts that do not already have some sort of client-side software running on them to allow this. This is not a limitation of Nagios, but rather a security feature of most operating systems. It would be scary if just anyone could run scripts on your computer!

Re: Script Execution Via Nagios

Posted: Fri Oct 04, 2013 7:57 am
by lafargeuser
If I placed a shell scirpt on end point & want to call it from Nagios. How Do I do that using Nagios.

Re: Script Execution Via Nagios

Posted: Fri Oct 04, 2013 9:55 am
by slansing
You would install NRPE on the remote host, define a command within the nrpe.cfg file to call that plugin. Then call the command remotely from Nagios passing any arguments you require.

Re: Script Execution Via Nagios

Posted: Sat Oct 05, 2013 5:43 am
by lafargeuser
How Do I do that for Windows hosts ?

Can Nagios able to execute powershell script on windows machine.

Re: Script Execution Via Nagios

Posted: Mon Oct 07, 2013 8:09 am
by lafargeuser
#!/bin/bash
service=httpd

if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
then
echo "$service is running!!!"
else
/etc/init.d/$service start
fi



I have placed this script /usr/local/nagios/libexec/ On nagios server & wants to call it from Nagios.
If I stopped httpd service on one of my Unix Box & run this script from Nagios server that service should gets start as per script.

what is the procedure is it I have to placed this script on monitored node which is being monitored by Nagios & How do I call that script from Nagios.

Can you pls. elaborate this

just place them in the /usr/local/nagios/libexec directory and apply the correct permissions. Setup a service and command definition and let it go! As for pushing things, that definitely needs a bit more clarification as stated above.

Re: Script Execution Via Nagios

Posted: Mon Oct 07, 2013 9:11 am
by slansing
You are hopping around quite a bit, are you still interested in windows monitoring.......? To set that script up to restart a service on a remote host follow this guide:

http://assets.nagios.com/downloads/nagi ... h_NRPE.pdf