Mail can be usedAlarm, you can also install an email reminder tool on your Android phone. If you are in trouble, you can use mobile Feixin, but the current smart phones are basically wcdma and cdma, there are few people around me who use mobile devices. Everyone is on the Internet. Just use third-party email reminders.
In addition, the mail commands provided by linux are often blocked by various email services, especially those of qq and sina ~~~
Therefore, use mutt to log on to the 163 mailbox and then send an alert email. In this way, it will not be blocked. How can we say that 163mail is also a brand ~~~~~~~ I am using Android, and my mailbox is under Netease's Android mailbox apk package. I feel pretty good ...............
The mutt method can also be used in nagios ......
Http://as.baidu.com/a/item? Docid = 649780501 & f = web_alad_1
This is the mutt configuration script, which has integrated a 163 account and password ~~~~~~~~~~ I just created this so that you can send an alert and email directly. Of course, you can change your email password or something ~~~~~~~!!!
#! /Bin/bash
# Info: ruifengyunceshi@163.com 7256958
Wget http://rfyiamcool.googlecode.com/files/msmtp-1.4.18.tar.bz2
Tar xjvf msmtp-1.4.18.tar.bz2
Cd msmtp-1.4.18
./Configure -- prefix =/usr/local/msmtp
Make
Make install
Ln-s/usr/local/msmtp/bin/msmtp
Mkdir-p/usr/local/msmtp/etc
Cat>/usr/local/msmtp/etc/msmtprc <EOF
Account default
Host smtp.163.com
From ruifengyunceshi@163.com
Auth login
Port 25
User ruifengyunceshi@163.com
Password 7256958
Tls off
Syslog on
EOF
Cd ~
Cat> muttrc <EOF
Set sendmail = "/usr/local/msmtp/bin/msmtp"
Set use_from = yes
Set from = ruifengyunceshi@163.com
Set envelope_from = yes
EOF
Cat>/etc/Muttrc. local <EOF
/Bin/msmtp-host = smtp.163.com-domain = 163.com-auth = plain-user = 7256958-f = ruifengyunceshi@163.com-t ruifengyunceshi@163.com-d
EOF
Echo "hello" | mutt-s "baojing" 123l@163.com
This is an alert script. It monitors the URL ~~~
#! /Bin/bash
While true
Do
Url = "http: // 10.10.10.22/index.html"
Status = $ (/usr/bin/curl-s -- head "$ url" | awk '/HTTP/{print $2 }')
If ["$ status "! = "200"]; then
Echo "bad"
Echo "not 200" | mutt-s "baojing" 123l@163.com
Else
Echo "good"
Fi
Sleep 10
Done
Save
Vi baojing. sh
Sh baojing. sh &
This is to monitor the remote port, such as port 80 110 25 1723.
#! /Bin/bash
While true
Do
Newip1 = 120.92.251.18
Date = $ (date-d "today" + "% Y-% m-% d _ % H: % M: % S ")
Newport = 80
# Kkk ()
#{
# Nmap-sT $ newip-p $ newport | grep open
#}
If! Nmap-sT $ newip1-p $ newport | grep open
Then
Echo "$ newip1 is bad $ {date}" | mutt-s "baojing" 123l@163.com
Else
Echo "web is good"
Fi
Sleep 10
Done
This is the slave server status of mysql ~
#! /Bin/bash
Mima= 123123
While true
Do
Mysql-uroot-p $ mima-e "show slave status \ G; "| grep-I Running | egrep" IO | SQL "| grep-I yes | wc-l>/root/num
If [$ (cat/root/num)-eq 2]; then
Echo "mysql slave is running OK !!"
Else
Echo "$ newip1 is bad" | mutt-s "mysql is bad" 123l@163.com
Fi
Done
This article is from "Fengyun, it's her ." Blog, please be sure to keep this source http://rfyiamcool.blog.51cto.com/1030776/910970