Ask HN: How do you monitor your systemd services?
21–30 of 61 posts
Re: Ask HN: How do you monitor your systemd services?
#22This is really more in the realm of a shell script.
You could do this verbosely:
#!/bin/sh
/path/to/my/backup_job
if [ $? -ne 0 ]
then /path/to/my/failure_alert
fi
...or, you could do this tersely: #!/bin/sh
/path/to/my/backup_job || /path/to/my/failure_alert
The wrapper script would go into your timer unit. I like dash.Re: Ask HN: How do you monitor your systemd services?
#23`0 * * * * journalctl --since="61 minutes ago" --priority=warning --quiet` In crontab piped to a bunch of grep -v for the things I want to ignore So basically the email approach, just have to be religious about marking unread if not immediately actioned
Re: Ask HN: How do you monitor your systemd services?
#24I wrote a little script that puts a failed service count in waybar, and throws up a dismissable swaynag message with buttons to 'toggle details', and reset or restart the failed system/user units.
It's a bit noisy at the moment - but I think that's probably just a helpful indication of units I need to sort out/make a bit more robust anyway.
Re: Ask HN: How do you monitor your systemd services?
#25If you are ok with a Saas and if it's just scheduled jobs that you are monitoring, there are a number of monitoring tools where you tell when job completes (with a http request) and a missing ping (after a grace period) means that it failed. I think https://deadmanssnitch.com/ may have been the original service for this. https://healthchecks.io/ has a fairly generous free tier that I use now. There are others that do…
Re: Ask HN: How do you monitor your systemd services?
#26Re: Ask HN: How do you monitor your systemd services?
#27Re: Ask HN: How do you monitor your systemd services?
#28OnFailure=send-push-notification.service
Perhaps via a WhatsApp notification or any other instant message [0] or any other service such as matrix as said in another comment.
[0] https://developers.facebook.com/docs/whatsapp/cloud-api/get-...
Re: Ask HN: How do you monitor your systemd services?
#29Short answer: Prometheus + Grafana + Alertmanager. prometheus_node_exporter has an option to export SystemD service status and you can alert on failed services, and you can use Alertmanager to configure multiple types of alarms, including repeats so you don't forget. Long answer: Whenever I've started to add alerting and monitoring to a system, I end up wanting to add more things each time, so I find it valuable to s…
> Short answer: Prometheus + Grafana + Alertmanager. Or, a higher-level recommendation, appropriate for most SMBs: sign up for Grafana Cloud's managed prometheus+grafana (or any equivalent external managed monitoring stack), and then follow their setup instructions to install their grafana-agent monitoring agent package (which sticks together node_exporter, several other optional exporters enable-able with config sta…
Observability is hella expensive. Orgs should consider TCO when making such decisions. Paying a few hundred thousands more for the skills to self run could literally chop tens of millions off vendor bills.
Re: Ask HN: How do you monitor your systemd services?
#30If you do like the notification method aside from this issue, try passing "--urgency=critical" or "--expire-time=0" to notify-send. Either (or both) of those should make the notifications stay popped up, assuming your notification daemon is doing something reasonable with those hints.
(Disclosure: I'm the author of xfce4-notifyd, which does behave in this way; other daemons may do other things.)