Currently Nagios can only view the status of each machine's services on a browser, when a machine is down or a
When the service goes down, we don't know, because we can't stare at the service all the time. At this time, we need to use the alarm system
The system, let it automation, when the problem is found in time to notify us. Below we configure the way to use email to implement
Alarm.
All of the following operations are done on the service side.
The recipient of the outgoing message is defined first.
# vim/etc/nagios/objects/contacts.cfg
Increase:
Define Contact{
Contact_Name 123
Use Generic-contact
Alias Aming
email [email protected]
}
Define Contact{
Contact_Name 456
Use Generic-contact
Alias AAA
email [email protected]
}
Define Contactgroup{
Contactgroup_name Common
Alias Common
Members 123,456
}
Description: In Contacts.cfg, you can define either user or group, define two user 123 and 456 first.
Then add the two user to the common group. And then send an email to the common group, then this
[Email protected] and [email protected] will receive the email.
and add Contactgroup to the service that needs to be alerted.
# vim/etc/nagios/conf.d/192.168.0.12.cfg
Increased alarm-related configuration for check_load services
Define Service{
Use Generic-service
HOST_NAME 192.168.0.12
Service_description Check_load
Check_command Check_nrpe!check_load
Max_check_attempts 5
Normal_check_interval 1
Contact_groups Common
Notifications_enabled 1
Notification_period 24x7
Notification_options W,u,c,r
}
Description: notifications_enabled 1 Indicates whether the alert function is turned on. 1 is on, 0 is disabled. Generally, this
Options are defined in the main configuration file (Nagios.cfg), with the same effect. Notification_period 24x7 means sending
The time period of the reminder. Very important host (service) I defined as 7x24, the general host (service) is defined as the upper
Class time. If no problem occurs, no reminder is sent if it is not within the defined time period.
Notification_options:w,u,c,r represents the status of the service. W is waning, U is unknown, C is critical, R
For recover (recovered), similar to the state of a host: D,u,r D is down, u state is
Unreachable, the R state reverts to the ok,f status of Falpping, and N is not sent reminders. Need to be added to the definition configuration of host.
After editing the configuration file, you need to restart the Nagios service
# Service Nagios Restart
"Extended section"
Call SMS Interface http://www.aminglinux.com/bbs/thread-7380-1-1.html
1.7-nagios Configuring Message Alarms