NagiosExchange
NagiosForge
NagiosWiki
Nagios Community Platform powered by NETWAYS

HowTos:HowTo

Search  
From NagiosWiki
Jump to: navigation, search

Contents


How To Test your Plugins

It is easy to test your plugin before actually using it. Just be sure to do it the same way that Nagios would do it. The easiest way to ensure this is to be the Nagios user.

For example:

nagios@nagioswiki.org:~/
su - nagios
cd /tmp
/usr/local/nagios/libexec/check_icmp -H www.nagioswiki.org ; echo "Plugin Return Code: $?"

However please note the following

  • Perl plugins may react differently in nagios if the embedded perl interpreter is enabled
  • Environmental macros ($NAGIOS_XXX variables) will not be available


How To Define a Command

Use the plugin as a Nagios check command as follows with a dynamic host address:

nagios@nagioswiki.org:~/
define command{
command_name   check_icmp
command_line   $USER1$/check_icmp -H $HOSTADDRESS$
}


How To Define a Service

Define a Nagios service to actually use the check_icmp command:

nagios@nagioswiki.org:~/
define service{
host_name             nagioswiki_server
service_description   www.nagioswiki.org icmp echo
check_command         check_icmp
}