Linx monitoring sharing--key process monitoring (MYSQLD) + Email alerts

Source: Internet
Author: User

Key process Monitoring

MYSQLD: Process exited, alarm. Monitor mysqld (CPU (>=100%) | | mem (>=80%)) to start alerting while collecting and analyzing MySQL status information; number of connections (>=max_connections * 0.8) Start alert; number of open handles ( >=8192*0.8? ) to start a reminder.

Waiting to be perfected ...

If it is a single-machine multi-instance, just need to add a for loop just fine.

On the mobile phone to install NetEase's mail client, you can achieve the effect of real-time reminders.

For the configuration of mail, see previous article: http://blog.csdn.net/rookie_ceo/article/details/46559195


#!/bin/shsource/etc/profileip= '/sbin/ifconfig|sed-n '/inet addr/s/^[^:]*:\ ([0-9.] \{7,15\}\). */\1/p ' |grep-v ' 127.0.0.1 ' warn_pct=1 #75warn_name =[mysqld]performance_path=/monitor/ performancemailtmp=/u01/soft/smonitor/mailtmplet/"$warn _name" tmp.mailinfotmp=/u01/soft/smonitor/mailtmplet/"$ Warn_name "tmp.tmp[email protected],[email protected] dt= ' date +"%y-%m-%d%h:%m:%s "' mysqld_pid= ' ps-ef| grep mysqld|grep-e "Basedir|datadir" |grep-ve "Mysqld_|grep" |awk ' {print $} ' #mysqld_pid = ' Ps-ef|grep mysqld|grep-e  "Basedir|datadir" |grep-ve "mysqld_|grep|mysqld" |awk ' {print $} ' if ["0" = "0$mysqld_pid"]then echo "Hello:" > $mailtmp echo "[$DT] Server: $IP The MYSQLD process has exited, please note. "#>>" $performance _path "/performance_$warn_name_$ (date +%y%m%d). Log echo" [$DT] Server: $IP The MYSQLD process has exited , please note. ">> $mailtmp ps-ef|grep mysql >> $mailtmp echo-e" [$DT] $p 1 ">>$ Mailtmp echo-e "\nbest Wishes! \ n------------------------------------\nca system Monitor \n$dt ">> $mailtmp cat $mailtmp | Mailx-s "$warn _name[Alarm]: server: $IP" $maillistelse echo "mysqld_pid= $mysqld _pid" top-b-n 1-p $mysqld _pid >$ Infotmp #cpu >= 100% or mem >=80% # #这里是约等于 over_pct_flag= ' Cat $infotmp | grep "^ *[1-9]" |  awk ' {if ($9 > | | $ >) {Print 1} else {print 2} ' ' Echo ' over_pct_flag== $over _pct_flag "if [1-eq "$over _pct_flag"] then echo "Hello:" > $mailtmp echo "[$DT] Server: $IP mysqld process CPU and mem exceeded alert value (CPU >= 100% or mem >=80%), please note. "#>>" $performance _path "/performance_$warn_name_$ (date +%y%m%d). Log echo" [$DT] Server: $IP mysqld process CPU and Mem exceeds the alert value (CPU >= 100% or mem >=80%), please note. ">> $mailtmp echo-e" [$DT] $p 1 ">> $mailtmp cat $infotmp >> $mailt MP dt= ' date + '%y-%m-%d%h:%m:%s "' Echo-e" \nbest wishes! \ n------------------------------------\nca system Monitor \n$dt ">> $mailtmp cat $mailtmp | Mailx-s "$warn _name[Alarm]: server: $IP" $maillist Fifi


Email alerts



Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Linx monitoring sharing--key process monitoring (MYSQLD) + Email 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.