Original content, if you want to reprint, please specify the source.
itself because in the installation of the main hot standby high availability MySQL cluster environment, need to involve keepalived mail alarm, mail alarm and need to configure SendMail implementation. So feature this article to record this experience. (This content only involves sendmail part, the entire high available MySQL cluster configuration, the next time to write again.) )
1.rpm-qa | grep MAILX
Center 7 is equipped with a 12.5 version of the MAILX, if there is no need to install again,
Rpm-qa | grep sendmail
Yum-y Install SendMail
2.vim/etc/mail.rc Add the following two lines
Set from=123456@139.com smtp=smtp.139.com
Set smtp-auth-user= your mailbox username smtp-auth-password= your email password smtp-auth=login
Restart SendMail
Service SendMail Restart
echo "Your email content" | Mail-s "Your email subject" Address, for example
echo "Yes, so Good" | Mail-s ' This is Test Mail ' 12345@qq.com
You can also view the contents of a file to send messages. Such as
Cat Hostip.txt | Mail-s ' This is Test Mail ' 12345@qq.com
So, we can write a few automated scripts, output the monitoring results to a txt, and then send the contents of the file to your mailbox
Using the form of a carry attachment, I tried, very slowly, and later found a good way to tell you.