Quote from: allddd on Today at 09:15:34 AMDoes it have to be an LAN host, or would it be OK for an external service to notify you?
You could use a service like https://healthchecks.io in combination with Monit. This would be even more reliable, since you would receive a notification regardless of whether you are currently using the system or not.
While a service like healthchecks.io would be fantastic in lots of scenarios, it isn't a good solution for the problem I'm trying to solve.
The risk I'm trying to eliminate is one in which things stop working while I'm at my desk... in a location where I could address any transitory problem - if I had noticed the issue. I have poor mobile phone signal and rely upon Wi-Fi calling (which relies upon my router) and all email is also dependent upon the same local networks and services. I plan to write a script that will make many checks - covering all sorts of services I run on my LAN... and to have it drive a small GUI app on my desktop computer report a green ":-)" or red ":-(" icon on my task bar (alongside any error message generated from my script).
I've already evaluated services that (try to) push notifications to me over the Internet. I see such facilities as being very useful in some circumstances... but I particularly want to be able to monitor from my LAN to verify that everything on my router is 'happy' - and that my local services have not failed/stopped. I can only administer my OpnSense router and local services from my LAN - so I gain little if I get notifications on my mobile phone when I'm not at my desk. I'm aware of two potential strategies to query the status of my internet up-links from a host on my LAN:
- Use the restful API for OpnSense. I'm not sure which API calls I should use as the documentation doesn't seem very helpful/informative/accurate/complete.
- Run some command-line tool(s) on the OpnSense host over SSH. I'm aware of configctl, for example, but I'm not sure which OpenSSH command-line tool would give the most appropriate diagnostic output.
I had hoped that the Rest API would be perfect for my purposes (though I'm struggling to establish how to use it in practise). I'm aware of tools like configctl, which I can run over SSH, but it's not clear to me how I can get them to yield the status information that's of interest to me. For the problem I'm trying to tackle, I definitely want to automate my own scripted checks.. that I will write, which will be run on a host connected to my LAN, rather than purchase some additional external service. I'm surprised at how difficult this has proven to be with OpnSense.
P.S. I've found this thread - which suggests the API endpoint /api/routing/settings/searchGateway should do what I want. When I try to call it, I get a 400 response with the message "controller OPNsense\\Core\\Api\\IndexController not found" - I get the same thing if I substitute "search_gateway" for "searchGateway" in the URL.
"