How to monitor network connectivity?
I'm playing with the new Omgea2S+ (Pro) board and I have it tethered to my cell phone for network connectivity. I'm not using the web interface at this moment, but doing everything over the USB serial connection on my computer through Teraterm. (it's like putty)
I've noticed that when I walk away from my desk with my phone, the board loses network and the blue light goes out. When I come back with my phone, the blue light comes back on and a message gets written to the terminal: [17932.593554] Interface apcli0 link up! (WPA2PSK AES)
I said to myself, that's neat! And tried to do it while sitting at my desk by turning off my wifi hotspot. When I turn off my hotspot, the blue light goes out like normal, when I turn on my hotspot, I still get the "link up!" message, but the blue light doesn't come back on. Only when I walk far enough away to the point where it loses signal and then coming back in range does the blue light come back on. What process is controlling the blue LED?
I checked the logs: readlog -e link
and I see
Tue Feb 12 15:54:57 2019 daemon.notice netifd: Network device 'apcli0' link is down
Tue Feb 12 15:54:57 2019 daemon.notice netifd: Interface 'wwan' has link connectivity loss
Tue Feb 12 15:54:58 2019 daemon.notice netifd: Network device 'apcli0' link is up
Tue Feb 12 15:54:58 2019 daemon.notice netifd: Interface 'wwan' has link connectivity
so it must be netifd doing the detection? but something else is controlling the notification led, maybe?
And seeing all of this made me want to create a script that monitors the network or a script that ties into the already running process that monitors the network, to keep track of when it's up and when it's down. When it's up, it could send a payload over MQTT with the times of "up" and "down" events, it could also send other cached data, (temp, location, photos) once there is a network connection again.
I could use this in my car, geo-tagging photos taken while driving, caching everything locally, then when I pull into the garage, it offloads everything once the network connection is reestablished.