I've done some searching already and I'm not really coming up with anything. I would like to get an email notification when a specific client goes offline. It is connected through ethernet and ideally should always be online but for whatever reason goes offline every week or two.
I'm trying to diagnose and fix whatever is causing it to go offline but I think that starts with figuring out when it goes offline.
Since the client is connected via Ethernet, you need to be more specific about what you mean by "offline".
If the outage is between the router and the client, you could use the watchcat package.
The newer version has an option to run a script if a ping to a specific host fails.
If the client only loses access to the Internet for some reason, it would be more complicated.
Since you need to investigate the system journal on the client anyway, it is logical to create a scheduled task checking connectivity and logging its status directly on the client.
Again, where exactly is the problem?
Between the client and the router or the client and the Internet?
When the client goes "offline" can you ping it from the router?
How exactly do you restore the connectivity - restarting the client, the switch or the router?
If it's all about finding out when this happens, follow the vgaetera's advice and
The client freezes and becomes unavailable. When I hook a monitor to it, the monitor doesn't show anything either. I cannot ping it from the router when the client goes offline. I restore connectivity by doing a hard restart of the client. Client is basically a bitcoin node running on raspberry pi 4. The problem isn't with the switch, the router or the modem.
I need an alert when the client goes offline or becomes unavailable so I know there is a problem. I don't realize there is a problem until days or maybe a week after the problem started. I'm sure there is information in the logs about when things started having problems, but if the client freezes or becomes unstable, logging may not work either.