Simple latency sensor, useful for remote wireless links. It parses the latency reported by the ping tool, and if the values exceeds the configured thresholds a mail to the admin will be sent with the html formatted data.
- sendmail command (As a MTA or as a MUA with ESMTP).
-
git clone https://github.com/facundovictor/latency-sensor.git
-
chmod 500 sense.awk
-
Edit the ip.conf file. The scripts reads it, and for every line, it parses the following fields (separated by one single space):
<Host description> <IP/FQDN> <Tolerance threshold of packet loss> <Tolerance threshold of average packet latency>
- Edit the /etc/crontab file to check it. As an example, let's say we need to check it every 15 minutes:
0,15,30,45 * * * * root /opt/sense.awk /opt/ip.conf
- Configure the sense.awk script:
# Destination mail
mail_destination="admin@mydomain.com"
# Amount of echo requests
attempts=20
# Seconds elapsed between every echo request
interval=1
This mail can be received because of an abnormal latency, or a packet lost. The experiment sample is of 20 echo requests .
Description | HOST | IP | Transmitted | Received | Packet Lost | PL Limit | Min | Max | Average | Avg Limit | Deviation |
---|---|---|---|---|---|---|---|---|---|---|---|
AP_street_2_3.3 | 192.168.3.3 | 192.168.3.3 | 20 | 0 | 100% | 0% | ∞ ms | ∞ ms | ∞ ms | 8 ms | ∞ ms |
AP_street_1_2.2 | 192.168.2.2 | 192.168.2.2 | 20 | 16 | 20% | 0% | 1 ms | 3 ms | 2 ms | 8 ms | ∞ ms |