Linx monitoring sharing--disk space monitoring + email alerts

Source: Internet
Author: User

Share the first monitoring script, mount point disk space usage monitoring: If the use of space reached 75% to start the alarm, send a warning message.

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=70warn_name=[disk]performance_path=/monitor/performancemailtmp=/ U01/soft/smonitor/mailtmplet/disktmp.mail[email protected],[email protected]tt= ' Df-h|awk ' {print $6 ', ' $ "," $ "," $ $ "," $4} ' |tr ' \ n ' "" dt= "date +"%y-%m-%d%h:%m:%s "' #echo $ttOLD _ifs=" $IFS "ifs=" "arr= ($TT) ifs=" $OLD _ifs " For i in ' ${!arr[@]} "do #echo $i" "${arr[$i]}" If [$i-ge 1] then #echo "$i" "${arr[$i]}" disk_ Pct= ' echo ' ${arr[$i]} "|awk-f ', ' {print $} ' | Cut-f 1-d "%" ' #echo "disk_pct= $disk _pct warn_pct= $warn _pct" If [$disk _pct-ge $warn _pct] #if [$disk _p Ct-ge]then echo "Hello:" > $mailtmp echo "[$DT] Server: $IP disk: ${arr[$i]} usage has reached $warn_pct%, please Timely processing. "#>>" $performance _path "/performance_disk_$ (date +%y%m%d). Log echo" [$DT] Server: $IP disk: ${arr[$i]} usage Have reached $warn_pct%, please deal with it in time. ">&GT $mailtmp pp=${tt///\\n} echo-e $pp >> $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[Alarm]: server: $IP" $maillistfi Fidone

Email Alert effect



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

Linx monitoring sharing--disk space monitoring + 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.