Score:0

How to monitor systemd?

it flag

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?

setenforce 1 avatar
us flag
How do you want to monitor the? With snmp? A local script exporting the data? Are you using a specific monitoring tool?
Newskooler avatar
it flag
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.
Score:2
us flag

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

Newskooler avatar
it flag
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?
setenforce 1 avatar
us flag
Yes, according to [this](https://quinncasey.com/systemd-exporter-for-user-services/), node_exporter only collects for root.
Newskooler avatar
it flag
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.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.