?? MySQL Server Alert Script

Source: Internet
Author: User

Author:skate
Time:2014/12/30

MySQL Server Mail Alerts

: http://download.csdn.net/detail/wyzxg/8314745

Implementation method:

According to the system load and session to measure whether the system is now too high load, if the load is too high on the mail alarm (of course, can also be short-term alarm), the current state of the system, running slow SQL, lock status in HTML mail alarm,
You can also bring accessories.


Basic usage:

[Email protected] tmp]#/dbmysqlalarm--help
Usage:alarm Mysql Server Performance v0.1, (C) Copyright Skate 2014
[-h]--dhost dhost--duser duser--dpasswd dpasswd--dport dport
--dname dname--mail Mail--mhost mhost--muser muser--mpasswd mpasswd
--msubject msubject--mconfig mconfig--mkey mkey--mfield Mfield
--attach Attach--dload dload--dsession dsession

Optional arguments:
-H,--help show this help message and exit
--dhost dhost = Monitored database IP address
--duser duser = Monitored database user
--dpasswd dpasswd = Monitored database password
--dport dport = Monitored database port
--dname dname = Monitored database name
--mail mail = Monitored database name
--mhost mhost = Mail Server host Address
--muser Muser = Mailbox username
--mpasswd mpasswd = Mailbox password
--msubject msubject = Mail subject
--mconfig mconfig = Mail Recipient configuration file
--mkey Mkey = The key that mail recipient configuration file
--mfield Mfield = The field that mail recipient configuration file
--attach Attach = Email attachment
--dload dload = Alarm threshold load
--dsession dsession = Alarm threshold Session of database


Example:

#./dbmysqlalarm \
--mconfig=/tmp/dist/list \
--MUSER=DBA \
--mpasswd=pass\
--mhost=localhost \
--msubject= ' real-time Snapshot of Database ' \
--attach= '/tmp/dist/list ' \
--dhost=127.0.0.1 \
--DPASSWD=PASSWD \
--dport=3306 \
--dname=mysql \
--MKEY=DBA \
--mfield=email \
[email protected] \
--dload=0 \
--dsession=0

Parameter description

--mconfig=/tmp/dist/list///Specify the path of the configuration file, if there is a configuration center, you can not use the configuration file, refer to: Http://blog.csdn.net/wyzxg/article/det ails/41972683
--MUSER=DBA//e-mail user name
--MPASSWD=PASSWD//e-mail password
--mhost=localhost///e-mail server address, if you use this machine to send mail, please specify localhost
--msubject= ' Real-time Snapshot of the Database '///Mail title
--attach= '/tmp/dist/list '////The path name of the attachment
--dhost=127.0.0.1//IP address of the database
--duser=root//user name for database
--DPASSWD=PASSWD//password for database
--dport=3306//port number of the database
--dname=mysql///Connection database name, do not do anything to the database, specify MySQL here, of course, you can also create a test library
--MKEY=DBA///config-file key
--mfield=email///config-file field
[email protected]The email address of the specified send message
--dload=0///load threshold for triggering alarms
--dsession=0///number of database sessions triggering the alarm


Note that you first use Mysql-u-p-h-p to test whether you can connect to the database

Configuration file format
# more List
[Command]
Mysqlmon=/tmp/dist/mysqlmon

[Phone]
dba:135******;135********;123*********
skate:138*******

[Email]
Dba:[email protected]; [Email protected]; [Email protected]
Skate:[email protected]


Deployment method

Extract the downloaded file directly, then update the absolute path of the extracted file Mysqlmon to the configuration file.

# TAR-ZXVF Dbalarm.tar.gz

Support version: Because this refers to the "Anysql" hero's Mysqlmon, I test found Mysqlmon currently in CENTOS6 support 5.5.29 above the MySQL (and Anysql confirmed, because he used 5.6 client-side compilation caused the problem): Anysql eldest brother's tools are very useful, we can also apply.

A picture of the alarm message:

------End-----

?? MySQL Server Alert Script

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.