Mud: Learning Nagios (2): Nagios configuration, mud nagios

Source: Internet
Author: User
Tags snmp egrep

Mud: Learning Nagios (2): Nagios configuration, mud nagios

This document consistsXiuyi Lin FengProviding friendship sponsorship, first launchedThe world

After nagios is installed, configure nagios now. For more information about nagios installation, see the article "mud: Learning Nagios (1): Nagios installation.

(In order to keep nagios version, we are using the nagios latest version of nagios-4.1.0rc1.

NOTE: For the latest nagios version, you can view its running PID on the web page.

1. nagois Monitored object

Nagios monitors many objects, which can be divided into general objects and detailed Objects Based on different granularities.

1.1General Object

General nagios monitoring objects can be divided into two types: network services and host resources.

Network services include the survival status of hosts (including network devices), web services, ftp services, database services, and custom services.

Host resources include system load, current IP address connections, disk space usage, current process count, and custom resources.

1.2Detailed object

The detailed object of nagios monitoring, which includes the following objects:

Website monitoring, mainstream database monitoring, Protocol Monitoring, operating system monitoring, application monitoring, Application Server monitoring, network monitoring, dynamic environment monitoring, storage monitoring, mail monitoring, security monitoring, log monitoring, virtualization monitoring.

Website monitoring mainly includes websites, website applications, website content, HTTP, and SSL.

Mainstream database monitoring includes MySql, Oracle, DB2, and MSSQL.

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

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

Application Monitoring mainly includes services and processes.

Application Server Monitoring mainly includes Tomcat, JBoss, Websphere, Weblogic, Java, and JMX.

Network Monitoring mainly includes routers, switches, and firewalls.

Log monitoring mainly includes windows event logs and Syslog.

Power Environment Monitoring mainly includes temperature and humidity, Smoke sensors, water immersion, dry contacts, UPS, APC, etc.

To learn more about nagios monitoring objects, go to the nagios official website. As follows:

Http://www.nagios.com/solutions

Ii. nagios Monitoring Method

As we mentioned above, the nagios monitoring objects are monitored through which methods are used to monitor these objects, that is, through which monitoring carriers are monitored?

Nagios provides multiple monitoring methods, including NRPE, SNMP, and script.

The NRPE method has corresponding client software on windows and Linux, while the SNMP method requires installing SNMP-related components on windows and Linux. For script monitoring, we can use scripts such as shell and perl.

For the above three methods, we recommend that you select based on the actual business. For example, we usually use SNMP to monitor network equipment. For OS, the most common method is through NRPE and SNMP.

Iii. nagios notification methods

The main purpose of monitoring is to promptly notify relevant personnel when the Monitored object encounters a fault or resource shortage, so that the problem can be quickly handled.

To facilitate our management, nagios provides at least three notification methods.

Web mode: You can view the Monitored object in a browser. In normal state, the status is filled in blue and an OK is displayed.

Email Notification: When a fault occurs and the Set retry times and test interval are reached, the system sends an email to the administrator or related personnel to report the problem.

SMS: This is a very useful and timely function. If a fault occurs, you can receive a notification via SMS.

Generally, these three operations are performed at the same time: open a browser during work hours to view the page display, regularly receive emails, and the mobile phone is online 24 hours a day.

Iv. nagios file directory

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

Ll/usr/local/nagios/

The bin directory is used to store nagios execution programs, including nagios and nrpe.

The etc directory is used to store configuration files of nagios.

The libexec directory is used to store monitoring plug-ins of nagios.

The sbin directory is used to store the nagios cgi file, that is, the directory where the files needed to execute External commands are located.

The share directory is used to store nagios webpage files, that is, the directory for storing web pages.

The include directory is used to store external calls to nagios cgi files.

The var directory is used to store nagios log files, lock files, and other files.

5. nagios configuration file

After the nagios directory is introduced, let's introduce the configuration file of nagios. By default, nagios configuration files are stored in the/usr/local/nagios/etc directory.

5.1 nagiosConfiguration File Overview

View the configuration file of nagios as follows:

/Usr/local/nagios

Tree-L 2./etc/

We can see all the configuration files. The following describes the specific functions of each configuration file. As follows:

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

Htpasswd. users is used to store the nagios administrator user name and password files.

Nagios. cfg is the main configuration file of nagios. All cfg configuration files (except for external calls) must be referenced in this file to take effect.

The resource. cfg variable definition file is also called a resource file. Variables defined in this file can be referenced by other configuration files, such as $ USER1 $.

Objects is a directory where files are mainly used to define monitoring objects for nagios.

Commands. cfg is the definition file of the nagios monitoring command. The defined commands can be referenced by other configuration files.

Contacts. cfg is the configuration file that defines the contacts and contact groups to be notified when the nagios monitoring object fails.

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

Templates. cfg is a template configuration file that defines the host and service.

Timeperiods. cfg is the configuration file that defines the monitoring period of nagios.

Services. cfg stores the configurations of the monitored service. The configuration file does not exist by default. You need to manually create it and create it in the services Directory. You also need to specify the services directory in the nagios. cfg file. As follows:

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

Export _dir =/usr/local/nagios/etc/services

Hosts. cfg stores the specific host configurations to be monitored. The configuration file does not exist by default. You need to manually create it and create it in the hosts directory. You also need to specify the hosts directory in the nagios. cfg file. Use the same method as services. cfg.

5.2 nagiosRelationship between configuration files

The configuration process of nagios involves the following definitions: Host, Host group, service, service group, contact, Contact Group, monitoring time, monitoring command, etc. From these definitions, we can see that configuration files of nagios are interrelated and referenced.

To successfully configure a nagios monitoring system, you must understand the dependency and dependency between the configuration files. The most important four aspects are:

1. Define the hosts, host groups, services, and service groups to be monitored.

Second, define the command to implement this monitoring.

Third: Define the monitoring period.

4. Define the contacts and contact groups to be notified when a problem occurs on the host or service.

5.2 cgi. cfgFile Introduction

The cgi. cfg file is used to control cgi scripts related to nagios. If you want to execute related cgi scripts on the nagios web monitoring interface, such as restarting the nagios process, disabling the nagios notification, and stopping the nagios host detection, You need to configure the cgi. cfg file.

In the article "mud: Learning Nagios (1): Nagios installation", we have mentioned that the default Administrator of nagios is nagiosadmin.

If we want to add a new Administrator admin, we need to modify the cgi. cfg file to add the relevant execution permissions for this user. As follows:

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

After the cgi. cfg file is modified, add the admin user to the htpasswd. users file and use the htpasswd command. As follows:

Htpasswd. users admin

Cat htpasswd. users

5.3 nagios. cfgFile Introduction

Nagios. cfg is the main configuration file of nagios. The default path is/usr/local/nagios/etc/nagios. cfg. All object configuration files must be defined in this file to play its role. Here, you only need to reference the object configuration file in the nagios. cfg file.

The nagios. cfg configuration file contains a lot of content. Here we will only introduce more important parts.

View the content of the nagios. cfg file as follows:

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

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

Defines where nagios creates its log file.

Note:

The log_file variable defines where nagios creates its log file. If you use the nagios log polling function, nagios polls logs every hour, day, week, or month.

Export _file =/usr/local/nagios/etc/objects/commands. cfg

The configuration file used to define the nagios monitoring command.

Note:

The cfg_file variable is used to reference the object configuration file. If more object configuration files exist, you only need to add them in the nagios. cfg file in sequence.

Object configuration files generally contain host, Host group, contact, Contact Group, service, command, and other object definitions.

If you want nagios to process all the object configuration files contained in a specific directory, you can use the cmd_dir command. As follows:

Export _dir =/usr/local/nagios/etc/services

Note:

The cmd_dir variable is used to reference all object configuration files contained in a directory. All files suffixed with. cfg in this directory will be processed as object configuration files.

In addition, nagios recursion the subdirectories in the directory and processes all configuration files in the subdirectories. You can also put the configuration in different directories and use the cmd_dir = Statement to point to each directory to be processed.

Export _file =/usr/local/nagios/etc/objects/contacts. cfg

Used to reference the configuration file of the nagios contact.

Export _file =/usr/local/nagios/etc/objects/timeperiods. cfg

Used to reference the configuration file of the nagios monitoring period.

Export _file =/usr/local/nagios/etc/objects/templates. cfg

The template file used to reference the nagios monitoring object.

Export _file =/usr/local/nagios/etc/objects/localhost. cfg

Used to reference the configuration file of the local (Linux) host monitored by nagios.

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

The resource_file variable is used to define the nagios resource configuration file. Multiple resource files can be defined in nagios. cfg.

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

The status_file variable defines the nagios status file, which is used to save the current status and downtime information of nagios. It will be cleared and deleted every time nagios restarts.

Status_update_interval = 10

This variable defines the update interval of the status File (namely, status. dat). The Unit is second, and the minimum update interval is 1 second. The default value is 10 seconds.

Nagios_user = nagios

This variable specifies the user that the nagios process uses to run.

Nagios_group = nagios

This variable specifies the user group that nagios uses to run.

Check_external_commands = 1

This variable is used to set whether to allow nagios to run cgi commands on the web monitoring interface, that is, whether to allow nagios to restart nagios, stop hosts, and perform service checks on the web interface. 1 indicates yes, and 0 indicates no.

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

Defines the file that nagios uses to check external command requests. This file is also the place where user operations are submitted and CGI commands are written. Therefore, this file must be writable to related services, which is generally writable to Apache host users.Note that the permission of the directory where the file is located must be writable by Apache, not the file, because the file is frequently written and deleted during work.

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

Defines the PID file used to save the nagios runtime.

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

Defines the path of a temporary nagios file. It will be created, used, and deleted continuously while nagios is running.

Log_rotation_method = d

Defines the log polling method of nagios. The default value is daily polling.

If the value is n, it indicates none. No round robin is performed. H indicates hourly, Which is round-robin once every hour (starting from every hour ). If the value is d, it indicates daily, which is polling once every day (midnight every day ). The value w indicates weekly, Which is polling once a week (Saturday evening ). The value of m indicates monthly, Which is polling once every month (midnight on the last day of last month ).

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

Defines the path for archiving nagios logs.

Command_check_interval = 10 s

This variable defines the interval for nagios to detect External commands. The default value is 10 seconds. If the unit is not added, the default unit is minute. For example, 1 indicates 1 minute, and nagios checks every minute.

Service_check_timeout = 60

Defines the timeout time for service detection. The default value is 60 seconds. If the service check time exceeds the defined time, it is displayed as a CRITICAL state.

Host_check_timeout = 30

Defines the timeout time for host detection. The default value is 30 seconds. If the host check time exceeds the defined time, it is displayed as a CRITICAL state.

Event_handler_timeout = 30

Defines the maximum event processing time. The default value is 30 seconds. If the maximum event processing time exceeds the defined time, nagios will issue a warning message and record it to the log.

Notification_timeout = 30

Defines the time interval for sending notification information. The default value is 30 seconds.

Interval_length = 60

This variable defines the unit of the nagios detection interval. The default value is 60 seconds, that is, 1 minute. That is to say, in nagios, the detection interval is measured in minutes by default.

In this way, the unit length of time is used in other places. The default value is minute. This value is used as the basis for defining hosts and services in the configuration template file templates. cfg. As follows:

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

Check_interval 5

Retry_interval 1

Indicates that the check interval is 5*60 s (5 minutes), that is, every 5 minutes. The retry check interval is 1 minute. A maximum of 10 retry checks can be performed.

Note: When nagios is in the OK State, it uses the interval defined by check_interval to monitor. When an error occurs, it switches to retry_interval and max_check_attempts for monitoring. When the number of retries reaches the value of max_check_attempts, at the same time, it is restored to check_interval for monitoring and sends alarms using the interval defined by icationication_interval. After the fault returns to normal, send an OK notification at the latest check_interval to complete the alarm cycle.

For services with high sensitivity requirements, this obviously cannot meet our requirements, so we can reduce it, for example, to 10 seconds:

Interval_length = 10 s

This improves the sensitivity of the check, but some services do not need such high sensitivity, such as disk space (which will not increase a lot), you can increase the value in the definition of check_interval.

Note: The sensitivity is directly proportional to the false positive rate. The smaller the check interval, the higher the possibility of false positive. Therefore, we recommend that you adjust the value based on the actual situation.

5.4 resource. cfgFile Introduction

Resource. cfg is a variable definition file for nagios. The file contains only one row. As follows:

$ USER1 $ =/usr/local/nagios/libexec

The variable $ USER1 $ specifies the path for installing the nagios plug-in.

If you have installed the plug-in another path, you only need to modify it here.

Note that the variable must be defined first before it can be referenced in other configuration files. At the same time, the variable can also be defined through macros.

An important feature of nagios is that macro can be used in the definition of the command line. By defining macros, nagios can flexibly obtain information about hosts, services, and other objects.

5.4.1Macro Working Mechanism

Before executing a command, nagios replaces every macro in the command with the value they should obtain. This macro replacement occurs when nagios executes various types of macros. Such as host and service detection, notification, and event processing.

5.4.2Macro Classification

Based on different macros, we can divide them into default macros, on-demand macros, and custom macros.

The default macro is the Host IP address macro.

When a host or service macro is used in the Command definition, the value used when the macro is to be executed points to the value carried by the host or service.

Let's look at the example below. 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%}

When executing this host detection command, the final execution will be like this:

/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 detect infinite hosts, and each host can use the same command for detection, the host address will be replaced correctly before detection.

Command Parameter macro

You can also pass parameters to the command to ensure that the command definition is more universal. The parameter is defined in an object (such as a host or service). For example:

Define service {

Host_name ilanniservice

Service_description PING

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

In the preceding example, the Service detection command contains two parameters. $ ARG1 $ Macro will be "200.0, 80%", $ ARG2 $ will be "400.0, 40% "(all without quotation marks ). Assume that the check_ping command is defined as follows:

Define command {

Command_name check_ping

Command_line/usr/local/nagios/libexec/check_ping-H $ HOSTADDRESS $-w $ ARG1 $-c $ ARG2 $}

Then the service detection command will eventually be 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 are not described too much here. If you want to learn more about nagios macros, go to the nagios official website.

5.4.3 nagiosAvailable macros

Nagios has many macros available, but each command supports up to 32 parameter macros. Here we will introduce several frequently used macros.

Host macro:

$ HOSTNAME $ host abbreviation, taken from host_name in the host definition. $ HOSTADDRESS $ host address, which is taken from the address defined by the host.

Service macro:

$ SERVICESTATE $ status of the current service, w, u, c, and r. W indicates the warning status. U is unknown, indicating that the status is unknown. C is the criticle, indicating the emergency. R indicates the recovery status.

$ SERVICEDESC $ description of the current service.

Contact macro:

$ CONTACTNAME $ indicates the contact, which is defined in the contact contacts. cfg file.

Notification macro:

$ Icationicationtype $ The following information is returned: ("PROBLEM", "RECOVERY", "ACKNOWLEDGEMENT", "FLAPPINGSTART", "FLAPPINGSTOP", "FLAPPINGDISABLED", "DOWNTIMESTART", "DOWNTIMEEND ", or "DOWNTIMECANCELLED ").

Date/time macro:

$ LONGDATETIME $ current date/timestamp.

File macro:

$ LOGFILE $ location where log files are stored. $ MAINCONFIGFILE $ storage location of the main configuration file.

Other macros:

$ ADMINEMAIL $ global administrator email address.

$ ARGn $ points to the nth command to pass parameters (notifications, event processing, service detection, etc ).

If you want to view all macro information of nagios, you can view it on the official website of nagios. As follows:

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

Of course, you can also view the nagioc Chinese Version connection as follows:

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

5.5 commands. cfgFile Introduction

Commands. cfg is the definition file of the nagios monitoring command. This file exists by default and can be used without modification. If a new command needs to be added, you only need to add it to this file. It does not list all the contents of this file. It only describes some frequently used commands in configuration.

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

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

Define command {

Command_name sort y-host-by-email

Command_line/usr/bin/printf "% B" "****** Nagios ***** \ n \ nNotification Type: $ icationicationtype $ \ nHost: $ HOSTNAME $ \ nState: $ HOSTSTATE $ \ nAddress: $ HOSTADDRESS $ \ nInfo: $ HOSTOUTPUT $ \ n \ nDate/Time: $ LONGDATETIME $ \ n "|/bin/mail-s" ** $ icationicationtype $ Host Alert: $ HOSTNAME $ is $ HOSTSTATE $ ** "$ CONTACTEMAIL $}

The command_name line defines the command name, which defines the command to send emails when a host exception occurs.

The command_line line defines the specific execution method of the command. "-H $ HOSTADDRESS $" indicates the address of the target host.

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

Define command {

Command_name sort y-service-by-email

Command_line/usr/bin/printf "% B" "****** Nagios ***** \ n \ nNotification Type: $ icationicationtype $ \ n \ nService: $ SERVICEDESC $ \ nHost: $ HOSTALIAS $ \ nAddress: $ HOSTADDRESS $ \ nState: $ SERVICESTATE $ \ n \ nDate/Time: $ LONGDATETIME $ \ n \ nAdditional Info: \ n $ SERVICEOUTPUT $ \ n "|/bin/mail-s" ** $ icationicationtype $ Service Alert: $ HOSTALIAS $/$ SERVICEDESC $ is $ SERVICESTATE $ ** "$ CONTACTEMAIL $}

The command_name line defines the command name, which defines the command for sending emails when a service exception occurs.

The specific execution method of the command_line command. "-H $ HOSTADDRESS $" defines the address of the target host, which 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 $ USER1 $/check_ping-H $ HOSTADDRESS $-w 3000.0, 80%-c 5000.0, 100%-p 5}

Command_name defines the command name to check the host status.

The variable $ USER1 $ in command_line is in resource. the cfg file defines $ USER1 $ =/usr/local/nagios/libexec, and the complete path of check_ping is/usr/local/nagios/libexec/check_ping.

In "-w 3000.0, 80%", "-w" indicates that the next pair of values corresponds to the "WARNING" status, and "80%" indicates the critical value. In "-c 5000.0, 100%", "-c" indicates that the next pair of values corresponds to "CRITICAL", and "100%" indicates its CRITICAL value. -P 5 indicates that five data packets are sent.

Parameters of the check_ping command:

-H: Target Host address.

-W WARNING status: Threshold Value of response time (millisecond) and Packet Loss Rate (%.

-C CRITICAL dangerous status: Threshold Value of response time (millisecond) and Packet Loss Rate (%.

-P indicates the number of sent packets. The default value is 5.

-T timeout. The default value is 10 seconds.

-4 |-6 Use ipv4 | ipv6 address, which defaults to ipv4.

5.6 contacts. cfgFile Introduction

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

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

Define contact {

Contact_name nagiosadmin

Use generic-contact

Alias Nagios Admin

Email nagios @ localhost}

Define contactgroup {

Contactgroup_name admins

Alias Nagios Administrators

Members nagiosadmin}

The contact_name row defines the contact name.

The use line references the attributes of generic-contact. generic-contact is defined in the templates. cfg file.

The alias row defines the contact alias.

The email line defines the contact's email address.

The row contactgroup_name defines the Contact Group name.

The members row defines Contact Group members. "nagiosadmin" is the contact group defined above.

5.7 timeperiods. cfgFile Introduction

The timeperiods. cfg file is used to define the monitoring period.

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

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

Note: The time period name defined in the timeperiod_name row cannot contain spaces.

5.8 templates. cfgFile Introduction

To avoid repeated definitions of some monitoring objects, nagios introduces a template configuration file templates. cfg, which defines some common attributes as templates for multiple references.

Templates. cfg general template definition, including monitoring host template generic-host, linux_server, monitoring service template local_service, contact template generic-contact (not real contact, real contact in contacts. cfg ).

The following describes in detail the meaning of each parameter in the templates. cfg file:

Define contact {

Name generic-contact

Define the contact name.

Service_icationication_period 24x7

When a service exception occurs, the time period for sending notifications. This time period "24x7" is defined in the timeperiods. cfg file.

Host_icationication_period 24x7

When an exception occurs on the host, the notification sending period, which is "24x7", is defined in the timeperiods. cfg file.

Service_icationication_options w, u, c, r

Define the status of a notification. W indicates the warning status. U is unknown, indicating that the status is unknown. C is the criticle, indicating the emergency. R indicates the recovery status. In other words, a notification is sent to the user when the service has a warning status, unknown status, emergency status, and recovery status.

Host_icationication_options d, u, r

Defines the status of the host to send notifications to the user. D is down, indicating that the instance is down. U is unreachable, indicating that it cannot be reached. R indicates the recovery status.

Service_icationication_commands notify-service-by-email

Define the method for sending notifications when a service fails. Here, the mail is defined, and "Y-service-by-email" is defined in the commands. cfg file.

Host_icationication_commands notify-host-by-email

Define the method for sending notifications when a host fails. Here, the mail is defined, and "Y-host-by-email" is defined in the commands. cfg file.

Register 0

}

Define host {

Name generic-host

Define the host name. The host name does not directly correspond to the Host Name 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

Icationication_period 24x7

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

Register 0}

Define host {

Name linux-server

Define the host name.

Use generic-host

Use indicates reference, that is, to reference all the attributes of the generic-host to linux-server. In nagios configuration, references are often used.

Check_period 24x7

Here check_period tells nagios to check the host time period.

Check_interval 5

The time interval for nagios to check the host, which is 5 minutes.

Retry_interval 1

The Retry Interval in minutes.

Max_check_attempts 10

Nagios's maximum number of checks on the host, that is, when nagios detects a host exception, it does not immediately judge it as an exception, but tries several more times, because the network may be too crowded at the moment, or for some other reason, the host is affected. Here 10 means a maximum of 10 attempts.

Check_command check-host-alive

Specify the command to check the host status. "check-host-alive" is defined in the commands. cfg file.

Notification_period workhours

The time range for sending notifications when the host fails. "workhours" is defined in timeperiods. cfg.

Icationication_interval 120

After the host encounters an exception, the fault persists. The time for nagios to send a notification to the user again is measured in minutes.

Notification_options d, u, r

Defines the status under which the host can send notifications to users. D is down, indicating that the instance is down. U is unreachable, indicating that it cannot be reached. R indicates the recovery status.

Contact_groups admins

Specifies the Contact Group, which is defined in the contacts. cfg file.

Register 0}

Define service {

Name generic-service

Define 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

Here check_period tells nagios to check the service period.

Max_check_attempts 3

The maximum number of service checks performed by nagios.

Normal_check_interval 10

This option is used to set the service check interval, that is, the time between the nagios check and the next check, which is 10 minutes.

Retry_check_interval 2

The Retry Interval in minutes.

Contact_groups admins

Specify a Contact Group, same as above.

Notification_options w, u, c, r

This defines the status when a notification can be sent. W is the warn, indicating the warning status, u is the unknown, indicating the unknown status. C is the criticle, indicating the emergency. R indicates the recovery status. That is, a notification is sent to the user after the service has a warning status, unknown status, emergency status, and recovery.

Icationication_interval 60

After a service exception occurs, the fault has not been resolved. The time for nagios to send a notification to the user again is measured in minutes.

Icationication_period 24x7

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

Register 0}

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.