Slime: Learning Nagios (ii): Nagios configuration

Source: Internet
Author: User
Tags snmp switches egrep

This article consists of Su Yi Lin Feng provide sponsorship, starting in Slime Line the world

Once the Nagios installation is complete, we'll configure Nagios now. For Nagios installation, refer to the article "Slime: Learning Nagios (i): Nagios installation".

Description: To keep up with the Nagios version, we are using Nagios's latest version of NAGIOS-4.1.0RC1.

Note: The latest version of Nagios can see the PID it runs on a Web page.

First, Nagois monitoring objects

Nagios monitors more objects, and we can classify them from different granularity, which is divided into general objects and detailed objects.

1.1 General Objects

The general objects of Nagios monitoring can be categorized into two types: network services and host resources.

Network services include host (including network devices) survival status, Web services, FTP services, database services, custom services, and so on.

Host resources include system load, current number of IP links, disk space usage, current number of processes, custom resources, and so on.

1.2 Detailed Object

The detailed object for Nagios monitoring has the following objects:

Website monitoring, mainstream database monitoring, protocol monitoring, operating system monitoring, application monitoring, Application server monitoring, network monitoring, power environment monitoring, storage monitoring, mail monitoring, security monitoring, log monitoring, virtualization monitoring.

Website monitoring mainly includes website, website application, website content, HTTP, SSL and so on.

Mainstream database monitoring mainly includes MySQL, Oracle, DB2, MSSQL and so on.

Protocol monitoring mainly includes HTTP, DNS, FTP, SNMP, SMTP, SSH, LDAP, IMAP, POP, ICMP, DHCP, and so on.

Operating system monitoring mainly includes Linux, Windows, Unix, Solaris, AIX, HP-UX and so on.

Application monitoring mainly includes service, process and so on.

Application server monitoring mainly includes Tomcat, JBoss, Websphere, Weblogic, Java, JMX and so on.

Network monitoring mainly includes routers, switches, firewalls and so on.

Log monitoring mainly includes Windows event log, syslog, and so on.

Dynamic environment monitoring mainly includes temperature and humidity, smoke sensor, water immersion, dry contact, UPS, APC and so on.

If you want to learn more about the Nagios monitoring object, we can go to the Nagios website to view it. As follows:

Http://www.nagios.com/solutions

Two, Nagios monitoring method

Before we talked about Nagios monitoring, what are the ways we monitor these objects, that is, which monitoring vectors are used for monitoring?

Nagios provides us with a variety of monitoring methods that are more common with Nrpe, SNMP, and scripting.

The Nrpe approach has client software on both Windows and Linux, and SNMP requires the installation of SNMP-related components on Windows and Linux. We can use scripts such as Shell, Perl, and so on for the monitoring of script mode.

For the above three ways, it is recommended to choose according to the actual business. For example: to monitor the network equipment related situation, we generally through the SNMP way. For the OS, the most common way is through Nrpe and SNMP.

III. Nagios Notification method

The main purpose of monitoring is to promptly notify the relevant personnel when the monitored object fails or resources are tight so that the problem can be dealt with quickly.

Nagios provides us with at least 3 notification methods to facilitate our management efforts.

Web mode: the monitored object is viewed through a browser, and in its normal state, its status is filled with blue and an OK is displayed.

e-mail notification: When a failure occurs at the same time as the set number of retries and the detection interval, send an email to the administrator or related personnel, reporting the general situation of the problem.

Mobile SMS: This is very useful and timely features, once a malfunction, SMS can be timely reminders you.

In general, the three are carried out at the same time: working hours to open a browser to see the page display, timed to receive mail, mobile phone 24 hours online.

Iv. Nagios file Directory

After Nagios and its plug-ins are installed and configured, the entire directory hierarchy is as follows:

ll/usr/local/nagios/

The bin directory is used to store Nagios's execution programs, including Nagios, Nrpe, and so on.

The ETC directory is used to store Nagios configuration files.

The Libexec directory is used to store Nagios's monitoring plug-ins.

The Sbin directory is used to hold the Nagios CGI file, which is the directory where the files needed to execute the external command reside.

The share directory is used to store the Nagios Web page file, which is the directory where the Web pages are stored.

The Include directory is used to hold external calls to the Nagios CGI file.

The Var directory is used to store files such as Nagios log files, lock files, and so on.

Five. Nagios configuration file

After the Nagios directory is introduced, let's introduce the Nagios configuration file. The Nagios configuration file is in the/USR/LOCAL/NAGIOS/ETC directory by default.

5.1 Nagios Introduction to the configuration file

Look at the Nagios configuration file as follows:

/usr/local/nagios

Tree-l 2./etc/

Through, we can obviously see all the configuration files. Here is a description of each profile specific role. As follows:

Cgi.cfg the configuration file used to control CGI access.

Htpasswd.users files that are used to hold the Nagios administrator user name and password.

Nagios.cfg is the Nagios master profile, and all CFG profiles (except external calls) must be referenced in this file for the CFG configuration file to take effect.

The resource.cfg variable definition file, also known as a resource file. The variables defined in the file can be referenced by other configuration files, such as $user1$.

Objects is a directory in which files in this directory are primarily used to define Nagios's monitoring objects.

The commands.cfg is a definition file for the Nagios Monitoring command, where the defined commands can be referenced by other configuration files.

Contacts.cfg is a configuration file that defines the contact and contact groups that are notified when the Nagios monitoring object fails.

Localhost.cfg is a configuration file that defines the monitoring local host.

Templates.cfg is a template configuration file that defines hosts and services.

Timeperiods.cfg is a configuration file that defines the time period for nagios monitoring.

Services.cfg is the configuration content that stores the specific monitored services. The profile does not exist by default, it needs to be created by hand and is built in the Services directory. You also need to specify the services directory in the Nagios.cfg file. As follows:

Egrep-v "^#|^$" nagios.cfg

Cfg_dir=/usr/local/nagios/etc/services

The hosts.cfg stores the specific monitored host-related configuration. The profile does not exist by default, it needs to be created by hand and is built in the hosts directory. You also need to specify the hosts directory in the Nagios.cfg file. Is the same as the Services.cfg use method.

5.2 Nagios The relationship between configuration files

The configuration of nagios involves the definition of: Hosts, host groups, services, service groups, contacts, contact group, monitoring time, monitoring commands, etc. As you can see from these definitions, the Nagios profiles are all interconnected and referenced to each other.

To successfully configure a Nagios monitoring system, it is important to understand the dependencies and dependencies between the profiles, with four points:

First: Define which hosts, host groups, services, and service group to monitor.

Second: Define what command to use for this monitoring.

Third: Define the time period for monitoring.

IV: Define the contacts and contact groups to notify when there is a problem with the host or service.

5.2 cgi.cfg Document Introduction

The cgi.cfg file is a related CGI script used to control Nagios. If you want to execute related CGI scripts in the Nagios Web monitoring interface, such as restarting the Nagios process, turning off Nagios notifications, stopping Nagios host detection, and so on, you need to configure the Cgi.cfg file.

In the Slime: Learning Nagios (i): Nagios installation article, we've mentioned that Nagios default administrator is nagiosadmin.

If we want to add a new admin admin, we need to modify the Cgi.cfg file to add the user's relevant execution permissions. As follows:

Egrep-v "^#|^$" cgi.cfg

After the Cgi.cfg file has been modified, we also need to add the Admin user to the Htpasswd.users file using the htpasswd command. As follows:

HTPASSWD htpasswd.users Admin

Cat Htpasswd.users

5.3 nagios.cfg Document Introduction

Nagios.cfg is the master configuration file for Nagios, and the default path is/usr/local/nagios/etc/nagios.cfg. All object profiles must be defined in this file in order to play its role, just refer to the object configuration file in the Nagios.cfg file.

The content of the Nagios.cfg configuration file is much more, we only introduce the more important part here.

View the contents of the Nagios.cfg file as follows:

Egrep-v "^#|^$" nagios.cfg

Log_file=/usr/local/nagios/var/nagios.log

Used to define where Nagios creates its log files.

Description

The log_file variable is used to define where Nagios creates its log files. If you use the Nagios log polling feature, Nagios polls the logs hourly, daily, weekly, or monthly.

Cfg_file=/usr/local/nagios/etc/objects/commands.cfg

The configuration file used to define the Nagios monitoring command.

Description

The cfg_file variable is used to refer to the object configuration file, and if there are more object profiles, we just need to add it in the Nagios.cfg file.

The object configuration file typically contains definitions for hosts, host groups, contacts, contact groups, services, commands, and so on.

If you want Nagios to handle all the object profiles contained in a particular directory, then we can use the CFG_DIR directive. As shown below:

Cfg_dir=/usr/local/nagios/etc/services

Description

The Cfg_dir variable is used to refer to all object configuration files contained in a directory. All files in this directory that have a. cfg suffix will be treated as object configuration files.

In addition, Nagios will recursively return subdirectories under that directory and process all the configuration files under its subdirectories. You can also put the configuration in a different directory and use the Cfg_dir= statement to point to each directory you want to work with.

Cfg_file=/usr/local/nagios/etc/objects/contacts.cfg

The configuration file that references the Nagios contact.

Cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg

The configuration file used to refer to the Nagios monitoring window.

Cfg_file=/usr/local/nagios/etc/objects/templates.cfg

The template file used to reference the Nagios monitoring object.

Cfg_file=/usr/local/nagios/etc/objects/localhost.cfg

A configuration file that references the Nagios monitoring Local (Linux) host.

Resource_file=/usr/local/nagios/etc/resource.cfg

The resource_file variable is used to define the Nagios resource profile, and multiple resource files can be defined in nagios.cfg.

Status_file=/usr/local/nagios/var/status.dat

The status_file variable is used to define the Nagios state file, which holds the current state of Nagios, the outage information, and so on. It will be emptied and deleted every time Nagios restarts.

status_update_interval=10

The variable is used to define the update interval for the state file (that is, status.dat) in seconds, the minimum update interval is 1 seconds, and the default is 10 seconds.

Nagios_user=nagios

This variable specifies which user the Nagios process uses to run.

Nagios_group=nagios

This variable specifies which user group Nagios uses to run.

Check_external_commands=1

This variable is used to set whether Nagios is allowed to run CGI commands in the Web monitoring interface, that is, to allow Nagios to perform operations such as restarting Nagios, stopping the host, and service checking under the Web interface. Where 1 means allow, 0 means disallow.

Command_file=/usr/local/nagios/var/rw/nagios.cmd

Defines the files that Nagios uses to check External command requests. This file is also where the user action is submitted with the CGI command, so this file must be writable for the related service, typically for Apache host users. Also note that the permissions of the directory in which this file resides must be written by Apache, not just the file, because the file is frequently written and deleted at work.

Lock_file=/usr/local/nagios/var/nagios.lock

Defines the PID file that the Nagios runtime uses to save it.

Temp_file=/usr/local/nagios/var/nagios.tmp

Defines the Nagios temporary file path. It will be built, used, and deleted continuously during Nagios runtime.

Log_rotation_method=d

Defines the log polling method for Nagios, which is polled daily by default.

A value of n means none and polling is not done. A value of H represents hourly, polling hourly (the start of an hour). A value of D means daily, polling every day (midnight per day). A value of W represents weekly and is polled weekly (every Saturday night). A value of M represents monthly, which is polled every month (midnight of the last day of the month).

Log_archive_path=/usr/local/nagios/var/archives

Defines the archive path for the Nagios log.

Command_check_interval=10s

This variable is used to define the interval that Nagios detects for external commands, which defaults to 10 seconds. If this value does not add units, the default unit is minutes. For example, 1 means 1 minutes and Nagios is detected every minute.

Service_check_timeout=60

Defines the time-out period for service detection, which defaults to 60 seconds. If the service check time exceeds the defined time, it is displayed as the critical state.

Host_check_timeout=30

Defines the timeout period for host detection, which defaults to 30 seconds. If the host check time exceeds the defined time, the critical status is displayed.

Event_handler_timeout=30

Defines the maximum time to handle an event, which defaults to 30 seconds. If the event is processed for a maximum time beyond the defined time, Nagios issues a warning warning message and logs it to the log.

Notification_timeout=30

Defines the time interval at which notification information is sent, which defaults to 30 seconds.

Interval_length=60

This variable is used to define the units of the Nagios detection interval, which is 60 seconds, or 1 minutes. That is, in Nagios, the detection interval is measured in minutes by default.

This defines the time unit length that will be used elsewhere, and the default is minutes. When you define a host and a service in the configuration template file Templates.cfg, it is based on that value. As follows:

Egrep-v "^#|^$" templates.cfg

Check_interval 5

Retry_interval 1

Indicates that the check interval is 5*60s (5 minutes), which is checked every 5 minutes. The retry check interval is 1 minutes and the maximum retry check is 10 times.

Note: When Nagios is in OK State, it is monitored with check_interval defined intervals, and after a problem occurs, switches to retry_interval and max_check_attempts for monitoring when the number of retries reaches Max_check_ The attempts value triggers the first alarm, while the check_interval is monitored and the alarm is sent with the Notification_interval defined time interval. After the fault returns to normal, send the OK notification at the nearest Check_interval point to complete the alarm cycle.

For some highly sensitive service, this obviously does not meet our requirements, so it can be smaller, such as adjusted to 10 seconds:

Interval_length=10s

This improves the sensitivity of the check, but some services do not require such a high degree of sensitivity, such as disk space (which does not increase a bit), you can increase its value in the definition of check_interval.

Note: The sensitivity and false positive rate are proportional, the smaller the check interval, the more likely the false positives appear. Therefore, it is advisable to adjust the appropriate value according to the actual situation.

5.4 resource.cfg Document Introduction

RESOURCE.CFG is a variable definition file for Nagios, with only one line of file content. As follows:

$USER 1$=/usr/local/nagios/libexec

Where the variable $user1$ specifies the path to install the Nagios plug-in.

If you install the plugin on a different path, simply modify it here.

It is important to note that a variable must be defined before it can be referenced in another configuration file, and that variable is also defined by a macro.

An important feature of Nagios is the ability to use macros in the definition of a command line, and by defining macros, Nagios has the flexibility to get information about hosts, services, and other objects.

5.4.1 The mechanism of macro work

Before executing the command, Nagios will replace each macro in the command with the value that they should get. This macro substitution occurs when Nagios executes various types of macros. such as the detection of hosts and services, notifications, event processing, and so on.

5.4.2 Categories of Macros

Depending on the macro, we can divide the macro into: Default macro, on-demand macro, user-defined macro.

Default macro, take the host IP address macro as an example.

When a host or service macro is used in a command definition, the value used by the macro to execute will point to the value that the host or service takes.

Consider the following example, if a host object is used in the check_ping command definition, as follows:

Define Host{

HOST_NAME Ilanni

Address 192.168.1.247

Check_command check_ping}

Define Command{

Command_name check_ping

Command_line/usr/local/nagios/libexec/check_ping-h $HOSTADDRESS $ w 100.0,90%-C 200.0,60%}

The final execution of this host detection command is as follows:

/usr/local/nagios/libexec/check_ping-h 192.168.1.247-w 100.0,90%-C 200.0,60%

The beauty of Nagios macros is that you can use only one command definition to complete the detection of an infinite host, and each host can use the same command for detection, and the host address is correctly replaced before they are detected.

Command parameter macros

You can also pass parameters to the command, which ensures that the command definition is more generic. Parameters are defined in an object (like a host or a service), with a "!" To separate, such as this:

Define Service{

HOST_NAME Ilanniservice

Service_description PING

Check_command check_ping!200.0,80%!400.0,40%}

In the above example, the service's instrumentation command contains two parameters, $ARG the 1$ macro will be "200.0,80%", $ARG 2$ will be "400.0,40%" (both without quotation marks). If the check_ping command is defined like this:

Define Command{

Command_name check_ping

Command_line/usr/local/nagios/libexec/check_ping-h $HOSTADDRESS $ w $ARG 1$-c $ARG 2$}

Then the inspection command for the service will end up like this:

/usr/local/nagios/libexec/check_ping-h 192.168.1.247-w 200.0,80%-C 400.0,40%

In addition, on-demand macros and user-defined macros, here we do not introduce too much. If you want to learn more about Nagios macros, you can check out the Nagios website.

5.4.3 Nagios Available Macros

Nagios has more macros available, but each command supports a maximum of 32 parameter macros. Here we introduce several frequently used macros.

Host Macros:

$HOSTNAME $ host for short, taken from host_name in the host definition. $HOSTADDRESS $ host address, taken from the host definition.

Service Macros:

$SERVICESTATE the status of the current service, W, u, c, R. Where W is warn, indicating the warning state. U is unknown, indicating that the state is unknown. C is criticle, indicating a state of emergency. R is recover, which indicates the recovery status.

$SERVICEDESC $ Description of the current service.

Contact macro:

$CONTACTNAME $ represents the contact, as defined in the contact Contacts.cfg file.

Notification Macros:

$NOTIFICATIONTYPE $ Returns the following information: ("Problem", "RECOVERY", "Acknowledgement", "Flappingstart", "Flappingstop", " Flappingdisabled "," Downtimestart "," downtimeend ", or" downtimecancelled ").

Date/Time macro:

$LONGDATETIME $ The current date/time stamp.

File Macros:

$LOGFILE the location where the log file is saved. $MAINCONFIGFILE the location where the master configuration file is saved.

Other macros:

$ADMINEMAIL $ Global Administrator email address.

$ARGn $ points to the nth command pass parameter (notification, event handling, service detection, and so on).

If you want to see information about all of Nagios's macros, you can view them on the Nagios official website. As follows:

Http://nagios.sourceforge.net/docs/nagioscore/4/en/toc.html

Of course, you can also view the NAGIOC Chinese version of the connection, as follows:

Http://nagios-cn.sourceforge.net/nagios-cn/advance.html

5.5 commands.cfg Document Introduction

Commands.cfg is the definition file for the Nagios Monitoring command, which is present by default and can be used without modification. Of course, if you have a new command to join, just add it in this file. All the contents of the file are not listed here, just a few of the commands that are frequently used in the configuration.

Egrep-v "^#|^$" commands.cfg

The following is the definition of the Notify-host-by-email command:

Define Command{

Command_name Notify-host-by-email

command_line/usr/bin/printf "%b" "*****nagios*****\n\nnotification Type: $NOTIFICATIONTYPE $\nhost: $HOSTNAME $\ Nstate: $HOSTSTATE $\naddress: $HOSTADDRESS $\ninfo: $HOSTOUTPUT $\n\ndate/time: $LONGDATETIME $\n "|/bin/mail-s" * * $ notificationtype$ Host Alert: $HOSTNAME $ is $HOSTSTATE $** "$CONTACTEMAIL $}

The Command_name row defines the command name, which is the command that sends the message when a host exception is defined.

The Command_line line defines how the command is executed, where "-H $HOSTADDRESS $" is the address that defines the destination host.

The following is the definition of the Notify-service-by-email command:

Define Command{

Command_name Notify-service-by-email

command_line/usr/bin/printf "%b" "*****nagios*****\n\nnotification Type: $NOTIFICATIONTYPE $\n\nservice: $ Servicedesc$\nhost: $HOSTALIAS $\naddress: $HOSTADDRESS $\nstate: $SERVICESTATE $\n\ndate/time: $LONGDATETIME $\n\ Nadditional info:\n\n$serviceoutput$\n "|/bin/mail-s" * * $NOTIFICATIONTYPE $service Alert: $HOSTALIAS $/$SERVICEDESC $ is $SERVICESTATE $** "$CONTACTEMAIL $}

The Command_name row defines the command name, which is the command that sends the message when a service exception is defined.

Command_line command specific execution mode, "-H $HOSTADDRESS $" is the address that defines the destination host, this address is defined in the Hosts.cfg file.

The following is the definition of the check-host-alive command:

Define Command{

Command_name check-host-alive

Command_line $USER 1$/check_ping-h $HOSTADDRESS $ w 3000.0,80%-C 5000.0,100%-P 5}

The Command_name row defines the command name, which is used to detect the state of the host.

Command_line here the variable $user1$ is defined in the Resource.cfg file, that is, $user1$=/usr/local/nagios/libexec, the last check_ping the full path is/usr/local /nagios/libexec/check_ping.

The "-W" in "-W 3000.0,80%" indicates that a pair of values follows the "WARNING" state, and "80%" is its critical value. "-C" in the "-C 5000.0,100%" description of the following pair of values corresponding to "CRITICAL", "100%" is its critical value. "-P 5" means that 5 packets are sent.

Parameters of the check_ping command:

-H Destination host address.

-W Warning Warning Status: Response time (ms), drop rate (%) threshold.

-C Critical Hazardous status: Response Time (ms), drop rate (%) threshold.

-P sends the number of packets, default 5 packets.

-T time-out, default 10 seconds.

-4|-6 uses Ipv4|ipv6 address, default IPv4.

5.6 Contacts.cfg Document Introduction

Contacts.cfg is the configuration file that defines the contacts and contact groups. When a monitored host or service fails, Nagios sends the information to the contact specified here, using the specified notification method.

Egrep-v "^$|^#" contacts.cfg

Define Contact{

Contact_Name Nagiosadmin

Use Generic-contact

Alias Nagios Admin

email [email protected]}

Define Contactgroup{

Contactgroup_name Admins

Alias Nagios Administrators

Members Nagiosadmin}

The Contact_Name row defines the contact name.

The use line represents the property information that references Generic-contact, where generic-contact is defined in the Templates.cfg file.

The alias row defines the contact alias.

The email line defines the email address of the contact person.

The Contactgroup_name row defines the contact group name.

The members row defines the contact group member, where "Nagiosadmin" is the contact defined above.

5.7 timeperiods.cfg Document Introduction

The Timeperiods.cfg file is used to define the time period for monitoring.

The following is a time period defined as 24x7, that is, monitoring all time periods. As follows:

Egrep-v "^#|^$" timeperiods.cfg

Note: Timeperiod_name cannot have spaces in the time period name defined by the row.

5.8 templates.cfg Document Introduction

To avoid having to define some monitoring objects repeatedly, Nagios introduces a template configuration file, templates.cfg, that defines some common properties as templates, so that they can be referenced more than once.

templates.cfg generic template definitions, including monitoring host template generic-host, linux_server, monitoring service template local_service, contact template generic-contact (not a real contact, The real contacts are defined in contacts.cfg).

The meanings of each parameter in the following templates.cfg file are described in detail below:

Define Contact{

Name Generic-contact

Define the contact name.

Service_notification_period 24x7

When a service exception occurs, the time period for which the notification is sent, "24x7", is defined in the Timeperiods.cfg file.

Host_notification_period 24x7

When the host has an exception, the time period for which the notification is sent, "24x7" is defined in the Timeperiods.cfg file.

Service_notification_options W,u,c,r

Defines the status that notifications can emit. W is warn, which indicates the warning state. U is unknown, indicating that the state is unknown. C is criticle, indicating a state of emergency. R is recover, which indicates the recovery status. This means that notifications are sent to the consumer when the service has a warning state, an unknown state, a state of emergency, and a recovery status.

Host_notification_options D,u,r

Define what state the host needs to send notifications to the consumer. D is down, which indicates the outage state. U is unreachable, which means the unreachable state. R is recovery, which indicates the state of recovery.

Service_notification_commands Notify-service-by-email

Defines the way a notification is sent when a service fails, defined here as a message, where "Notify-service-by-email" is defined in the Commands.cfg file.

Host_notification_commands Notify-host-by-email

Defines the way a notification is sent when a host fails, defined here as a message, where "Notify-host-by-email" is defined in the Commands.cfg file.

Register 0

}

Define Host{

Name Generic-host

Defines the host name. The hostname here does not correspond directly to the hostname of the real machine, but to the host name set in the host configuration file.

Notifications_enabled 1

Event_handler_enabled 1

Flap_detection_enabled 1

Failure_prediction_enabled 1

Process_perf_data 1

Retain_status_information 1

Retain_nonstatus_information 1

Notification_period 24x7

Specifies the time period to send notifications, that is, when notifications can be sent to users.

Register 0}

Define Host{

Name Linux-server

Defines the host name.

Use Generic-host

Use represents a reference, which is to refer to all properties of the host Generic-host to Linux-server. In Nagios configuration, references are used in many cases.

Check_period 24x7

The check_period here tells Nagios to check the host's time period.

Check_interval 5

Nagios checks the host for a time interval, here is 5 minutes.

Retry_interval 1

Retry the check interval, in minutes.

Max_check_attempts 10

Nagios to the host of the maximum number of checks, that is, Nagios in the check to find a host exception, not immediately judged as abnormal condition, but more than a few times, because it may be just a temporary network too crowded, or some other reasons, so that the host is affected by a little, here is 10 of the maximum try 10 times meaning.

Check_command check-host-alive

Specifies the command to check the status of the host, where "check-host-alive" is defined in the Commands.cfg file.

Notification_period workhours

When a host fails, the time range of the notification is sent, where "workhours" is defined in the timeperiods.cfg.

Notification_interval 120

After the host has an exception, the failure has not been resolved, Nagios again to notify the user of the time, the unit is minutes.

Notification_options D,u,r

Defines the state under which a host can send notifications to a consumer. D is down, which indicates the outage state. U is unreachable, which means the unreachable state. R is recovery, which indicates the state of recovery.

Contact_groups Admins

Specifies the contact group, which is defined in the Contacts.cfg file. Admins.

Register 0}

Define Service{

Name Generic-service

Defines the service name.

Active_checks_enabled 1

Passive_checks_enabled 1

Parallelize_check 1

Obsess_over_service 1

Check_freshness 0

Notifications_enabled 1

Event_handler_enabled 1

Flap_detection_enabled 1

Failure_prediction_enabled 1

Process_perf_data 1

Retain_status_information 1

Retain_nonstatus_information 1

Is_volatile 1

Check_period 24x7

The check_period here tells Nagios to check the service's time period.

Max_check_attempts 3

The maximum number of Nagios checks on a service.

Normal_check_interval 10

This option is used to set the service check interval, that is, the time between Nagios this check and the next check, here is 10 minutes.

Retry_check_interval 2

Retry the check interval, in minutes.

Contact_groups Admins

Specify the contact group, as above.

Notification_options W,u,c,r

This defines the state at which the notification can be issued. W is warn, indicating a warning state, U is unknown, indicating an unknown state. C is criticle, indicating a state of emergency. R is recover, which indicates the recovery status. This means that notifications are sent to the consumer after the service has a warning state, an unknown state, an emergency, and a re-recovery.

Notification_interval 60

After the service has an exception, the failure has not been resolved and Nagios again notifies the user of the time, in minutes.

Notification_period 24x7

Specifies the time period to send notifications, that is, when notifications can be sent to users.

Register 0}

Slime: Learning Nagios (ii): Nagios configuration

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.