Use Escalations to limit the number of Nagios alarms

Source: Internet
Author: User

 

Use Escalations to limit the number of Nagios alarms:

Nagios is a powerful monitoring tool, especially its alarm function. However, if the server fails to be resolved in time, Nagio will continuously send messages. How can I limit the number of Nagios alarms? This article describes how to limit the number of Nagios alarms (Escalations ).

AD:

 

 

Use escalations to limit the number of Nagios alarms

Nagios is a very powerful monitoring tool, especially its alarm function. It now supports a variety of forms on the Internet, such as mobile phone 139 mailbox, Fetion, and MSN, however, if the server fails to be resolved in a timely manner, Nagios will continuously send alarm messages, which is a headache. The following method can be used to solve the issue of the number of Nagios alarms.

System Environment: CentOS 5.2

Nagios version: 3.0.6

Nagios installation path:/usr/local/nagios

Definition of configuration file content: # basic configuration will not be commented out.

Hosts. cfg

Define host {

Host_name WWW-Server

Alias WWW-Server

Address 193.1.16.100

Check_command check-host-alive

Max_check_attempts 5

Check_period 24x7

Icationication_interval 10

Icationication_period 24x7

Notification_options d, u, r

Notifications_enabled 1

Contact_groups chengnan

}

 

Services. cfg

Define service {

Host_name WWW-Server

Service_description Check_HTTP

Check_command check_http

Max_check_attempts 10

Normal_check_interval 3

Retry_check_interval 2

Check_period 24x7

Icationication_interval 5

Icationication_period 24x7

Notification_options w, u, c, r

Contact_groups admin

}

 

Define service {

Host_name WWW-Server

Service_description Check_Jetty

Check_command check_tcp! 8080

Max_check_attempts 10

Normal_check_interval 3

Retry_check_interval 2

Check_period 24x7

Icationication_interval 5

Icationication_period 24x7

Notification_options w, u, c, r

Contact_groups admin

}

 

Contacts. cfg

Define contact {

Contact_name chengnan

Alias chengnan

Service_icationication_period 24x7

Host_icationication_period 24x7

Service_icationication_options w, u, c, r

Host_icationication_options d, u, r

Service_icationication_commands notify-service-by-email

Host_icationication_commands notify-host-by-email

Email chengnan@139.com // email

}

 

Define contactgroup {

Contactgroup_name chengnan

Alias Nagios Administrators

Members chengnan

}

 

Define another contact.

Define contact {

Contact_name chengnan_cor

Alias chengnan_cor

Service_icationication_period 24x7

Host_icationication_period 24x7

Service_icationication_options w, u, c, r

Host_icationication_options d, u, r

Service_icationication_commands notify-service-by-email

Host_icationication_commands notify-host-by-email

Email chengnan@company.com // company email

}

 

Define contactgroup {

Contactgroup_name sysadmin

Alias sysadmin

Members chengnan_cor

}

Then create a configuration file:

Vi escalations. cfg

The escalations are automatically adjusted, constantly increased, and gradually increased. The configuration file function is that when the service is not restored before a certain number of alerts, the alarm frequency cycle will be shortened, sends the alarm information to the specified contact.

The content is:

Define hostescalation {

Host_name WWW-Server // host name to be monitored, consistent with that in Hosts. cfg

First_notification 4 // starts with the nth message and changes the frequency interval.

Last_notification 0 // the nth information, recovery Interval

Icationication_interval 30 // notification interval (points)

Contact_groups ysadmin

}

Note: The alert information is sent to contacts in the sysadmin group before the server recovers from the first 4th alarms. The alert interval is 30 minutes.

Define serviceescalation {

Host_name WWW-Server // host name to be monitored, consistent with that in Hosts. cfg

Service_description Check_HTTP, Check_Jetty // name of the monitored service, consistent with that in Services. cfg

First_notification 4

Last_notification 0

Icationication_interval 30

Contact_groups sysadmin

}

Save

Modify nagios. cfg

Vi nagios. cfg

Add:

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

 

Check whether the nagios configuration file is correct

/Usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios. cfg

Restart the nagios service:

Service nagios restart

Test:

After the server is started, the services of the monitored test machine are stopped and the alarms are sent to different mailboxes according to the settings.

Summary

The official definition of the escalations function is the extended notification, which makes notification more flexible and convenient. The method I used in this article is clever enough to send all the information after the fourth alarm to my company mailbox until the server recovers (the recovery information will still be sent to the mobile phone ), this limits the number of messages sent to mobile phones. In this way, you can use Escalations to limit the number of Nagios alarms.

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.