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:
/var/log/nagios/nagios.log

Resource File
/etc/nagios/resource.cfg

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

/usr/lib/nagios
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   plugins.pm
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    utils.pm
check_dig       check_ftp       check_ircd          check_mrtgtraf     check_ntp_peer  check_procs   check_spop     check_users  utils.py
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      utils.sh

Notice there is a directory called contrib and it contains contributed plugins.

check_adptraid.sh        check_email_loop.pl                   check_lotus.pl            check_remote_nagios_status.pl
check_apache.pl          check_fan_cpq_present                 check_maxchannels.pl      check_rrd_data.pl
check_apc_ups.pl         check_fan_fsc_present                 check_maxwanstate.pl      check_sap.sh
check_appletalk.pl       check_flexlm.pl                       check_mem.pl              check_smart.pl
check_arping.pl          check_frontpage                       check_ms_spooler.pl       check_smb.sh
check_asterisk.pl        check_hltherm.c                       check_mssql.sh            check_snmp_disk_monitor.pl
check_axis.sh            check_hprsc.pl                        check_nagios_db_pg.pl     check_snmp_printer.pl
check_backup.pl          check_http-with-client-certificate.c  check_nagios_db.pl        check_snmp_process_monitor.pl
check_bgpstate.pl        check_hw.sh                           check_nagios.pl           check_snmp_procs.pl
check_breeze.pl          check_ica_master_browser.pl           check_netapp.pl           check_sockets.pl
check_cluster            check_ica_metaframe_pub_apps.pl       check_nmap.py             check_temp_cpq
check_cluster2           check_ica_program_neigbourhood.pl     check_nmap.pyc            check_temp_fsc
check_cluster2.c         check_inodes-freebsd.pl               check_oracle_instance.pl  check_timeout
check_cluster2.README    check_inodes.pl                       check_oracle_tbs          check_timeout.c
check_cluster.c          check_ipxping.c                       check_ora_table_space.pl  check_traceroute.pl
check_compaq_insight.pl  check_javaproc.pl                     check_pcpmetric.py        check_traceroute-pure_perl.pl
check_cpqarray.c         check_joy.sh                          check_pcpmetric.pyc       check_uptime.c
check_digitemp.pl        check_linux_raid.pl                   check_pfstate             check_vcs.pl
check_dlswcircuit.pl     check_lmmon.pl                        check_qmailq.pl           check_wave.pl
check_dns_random.pl      check_log2.pl                         check_rbl.c               check_wins.pl


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.

/usr/share/nagios
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.

#SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER
# 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 127.0.0.1
AuthName “Nagios Access”
AuthType Basic
AuthUserFile /etc/nagios/htpasswd.users
Require valid-user
</Directory>

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 127.0.0.1
AuthName “Nagios Access”
AuthType Basic
AuthUserFile /etc/nagios/htpasswd.users
Require valid-user
</Directory>

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: