7/30/2023 0 Comments Monit license![]() ![]() (it's really a pain that we cannot comment 0 if it fails. So it might not be available in your distro, so I commented out this line )Įdit after response from OP (I hope you get notified): Getting loadavg with per core requires latest Monit-version. If 3 restarts within 5 cycles then unmonitor If totalmem > 2 GB for 5 cycles then restart If loadavg (5min) > 4 for 5 cycles then restart # if loadavg (5min) per core > 1 for 5 cycles then restart Stop program = "/usr/bin/systemctl stop libreoffice-server" # Unit name is an assumption! Start program = "/usr/bin/systemctl start libreoffice-server" # Unit name is an assumption! My config on this (not knowing what protocol is used by :8101, assuming http) would be more like this: check process libre-local with pidfile "/var/run/libreoffice-server.pid" chmod +x /opt/libreoffice/*.sh) and you have a correct shebang in those files, you can omit /bin/bash in your executes for better readability. So you might also check with check process and perhaps some send/ expect magic to verify the service is running. If I get it correctly ( see this question), the headless server will create a PID-File.This means nothing is done by Monit if status is 0. If 2 restarts within 3 cycles then unmonitor If status != 0 then exec "/opt/libreoffice/loproc_is_down.sh" To optimize it, you should only catch problems with Monit: check program lo-check-8101 with path "/opt/libreoffice/chkloproc.sh TestLOPort8101 8101" So to say: With this config there is not "success" (= everything is fine) case. Everything's okay here, so why executing something? I don't even get what the result of this call should be. if status = 0 then exec "/bin/bash /opt/libreoffice/loproc_is_up.sh"Ī problem occurs if status is 0. if status != 0 then exec "/bin/bash /opt/libreoffice/loproc_is_down.sh"Ī problem occurs if status is not 0. Store the exit code and some additional info. So - line by line - your config tells Monit: check program lo-check-8101 with path "/bin/bash /opt/libreoffice/chkloproc.sh TestLOPort8101 8101" with timeout 10 secondsĮxecute a binary. Monit is there to catch problems on a monitored entity. Thank you for reading this long post and hopefully help me with an answer. I am not understanding the meaning of "status" in the monit concept / documentation. but then again is logging "error: status failed (0)" in the following cycles. Which looks like monit runs that check-script, which is returning exit code 0 and starts the action-script "loproc_is_up.sh" and reports it with "status succeeded (0)" ![]() info : 'lo-check-8101' status succeeded (0) - no output Monit log when service is running again error : 'lo-check-8101' status failed (0) - no output The opposite is when starting that LibreOffice Process again: info : 'lo-check-8101' exec: '/bin/bash /opt/libreoffice/loproc_is_down.sh' error : 'lo-check-8101' status failed (101) - Error: Existing listener not found. Monit log with faked failure info : 'lo-check-8101' status succeeded (101) - Error: Existing listener not found. When I try to fake a broken LibreOffice Process by stopping it, monit does recognize this after one cycle and is starting the wanted / configured action-script 'loproc_is_down.sh' and reporting the last exit code correctly as 101, but with the log-line What does status mean other than the interpretation of the last exit code of the given check-script programm?Īnd there is another reaction from monit, which I can't understand, perhaps anybody can explain it to me? I don't understand, why monit is reporting an "error. To me it seems, that the check-script is returning exit value 0 but status is reported / interpreted as "Status failed". and the following status screen from 'monit status': monit status info : 'lo-check-8101' exec: '/bin/bash /opt/libreoffice/loproc_is_up.sh' error : 'lo-check-8101' status failed (0) - no output Monit log after restart info : Starting Monit 5.25.1 daemon with http interface at :2812 The problem is, that I don't understand, why monit is logging the following entries: The problem I would like to talk about here. if this sounds a little bit complicated, I'm sorry, but that is not ![]() ![]() The action-scripts (loproc_is_down.sh / loproc_is_up.sh) are adding / deletingĪn iptables rule to pronounce the status to a running haproxy, who is port-checking that Running LibreOffice Process by sending HTML, requesting TEXT and check the The check-script is returning 0 if everything is ok and 101 if there is anĮrror with that LibreOffice Instance. This LibreOffice Instance is listening on port 8101. If status = 0 then exec "/bin/bash /opt/libreoffice/loproc_is_up.sh" If status != 0 then exec "/bin/bash /opt/libreoffice/loproc_is_down.sh" Here is my monit config for this approach: cat /etc/monit/conf.d/libreofficeĬheck program lo-check-8101 with path "/bin/bash /opt/libreoffice/chkloproc.sh TestLOPort8101 8101" I want to monitor a headless running LibreOffice-Process with monit version 5.25.1. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |