motioneye-project / motioneye

A web frontend for the motion daemon.
GNU General Public License v3.0
3.93k stars 651 forks source link

RFE: alive health check URI #1924

Open ikke-t opened 3 years ago

ikke-t commented 3 years ago

Hi,

as a user I would like to have simple http reply if motioneye and motion are running ok.

I have this problem that every now and then the system either freezez, or camera image get's carbled. So there are two options, either USB connection or camera doesn't work, or the whole device is not responsive from ethernet.

I'd like to monitor that. For such service, it would be great if there was an url, e.g. "/health", that would just respond e.g. "OK" and http code 200 if everything is fine. I could then use that for the HAproxy to check if system is alive. That I see then from grafana, and get to do alerts from it. Or if someone want's to use prometheus, or whatever to monitor the proxies.

It could be possibly even a separate port if so needed, or optinally configurable. Sometimes that's handy for not trashing the access logs by monitoring tool hitting the URL constantly.

To get the OK message all features should be serving fine. It should also fail if e.g.:

Currently I can pull the whole page for such ok, but that is too heavy. Also I could select the smalles image, e.g. motioneye logo, to be checked for access. But such things won't show up if camera is in faulty state.

ikke-t commented 3 years ago

For reference, this is what I have in my HAproxy config for the liveness probing:

    option httpchk GET /static/img/small-progress.gif HTTP/1.0
    mode http

That's the smallest unit I could find to pull from there. This of course won't tell anything about the state of video camera. This is from my OPNsense firewall's HAproxy config, which then uses telegraf plugin to push the HAproxy stats to influxdb.