Nagios Mail Alarm Settings

Source: Internet
Author: User

1. Download SendEmail

wget http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.56.tar.gz

2, Configuration SendEmail

Tar zxvf sendemail-v1.56.tar.gz

CD sendemail-v1.56

CP Sendemail/usr/local/bin

chmod 777/usr/local/bin/sendemail

Send a test message

/usr/local/bin/sendemail-f [email protected]-t [email protected]-s Smtp.126.com-xu [email protected]-xp password -U "Nagios"-M "Tets"
Explanation:
-F means the sender's mailbox
-T indicates the recipient's mailbox
-S indicates the domain name or IP of the SMTP server
-U represents the subject of the message
-xu represents the user name for SMTP authentication
-XP represents the password for SMTP authentication
-M indicates the contents of the message

3, Configuration Contacts.cfg

Vi/usr/local/nagios/etc/objects/contacts.cfg input receive alarm email address

Define Contact{

Contact_Name nagiosadmin; Short name of user

Use Generic-contact; Inherit default values from Generic-contact template (defined above)

Alias Nagios Admin; Full name of user

email [email protected] ; <<***** change YOUR EMAIL ADDRESS ******

}

4, Configuration Commands.cfg

Vi/usr/local/nagios/etc/objects/commands.cfg

Note # ' notify-host-by-email ' command definition with # ' notify-service-by-email ' command definition for all settings

Re-enter the following:

# ' notify-host-by-email ' command definition

Define Command{

Command_name Notify-host-by-email

command_line/usr/bin/printf "%b" "* * * * Nagios *****\nnotification Type: $NOTIFICATIONTYPE $\nhost: $HOSTNAME $\nstate: $HOSTSTATE $\naddress: $HOSTADDRESS $\ninfo: $HOSTOUTPUT $\n\ndate/time: $LONGDATETIME $\n "| /usr/local/bin/sendemail-f [email protected]-T $CONTACTEMAIL $-S Smtp.126.com-u "* * $HOSTALIAS $ is $HOSTSTATE $**"-xu [em AIL protected]-xp password-o Message-charset=utf8

}

# ' notify-service-by-email ' command definition

Define Command{

Command_name Notify-service-by-email

command_line/usr/bin/printf "%b" "* * * * Nagios *****\nnotification Type: $NOTIFICATIONTYPE $\nservice: $SERVICEDESC $\n Host: $HOSTALIAS $\naddress: $HOSTADDRESS $\nstate: $SERVICESTATE $\n\ndate/time: $LONGDATETIME $\n\nadditional info:\n $SERVICEOUTPUT $\n "| /usr/local/bin/sendemail-f [email protected]-T $CONTACTEMAIL $-S Smtp.126.com-u "* * $HOSTALIAS $/$SERVICEDESC $ is $SERVI cestate$** "-xu [email protected]-XP Password-o Message-charset=utf8

}

5. Restart Service

Nagios Mail Alarm Settings

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.