In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how to achieve a ping detection alarm function, the article introduces in great detail, has a certain reference value, interested friends must read it!
The code is as follows:
#! / bin/bash
Ping_monitor ()
{
Host_= (203 204 205 207 208 209 210 212 213 214 215 216 217 218 219 220 221)
Ping_count=3
Called= (13000000001 130000002 130000003)
Calling=13000000000
Callop=1310000000
# main
Echo "`date" +% Y%m%d% H:%M:%S "`- > script starts execution." > > ping_log
For host_1 in ${host_ [*]}; do
Host=192.168.1.$host_1
Echo "- > start to check whether the communication of $host server is normal, and the number of ping times $count"
Ping_result= `ping $host-c $ping_count | tail-2 | head-1`
# sleep 1
Echo "- > Server $host detection completed"
# take the number of successful messages
Succ_ping= `echo ${ping_result:23:1} `
# take the percentage of failure
Loss_ping= `echo ${ping_result:46:4} `
If [$succ_ping-eq $ping_count]; then
Echo "this test result-> $host server ping test is normal"
Echo "`date" +% Y%m%d% H:%M:%S "`--> $host server ping detection is normal" > > ping_log
Else
Echo "results of this test-> $host server has lost packets, and the packet loss rate is: $loss_ping"
Echo "`date" +% Y%m%d% H:%M:%S "`--> $host server has lost packets. The packet loss rate is $loss_ping" > > ping_err_log.
# insert SMS list-smssend00
For called in ${telno [*]}; do
Mysql-h$dbhost-u$dbuser-p$dbpass-D$dbbase > ping_log
}
The above is all the contents of the article "how to implement a ping detection alarm function". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.