Mail alert configuration in Linux

Source: Internet
Author: User

Mail alert mechanism in Linux

The alarm mechanism in Linux is a key part of operation and maintenance management. We generally detect problems through monitoring, common monitoring software such as: Zabbix is now in use and ready to use. If we do not monitor the alarm through third-party software, we will need the mail sending function that comes with Linux.

The following alarm configuration for the work, small experience. To share with you the following:


1, check MAILX version information is greater than 12.*, otherwise need to update the installation

2. Add the following changes to the # vim/etc/mail.rc:


Set [email protected] Specify an external mailbox to send mail to

Set smtp=smtp.163.com server domain name format for sending mail: smtp.*

Set Smtp-auth-user=apple account to login to the mailbox (also sender name)

Set SMTP-AUTH-PASSWORD=888AAAAAAA password for the login mailbox (the password for the sender's mailbox)

Set Smtp-auth=login login mode


Send mail

# echo "3333" | Mail-s "6666" [email protected]

Command explanation:

3333: Indicates the content of the message being sent.

6666: Indicates the name of the message being sent.

[email protected] means sending it to that email.

===========================================================================================

Example: Execute the command periodically to send the result message to the specified mailbox

# Vim/root/aa.sql

Select User,password,host from Mysql.user;


# Vim Ning.sh

#!/bin/bash

#

/opt/mysql/bin/mysql-uroot-pning-d mysql-e "Source/root/aa.sql" >>/home/nhl/tmp/a.txt


/bin/mail-s "1" [email protected],[email protected]


# Vim/etc/crontab

0 * * * sh/root/ning.sh



This article is from the "struggling People" blog, please be sure to keep this source http://wodemeng.blog.51cto.com/1384120/1641988

Mail alert configuration in Linux

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.