[Nagiosplug-devel] How to run a shell script in nagios repeatedly

Thomas Guyot-Sionnest dermoth at aei.ca
Thu Apr 12 14:34:48 CEST 2007

On 12/04/07 07:39 AM, VamseeDeep wrote:
> Hi,
> I am interested in using nagios.
> My problem is :
> I would like to execute a shell script program in nagios repeatedly with
> some time period.
> I don't want to keep this script(what ever i required for execute) in
> /etc/crontab file.I would like to run a script with nagios only.
> I am using Nagios 2.6, plugins are 1.4.0.
> Please help me to solve this problem,Give detailed information on how to
> overcome this problem.

This is fairly simple; you may want to look at the documentation for
object syntax:


First create a check command that contain the actual command-line and
arguments. Then create an active service definition that use that check
command, and set the check interval to the interval to what you want to
run the script at.

Please keep in mind however that Nagios does not guarantee your script
will be run exactly at the defined interval. This can be especially true
for huge setups if many hosts are down or if Nagios is misconfigured. I
wouldn't use it as a crontab replacement. If you want the results of
your crontabs in nagios I'd rather do passive monitoring with NSCA.

Also note that anything run by Nagios is run as user nagios, so if your
scripts needs root privileges you will need to use sudo.


More information about the Devel mailing list