I have set up OH1 (latest version) on my RPi3 (Raspian) using apt-get. OH1 starts automatically when my RPi3 is booting. This works rock solid.
During the last night though OH1 seemed to be crashed. I noticed this not until this morning. Raspian indeed was still running (ssh connection this morning worked fine). But my sitemap couldn’t be accessed anymore. So I assume the OH service crashed. I’ve done a “systemctl restart openhab” and all went back online.
As I am also a Linux beginner, is it possible to monitor if the openhab service is running? And if it’s not “alive” anymore, do an automatic restart?
Do you guys have integrated a regular check on your installations?
Next time don’t assume, check with
systemctl status openhab. This is important because if OH actually did crash (i.e. was no longer running) then systemctl should have tried to restart OH on its own. If it didn’t it could be configured to do so.
However, if OH was frozen but still running, there really isn’t much you can do beyond running some sort of external script that runs externally to OH and somehow checks that OH is still operating.
Also check openhab.log to see if there was an error or something like that which caused it to freeze or crash. It is far better to understand and prevent a crash than to bolt on some monitor to restart things when they go wrong. I know sometimes there is no way around that (I myself use the NH binding and a zwave outlet to restart my remote Pis when they fall off the network for too long) but it is always best to have the server just keep running.
You can install and configure the my.openhab binding and one of the openHAB apps on your phone. This will cause an alert on your phone when openHAB goes offline. This is another way to tell when OH has gone offline (or at a minimum the network between OH and the my.openhab servers is down).
And for comparison, I’ve never had OH crash or freeze on me (knock on wood) and unless I’m actively developing my automation it remains running for weeks or months at a time. So it is possible for OH to run very reliably.
Not for OH.
Thanks Rich. Helpful and honest as usual!
I didn’t knew the systemctl status command (Linux beginner…), so I will do this next time (hopefully there isn’t a next time…). I checked the openhab.log and couldn’t find anything unusual. Also, I am using my.openhab already, but I wasn’t aware that the app (installed on my iPhone) will automatically tell me if the connection is lost. I will check this also.