Nagios 3 File Locations on CentOS

by Mike on March 6, 2009

in Nagios

Review File Locations
There are a number of files that you should review, both their location and their content.  It is important that you review these because if you change a file location you may have to modify a number of additional files that depend on that location.

Main Configuration File
The main configuration file for nagios is /etc/nagios/nagios.cfg.  This is the file that contains paths to the other configuration files.

Configuration Directory

The directory /etc/nagios/objects contains much of the information needed for modify objects.

commands.cfg  contacts.cfg  localhost.cfg  printer.cfg  switch.cfg  templates.cfg  timeperiods.cfg  windows.cfg

Review the contents of each of these files.  If you change the name of any you will need to make changes to at least the nagios.cfg, possibly others.

Log File
An archives directory is created in /var/log/nagios and the main log is here:

Resource File

Plugins and CGIs
The scripts for plugins and the cgi files that provide data for the web interface are found here:

cgi  plugins

Here is the default list of plugins:
check_apt       check_dns       check_http          check_ldaps        check_nagios    check_oracle  check_rpc      check_swap   eventhandlers
check_breeze    check_dummy     check_ide_smart     check_load         check_nntp      check_overcr  check_sensors  check_tcp    negate
check_by_ssh    check_file_age  check_ifoperstatus  check_log          check_nntps     check_pgsql   check_simap    check_time
check_clamd     check_flexlm    check_ifstatus      check_mailq        check_nt        check_ping    check_smtp     check_udp    urlize
check_cluster   check_fping     check_imap          check_mrtg         check_ntp       check_pop     check_snmp     check_ups
check_dig       check_ftp       check_ircd          check_mrtgtraf     check_ntp_peer  check_procs   check_spop     check_users
check_disk      check_game      check_jabber        check_mysql        check_ntp_time  check_radius  check_ssh      check_wave   utils.pyc
check_disk_smb  check_hpjd      check_ldap          check_mysql_query  check_nwstat    check_real    check_ssmtp    contrib

Notice there is a directory called contrib and it contains contributed plugins.                     check_fan_cpq_present                check_fan_fsc_present                                  check_frontpage                     check_hltherm.c                                         check_http-with-client-certificate.c                    
check_cluster               check_temp_cpq
check_cluster2      check_nmap.pyc            check_temp_fsc
check_cluster2.c       check_timeout
check_cluster2.README                       check_oracle_tbs          check_timeout.c
check_cluster.c          check_ipxping.c                        
check_cpqarray.c                          check_pcpmetric.pyc       check_uptime.c                   check_pfstate                                           check_rbl.c     

Apache Web Interface

The web interface contains the settings necessary for the Internet access.  The stylesheets provides css files that can be used to modify the settings for the  web interface.  These are found in /usr/share/nagios//stylesheets.  You will also find the images for the web interface in the images directory and the contexthelp will contain the help files that you can modify.  Everything that you need to modify the way it looks is found here.

contexthelp  docs  images  index.html  main.html  media  robots.txt  side.html  ssi  stylesheets

Apache Server Modifications
Nagios will need to set up a directory that requires authentication and some modifications to the cgi-scripts.  These changes will be found in a file located in the /etc/httpd/conf.d directory called nagios.conf.  Here you can see listed the ScriptAlias so nagios can use cgi scripts and the directory for authentication.  Note that if you want to change the database name for the web interface users you can modify the name “htpasswd.users” and be sure to use the exact name in /etc/nagios when you create the database.

# Last Modified: 11-26-2005
# This file contains examples of entries that need
# to be incorporated into your Apache web server
# configuration file.  Customize the paths, etc. as
# needed to fit your system.

ScriptAlias /nagios/cgi-bin “/usr/lib/nagios/cgi”

<Directory “/usr/lib/nagios/cgi”>
#  SSLRequireSSL
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
#  Order deny,allow
#  Deny from all
#  Allow from
AuthName “Nagios Access”
AuthType Basic
AuthUserFile /etc/nagios/htpasswd.users
Require valid-user

Alias /nagios “/usr/share/nagios”

<Directory “/usr/share/nagios”>
#  SSLRequireSSL
Options None
AllowOverride None
Order allow,deny
Allow from all
#  Order deny,allow
#  Deny from all
#  Allow from
AuthName “Nagios Access”
AuthType Basic
AuthUserFile /etc/nagios/htpasswd.users
Require valid-user

That covers the basic file locations, be sure to review these as they will be very important for your system development.

Previous post:

Next post: