- Nagios - Discussion
- Nagios - Useful Resources
- Nagios - Quick Guide
- Nagios - Case Study
- Nagios - V Shell
- Nagios - NRPE
- Nagios - Add-ons/Plugins
- Nagios - Ports and Protocols
- Nagios - Checks and States
- Nagios - Commands
- Nagios - Hosts and Services
- Nagios - Applications
- Nagios - Features
- Nagios - Configuration
- Nagios - Installation
- Nagios - Products
- Nagios - Architecture
- Nagios - Overview
- Nagios - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Nagios - Configuration
In the previous chapter, we have seen the installation of Nagios. In this chapter, let us understand its configuration in detail.
The configuration files of Nagios are located in /usr/local/nagios/etc. These files are shown in the screenshot given below −
Let us understand the importance of each file now −
nagios.cfg
This is the main configuration file of Nagios core. This file contains the location of log file of Nagios, hosts and services state update interval, lock file and status.dat file. Nagios users and groups on which the instances are running are defined in this file. It has path of all the inspanidual object config files pke commands, contacts, templates etc.
cgi.cfg
By default, the CGI configuration file of Nagios is named cgi.cfg. It tells the CGIs where to find the main configuration file. The CGIs will read the main and host config files for any other data they might need. It contains all the user and group information and their rights and permissions. It also has the path for all frontend files of Nagios.
resource.cfg
You can define $USERx$ macros in this file, which can in turn be used in command definitions in your host config file(s). $USERx$ macros are useful for storing sensitive information such as usernames, passwords, etc.
They are also handy for specifying the path to plugins and event handlers - if you decide to move the plugins or event handlers to a different directory in the future, you can just update one or two $USERx$ macros, instead of modifying a lot of command definitions. Resource files may also be used to store configuration directives for external data sources pke MySQL.
The configuration files inside objects directory have are used to define commands, contacts, hosts, services etc.
commands.cfg
This config file provides you with some example command definitions that you can refer in host, service, and contact definitions. These commands are used to check and monitor hosts and services. You can run these commands locally on a Linux console where you will also get the output of the command you run.
Example
define command { command_name check_local_disk command_pne $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$ } define command { command_name check_local_load command_pne $USER1$/check_load -w $ARG1$ -c $ARG2$ } define command { command_name check_local_procs command_pne $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$ }
contacts.cfg
This file contains contacts and groups information of Nagios. By default, one contact is already present Nagios admin.
Example
define contact { contact_name nagiosadmin use generic-contact apas Nagios Admin email avi.dunken1991@gmail.com } define contactgroup { contactgroup_name admins apas Nagios Administrators members nagiosadmin }
templates.cfg
This config file provides you with some example object definition templates that are referred by other host, service, contact, etc. definitions in other config files.
timeperiods.cfg
This config file provides you with some example timeperiod definitions that you can refer in host, service, contact, and dependency definitions.
Advertisements