ConfigurationNagiosMany configurations are required, such as configuring contacts and contact groups.
By default, all Nagios configuration files are located in the/etc/nagios directory. For convenience, the configuration file symbols related to Apache may be linked to the Apache configuration directory. The configuration can be divided into multiple files, each of which is used for different parts of the configuration.
The first component to be set is the contact and Contact Group. Contacts are those who receive notifications about the stopping of the host or service. By default, Nagios provides pager and email notification methods. By using extensions, you can use Jabber and many other methods to send notifications, which is convenient in some cases.
The contact is stored in the contacts. cfg file and defined as follows:
Listing 1. Configuration 1: Basic contact information
- define contact{
-
- contact_name jdoe
-
- alias John Due
-
- service_notification_commands notify-by-email
-
- host_notification_commands host-notify-by-emailes
-
- email john.doe@yourcompany.com
-
- }
-
Group contacts: when the host or service status changes, Nagios does not specify the person to be notified, but notifies the relevant group. Sometimes you can even define a person multiple times to specify different notification commands or addresses, then, add all the methods to contact the user in the contact group (see list 2 ).
Listing 2. Configuration 2: group contacts
- define contactgroup{
-
- contactgroup_name server-admins
-
- alias Server Administrators
-
- members jdoe,albundy
-
- }
-
The next step is to configure the host to be monitored by Nagios. You should add all hosts that contain services that monitor or check whether they are active. The configuration file for storing host information is hosts. cfg. The following is an example of a host definition: