Nagios Configuring Mail Alerts

Source: Internet
Author: User

1, Configuration SendMail

Vi/etc/mail.rc

Join the line

Set Bsdcompat

Set from= Mail user name @domain.com smtp=smtp.126.com set smtp-auth-user= Mail user name smtp-auth-password= mailbox password Set Smtp-auth=login

2, check Commands.cfg

  

################################################################################## SAMPLE NOTIFICATION  commands## These is some example notification COMMANDS.  They on# your system without modification. As an example, some systems would require # you"/USR/BIN/MAILX"Instead of"/usr/bin/mail" inchThe commands below.##################################################################################'Notify-host-by-email'command Definitiondefine 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 $        }# 'Notify-service-by-email'command Definitiondefine 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 $}

This is the correct command configuration, the most important of which is the command configuration behind/bin/mail

3, Mqueue

ls /var/spool/mqueue

This directory stores the message sending queue,

If this is full, not only will affect the program's operation, and SendMail easy to die, so when necessary to delete. 4, modify the contact address vi/usr/local/nagios/etc/objects/contacts.cfg Modify [email protected] as the address of the contact 5, check whether the sent e-mail delivered, or stranded in the mail server
/usr/lib/sendmail-bp

If the screen appears as "Mail queue is empty" information, it indicates that Mail has been sent out.

6. Send Test mail

Mail-s "Test" [email protected] <content.txt

Content.txt for message content

Nagios Configuring Mail Alerts

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.