Monitor network status via ping


For the server, the stability of the network is very important. Sometimes there will be an abnormal network connection, so it is necessary to determine the network situation. The connection status of the network can be determined by the ping value.

      The way of monitoring is generally to write a daemon ( XXX.sh under linu; XXX.bat under windows ) , and then write the return value into a file. In this way, when a network situation occurs, you can determine whether it is a network problem or the server itself.

Copy the cmd folder of the same folder into /opt , and then change the status to 777 ,

chmod 777 cmd -R

 

Since the written daemon is executed in one hour, it is mainly for the convenience of distinguishing log files by hours, so it is necessary to add the following command to crontab ( timer ) , and use the definition to execute once every hour.

[root@PH-Elastix02 ping180]# crontab -l

00 * * * * /opt/cmd/ping180/execping.sh

00 * * * * /opt/cmd/ping183/execping.sh

00 * * * * /opt/cmd/e1gw/execping.sh

Each time it is executed, a log file of ping values ​​is created in hours.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326514979&siteId=291194637