Configuring Nagios host files according to our conventions:
A detailed explanation on the Nagios configuration can be found here: http://nagios.sourceforge.net/docs/3_0/monitoring-publicservices.html.
If we want to configure Nagios to monitor a particular host, and some of its services. The most likely approach would be to create a config file in the NAGIOS_HOME/conf.d folder. That file would contain, at least, the host(s) definition:
use generic-host ; Inherit default values from a template
host_name remotehost ; The name we're giving to this host
alias Some Remote Host ; A longer name associated with the host
address 192.168.1.50 ; IP address of the host
hostgroups allhosts ; Host groups this host is associated with
This defines that Nagios should monitor a host with an IP of 192.168.1.50, and it's identified by the host_name of remoteHost.
Configuring Nagios host files to monitor services:
In its turn, setting up Nagios to monitor a particular host's services is done by defining, on the same file usually, the following. Consider we want to monitor the host's HTTP service.
If no command is already available to monitor HTTP (most releases already have this available out of the box), we must define:
command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
Additionally, we have to configure a service that will use the previous command to perform some sort of monitoring. In this particular case, to monitor the health of an HTTP service:
use generic-service ; Inherit default values from a template
The user may build upon this simplified scenario, but must be always aware of the previously mentioned caveat.