Tips for using Nagios

Glossary


Term
Definition
Active Check
Service check that is initiated by Nagios
Common Gateway Interface (CGI) Scripts

CGI Configuration File

Extended Information Configuration File
Additional information for the host that should be used by the CGI
Host Definition
server, workstation or device that resides on the network.
Object Configuration File
Host configuration file that defines what you want to  monitor and how you want to monitor it.
Passive Check
Service checks that are initiated/performed by an external application and sent to Nagios
Resource Files
Used to store user defined macros and other sensitive configuration information that is not available to the CGIs
Service Definition
Service that runs on the host

Location of Files

nagios.cfg   --> main configuration file - located in ./nagios/etc

./nagios/libexec  --> nagios perl plugins

Common Tasks

Checking a plugin from the command line:
Common plugins

Client Side Configuration


/usr/local/bin/netsaint_statd is perl script

kill -9 to stop it

nohup /usr/bin/perl ./netsaint_statd & to restart it.

OR check /etc/init.d (or /sbin/init.d on HP-UX) for start script


Server Side Configuration

./nagios/etc  --> location of nagios configuration files

each nagios check calls a plugin which is located in ./nagios/libexec

each plug in communicates directly with the server through the netsaint_statd daemon running on the remote server.  Edit the netsaint_statd perl script to make changes on the client


Passing status from external programs to Nagios (Passive Checks)

external command file - file that Nagios will check for commands to process (these are results from passive checks in the form of a Nagios command)
ncsa addon - daemon that allows results from remote hosts to be written to the external command file

1.  Enable external command checking in nagios.cfg
check_external_commands=1

2.  Specify external command file to check in nagios.cfg
command_file=<path>/<filename>

3.  Set permissions in the directory so that external programs can write to the command file

4.  Have the external program write it's results in the correct Nagios command

Format of PROCESS_SERVICE_CHECK_RESULT

[<timestamp>] PROCESS_SERVICE_CHECK_RESULT;<host_name>;<description>;<return_code>;<plugin_output>

timestamp - time_t format (seconds since the UNIX epoch)
host_name - short host name in the service definition
description - description of the service from the service definition
return_code - 0=OK, 1=WARNING, 2=CRITICAL, 3=UNKNOWN
plugin_output - text output of the service check

Troubleshooting

no lock file found in /usr/local/nagios/var/nagios.lock - look for a mistake in one of the .cfg files.