How can I manually run a nagios check from the command line?

When defining and testing new services in nagios I have been restarting nagios, then clicking the service, and rescheduling a check for as soon as possible, then waiting until the check happens.

Is there a more efficient way to do this? I'd like to use the command line to run that particular check and get the output.


Sometimes I find it tricky figuring out exactly what a plugin is doing. To figure this out I set nagios into debug mode with the configuration like this. debug_level=2048 With nagios in debug mode I simply tail the debug_log file debug_file=/var/log/nagios3/nagios.debug. Force a check and you will see exactly how the command is being run. I wouldn't leave this setting on normally though, it is very verbose and fills your log file at a rapid rate.


It's pretty simple. Just cd (or not) into the plugins directory (this directory location varies, depending on how you've installed it, but check /usr/local/nagios, or /usr/lib/nagios).

Find the plugin you want to run (if you're not sure, compare what you see in your plugins directory on your Linux box with the plugins located here: http://exchange.nagios.org/directory/Plugins, or try running "./plugin-name -h" to get the help info about the plugin).

The method for using any of these "plugins" from the command line is the same as any other Linux script: Just run "./plugin-name" with the appropriate flags you want to check, and voila!