Systemd unit support
With just about every distribution out there starting to support systemd, it would be great if monit had support for monitoring units.
I would love to be able to tell monit to watch all/a subset of the enabled units and get metrics and control into m/monit. Systemd has support for getting metrics via the cgroup each service unit runs in, so that's great too...
Comments (7)
-
-
reporter M/Monit offers a nice unified view of all my hosts, including history and alerting.
Systemd is good at keeping the system going and monit is good at monitoring service health.
-
repo owner - changed status to on hold
Need more investigation and if there is a case for overlap. Put on hold for now.
-
Is there any update on this? It would be much appreciated. Something like
check systemd apache with unit httpd.service
would make it super easy to set up things, as virtually all Linux distributions come with systemd scripts for all services.I imagine it would be relatively easy to implement this: you can just wrap the
systemctl {start,stop,is-active,is-failed} <unit>
command. -
repo owner @lonaowna We're sorry we're currently busy with other features, the idea is interesting though and we may implement it in the future.
-
It would be great to have native systemd support in monit.
There are few reasons why it’s needed and why standard pid/procmatch don’t help:
- Daemons managed by systemd rarely use PID files
- Most daemons use systemd “notify” type and notify systemd when daemon is up and running (just the existence of a running process is not enough)
- Systemd supports template unit files and using one template unit you can run multiple processes (like workers) with exactly the same command line. Monit procmatch finds first process and can monitor only one process.
-
I agree
monit
needs systemd unit support.As I have been bugging several developers of other daemons on how to effectively create PID files, it’s increasingly getting harder to have PID file generated for like
rspamd
andcaddy
.Add `--pidfile` to the systemd unit file in the official package (caddy)
PID file no longer gets created (rspamd)
It’s mainly because the units start with unprivileged user and thus cannot write to
/var/run
orPIDFile=
option in the unit file doesn’t seem to work for other thanType=forking
or that PrivateTmp is enabled in the unit file andmonit
cannot reliably find where the PID file is under randomly generated directory bysystemd
in/tmp
.If
monit
can support finding the PID throughsystemd
by specifying the unit name in the config, it would greatly improve the usability against several daemons with something along the line ofCHECK PROCESS caddy UNIT caddy.service
.From
systemd
, you can take the PID of the process without a PID file withsystemctl show --property MainPID caddy.service
. - Log in to comment
Why not use systemd?