Adding new services
Home > CentOS > CentOS 6.x > Monitoring tools > Nagios configuration > Adding new services
Nagios services are configured using plugins from /usr/lib64/nagios/plugins folder. Various executables present here such as check_dns, check_tcp, etc. can be used to configure various types of service checks.
The command definitions for services are mentioned in /etc/nagios/objects/commands.cfg file. Example command definition is:
define command{ command_name check_tcp command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$ }
This means that if service_command is specified as "check_tcp!636!-S" then it would result into running "check_tcp -H <Address> -p 636 -S" where <Address> would come from host_name specified as part of service definition. For every host_name there is corresponding host entry with address for given host.
Thus if we want to add checks for dns using check_dns plugin then we can add following configuration to command.cfg file:
define command{ command_name check_dns command_line $USER1$/check_dns -s $HOSTADDRESS$ -H $ARG1$ $ARG2$ }
After this the service definition to check DNS resolution from a DNS server may look like:
define service{ use generic-service; host_name ns1 service_description DNS-www.google.co.in check_command check_dns!www.google.co.in notifications_enabled 1 } define service{ use generic-service; host_name ns1 service_description DNS-sbarjatiya.com check_command check_dns!sbarjatiya.com notifications_enabled 1 }
to make nagios periodically verify that DNS is able to resolve both Internet addresses (www.google.co.in) as well as local domains (sbarjatiya.com).
Home > CentOS > CentOS 6.x > Monitoring tools > Nagios configuration > Adding new services