elad-bar / ha-edgeos

Integration with EdgeOS (Ubiquiti)
134 stars 23 forks source link

Request: Ping From Router #125

Open Lekskog opened 4 months ago

Lekskog commented 4 months ago

Is it possible to make so you can Ping a server via the router. For example i want to ping 8.8.8.8 every 30 seconds via my edgerouter to check my delay to the internet.

elad-bar commented 3 months ago

looks like it is possible and pretty easy to implement, need to subscribe to new topic over websocket:

{"SUBSCRIBE":[{"name":"ping-feed","sub_id":"ping1","target":"8.8.8.8","count":"","size":""}],"UNSUBSCRIBE":[],"SESSION_ID":"1234"}

and then the websocket will report the status:

{
    "ping1": "PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.\n64 bytes from 8.8.8.8: icmp_seq=1 ttl=64 time=0.174 ms\n"
}

using that practice I can add also bandwidth test, trace route and packet sniffer