nook24 / statusengine

New PHP based MySQL Backend for Naemon and Nagios 4 + responsive web frontend
https://statusengine.org/
GNU General Public License v2.0
16 stars 8 forks source link

Watchdog workers/childs, fix systemd-restart on crash by exception #44

Closed dhoffend closed 6 years ago

dhoffend commented 6 years ago

This pull request takes care of multiple things

1) no restart on crash (php exception) by systemd

When php throws an exception usually the returncode is 255. But when using set_exception_handler to handle internally the exception the exit code of cake.php script is always 0 even when crashes. This seems to be a cakephp related problem. If systemd restart mode is set to "always", systemd takes care on a crash (for example: when the database goes down)

2) watch workers and restart them when needed

sometimes a worker can crash (database related stuff, exceptions or other external inputs). The main process should take care of this, handle SIGCHLD events and restart missing childs.

3) when started via systemd the logout gets duplicated

per default statusengine_legacy logs per default to stdout and syslog. this duplicates the log in syslog (1x from systemd stdout, 1x statusengine syslog)

nook24 commented 6 years ago

Hi @dhoffend, thanks for your PR. I will merge this into the watchdog branch and take a look at it.

I will drop a notice here, if it got merged into master.

nook24 commented 6 years ago

Done and released in 2.2.0: https://github.com/nook24/statusengine/releases/tag/2.2.0

nook24 commented 6 years ago

I also implemented this to Statusengine 3 Worker: https://github.com/statusengine/worker/pull/8