[systemd-devel] monitoring systemd unit flapping

Lennart Poettering lennart at poettering.net
Sat Apr 29 11:48:29 UTC 2017


On Tue, 25.04.17 11:30, Jeremy Eder (jeder at redhat.com) wrote:

> If we have a service that is flapping because it's crashing after
> startup...what's the right way to monitor for that condition?  Eventually
> it triggers startburstlimit, was thinking that if we hit startburstlimit
> that the service could set some special bit that we could look for.
> 
> Like ... systemctl is-flapping myservice --quiet
> 
> Any other possibilities?

The unit will be placed in "failed" state if the start burst limit is
hit. it will be placed in that state in other conditions too, hence to
determine the precise reason why your service entered that state check
the "Result" property on it.

# systemctl show -p Result my.service

Yes, this is a bit uncerdocumented.

On recent systemd versions you can also add a drop-in to your service
that defines an ExecStop= stanza. The program you specify there will
receive an env var $SERVICE_RESULT with the same value.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list