Configure Nagios
Server Training - Nagios

Create your host and service entries in the /etc/nagios/objects/routers.cfg.  The first thing to do is modify the /etc/nagios/nagios.cfg to create the correct path.  This line was added.

cfg_file=/etc/nagios/objects/routers.cfg

 

Lesson 5 | Lesson 7

 

Basic Nagios Training PDF

Create the routers.cfg file in the objects directory.  Here you can see that the host is using a generic-switch which is basic information that can be used for switches and routers.  Define the router as in other hosts that you have defined and then define the service.  Note that from the information you gained using snmpwalk you know that you do not want the information from (other 1) so you add the “!1” on the end of the command.

define host{
use             generic-switch
host_name       cisco2500
alias           cisco router
address         192.168.5.221
}
define service{
use             generic-service
host_name       cico2500
service_description     interfaces
check_command           check_ifstatus!1

Because the command does not exist you must also create the command so you will open the commands.cfg file to create it.  Here $USER1$ describes a path to the plugins directory as defined in the /etc/nagios/resources.cfg.  The check_ifstatus is a plugin already provided and then you have the host address and the community string of public.  The “-x” is so that you can note list the  output of the (other 1) interface.  The $ARG1$ corresponds to the “1” of the “other” interface that you want to eliminate.

# snmp Commands
define command{
command_name    check_ifstatus
command_line    $USER1$/check_ifstatus -H $HOSTADDRESS$ -C public -x $ARG1$
}

Create your host and service entries in the /etc/nagios/objects/routers.cfg.  The first thing to do is modify the /etc/nagios/nagios.cfg to create the correct path.  This line was added.

cfg_file=/etc/nagios/objects/routers.cfg

Create the routers.cfg file in the objects directory.  Here you can see that the host is using a generic-switch which is basic information that can be used for switches and routers.  Define the router as in other hosts that you have defined and then define the service.  Note that from the information you gained using snmpwalk you know that you do not want the information from (other 1) so you add the “!1” on the end of the command.

define host{
use             generic-switch
host_name       cisco2500
alias           cisco router
address         192.168.5.221
}
define service{
use             generic-service
host_name       cisco2500
service_description     Uptime
check_command           check_snmp!-C public -o sysUpTime.0
}
define service{
use             generic-service
host_name       cisco2500
service_description     interfaces
check_command           check_ifstatus!1
}
define service{
use             generic-service
host_name       cisco2500
service_description     PING
check_command           check_ping!200.0,20%!600.0,60%
normal_check_interval   5
retry_check_interval    1
}

Because the command does not exist you must also create the command so you will open the commands.cfg file to create it.  Here $USER1$ describes a path to the plugins directory as defined in the /etc/nagios/resources.cfg.  The check_ifstatus is a plugin already provided and then you have the host address and the community string of public.  The “-x” is so that you can note list the  output of the (other 1) interface.  The $ARG1$ corresponds to the “1” of the “other” interface that you want to eliminate.

# snmp Commands
define command{
command_name    check_ifstatus
command_line    $USER1$/check_ifstatus -H $HOSTADDRESS$ -C public -x $ARG1$
}

 

Other Links for Help

Set Up Nagios
Notifications
Web Interface
Report Limits
Monitor Windows Machines
Testing Connections
File Locations
Monitor Printers
NRPE
Monitor Linux Boxes
Respond to Problems