Check and notify when selected services are not running?

Hi everyone,

from time to time I find that services are not running on my FB for no apparent reason - lastly it was coturn and matrix-synapse. When I start them manually, everything is fine again.

Now I was wondering if there is an easy and user friendly way the FB admin can get an email when pre selected services either fail to start or just fail during run time? I could setup a cronjob for that but maybe there is also a way for the less tech savvy?

Thanks a lot in advance!

1 Like

This is a feature systemd supports; check through this thread for some ideas how to set it up:

There is also a GitHub project linked at the bottom of the thread that might be a simpler way to set it up:

A few months ago I had a similar idea, and I put together a configuration with Nagios that monitors FreedomBox services. It is currently only feasible for technical folks, but one day something like this hopefully will become an official part of FreedomBox.

1 Like

Thanks for your suggestions! So I am not the only one having that problem hu? :slight_smile:

I was thinking if something very very simple like putting a line like this into a cronjob and let it check every hour or so

systemctl is-active --quiet matrix-synapse.service || (echo '…' >> log.txt && systemctl restart matrix-synapse.service).

As to the official feature: I hope something like this will be implemented in the near future - i .e. in form of a checkbox in the resp. application page, like:

[ ] Send me an E-Mail if Matrix-Synapse fails and attempt automatic restart of the service

In my opinion this would really increase the reliability of time critical services…

1 Like

The problem is that most of the times when Matrix breaks down it’s because of an unresolved software dependency after an update. Restarting the service will not solve the issue…

The problem is that most of the times when Matrix breaks down it’s because of an unresolved software dependency after an update.

Yeah I had this issue once but in my setup Coturn regularilly fails to start although I configured systemd explicitly to start it up after matrix-synapse. So in that case I would appreciate a notification before I actually need coturn again. It’s always a pain in the ass to start tinkering when you actually only want to have an Element conversation…

I accidentaly found a decent solution for my problem. I post it here in case somebody needs it. I use monit a lightweight server monitoring tool.

After the basic setup I use following configuration for coturn monitoring:

check program coturn with path "/usr/bin/systemctl --quiet is-active coturn.service"
start program "/usr/bin/systemctl start coturn.service"
stop program "/usr/bin/systemctl stop coturn.service"
if status != 0 then alert
if status != 0 then restart

I also set up other services such as cron and sshd. So far everything works flawlessly. In case of failure I get a notification mail and a restart is triggered.

The configuration is quite simple and painless.
Way simpler then scripting and testing my own solution!

4 Likes