0

I am looking for a way to monitor systemd services: Basic things such as whether they are running or not is a good start (and anything else on top is a bonus).

I tried using node_exporter, but since I am running all my services rootless (systemctl --user) I don't see them being captured.

My question is: How can I monitor the state of all my systemd services with the note that I am running my systemd services as a non-root user?

Newskooler
  • 211
  • 1
  • 3
  • 14
  • How do you want to monitor the? With snmp? A local script exporting the data? Are you using a specific monitoring tool? – setenforce 1 Feb 06 '23 at 08:42
  • I am already using Prometheus + Grafana, so if I can leverage that it would be perfect. But that's not a must-have constraint for me. I'd just like to understand the best practice of how it's done and implement it. – Newskooler Feb 06 '23 at 08:47

1 Answers1

2

For prometheus / node_exporter, you can use the --collector.user argument to connect to the user running the services you want. See here

setenforce 1
  • 1,200
  • 6
  • 10
  • So if I understand you correctly, i should use systemd_exporter and not node_exporter in order to scrape more detailed sysmted metrics for the user? – Newskooler Feb 06 '23 at 10:25
  • Yes, according to [this](https://quinncasey.com/systemd-exporter-for-user-services/), node_exporter only collects for root. – setenforce 1 Feb 06 '23 at 10:41
  • 1
    It seems to work! Thanks Please only change the flag to `--systemd.collector.user` as that was the latest one and the one that worked. – Newskooler Feb 06 '23 at 10:42