Linx monitoring sharing-Key Process Monitoring (mysqld) + email reminder, linxmysqld

Source: Internet
Author: User

Linx monitoring sharing-Key Process Monitoring (mysqld) + email reminder, linxmysqld

Key Process Monitoring

Mysqld: The process exits and an alarm is triggered. If you do not exit, you will be notified of monitoring mysqld (cpu (> = 100%) | mem (> = 80%) and the mysql status information will be collected and analyzed; number of connections (> = max_connections * 0.8) start to remind; number of opened handles (> = 8192*0.8 ?) Start reminder.

To be improved...

If it is a single machine with multiple instances, you only need to add a for loop.

Install Netease's email client on your mobile phone to receive real-time notifications.

For mail configuration, see the 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. tmpmaillist = 490073687@qq.com, zhou.xiangxing210@163.com DT = 'date + "% Y-% m-% d % H: % M: % S" 'mysqld _ pid = 'ps -Ef | grep mysqld | grep-E "basedir | datadir" | grep-vE "mysqld _ | grep" | awk '{print $2} ''# mysqld_pid = 'ps- ef | grep mysqld | grep-E "basedir | datadir" | grep-vE "mysqld _ | grep | mysqld" | awk '{print $2} ''if [" 0" = "0 $ mysqld_pid"] then echo "Hello: "> $ mailtmp echo" [$ DT] server: $ IP mysqld process has exited. Please note that. "#>" $ Performance_path "/performance _ $ warn_name _ $ (date + % Y % m % d ). log echo "[$ DT] server: $ IP mysqld process has exited. Please note that. ">>$ Mailtmp ps-ef | grep mysql >>$ mailtmp echo-e" [$ DT] $ p1 ">>$ mailtmp echo-e" \ nBest Wishes! \ N ---------------------------------- \ nCA system Monitor \ n $ DT "> $ mailtmp cat $ mailtmp | mailx-s" $ warn_name [alert]: Server: $ IP "$ maillistelse echo" mysqld_pid = $ mysqld_pid "top-B-n 1-p $ mysqld_pid> $ infotmp # cpu> = 100% or mem> = 80% # Here is approximately equal over_pct_flag = 'cat $ infotmp | grep "^ * [1-9]" | awk '{if ($9> 99 | $10> 79) {print 1} else {print 2} ''echo "over_pct_flag = $ over_pct_flag" if [1-eq "$ o Ver_pct_flag "] then echo" hello, "> $ mailtmp echo" [$ DT] Server: $ IP mysqld process CPU and Mem exceed the warning 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 warning value (cpu> = 100% or mem> = 80%). Please note. ">>$ Mailtmp echo-e" [$ DT] $ p1 ">>$ mailtmp cat $ infotmp >>$ mailtmp 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 [alert]: SERVER: $ IP "$ maillist fifi


Email reminder



Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.