Monit examples1/30/2024 ![]() Start program = "/etc/init.d/dnsmasq start" Start program = "/etc/init.d/dhcpcd start"Ĭheck process dnsmasq with pidfile /var/run/dnsmasq/dnsmasq.pid Stop program = "/etc/init.d/pihole-FTL stop"Ĭheck process dhcpcd with pidfile /var/run/dhcpcd.pid Start program = "/etc/init.d/pihole-FTL start" Stop program = "/etc/init.d/domoticz.sh stop"Ĭheck process pihole-FTL with pidfile /var/run/pihole-FTL.pid Start program = "/etc/init.d/domoticz.sh start" This is what I added at the end of the file to monitor Domoticz and the (core) components for Pi-hole: # Added to monitor the Domoticz serviceĬheck process domoticz with pidfile /var/run/domoticz.pid The more knowledgeable users will create separate files for each service they want to monitor but I did not get that to work. I edited the file /etc/monit/monitrc and added a few lines. For instance: exec "/usr/local/tomcat/bin/startup.Hi thought I'd best post a reply here so others might benefit from the terrible solution I used. You may optionally specify the uid and gid the executed program should switch to upon start. If you choose this action you must state the program to be executed and if the program require arguments you must enclose the program and its arguments in a quoted string. Is there any way to run one request per cycle and perform different activities after a different number of fails?ĮXEC can be used to execute an arbitrary program and send an alert. To do different actions after 1 fail, 2 fails, and 4 fails, I need three if failed conditions, resulting in three server requests. With http headers Īnd request /monit/ with content = "Monit +" You can use the host check, this is an example from the monit site: check host with address Can I use any other check instead of check process? I do not want to monitor the nginx process here, but the ports/URLs. Unless anyone has a good idea, I shall switch back to multiple requests. error : skipping queued event /var/monit/id - unknown data format info : Monit start delay set - pause for 240s info : Starting monit daemon with http interface at error : 'webserver' service restarted 2 times within 2 cycles(s) - exec info : 'php-fpm' start: /usr/sbin/service error : 'php-fpm' process is not running error : 'webserver' failed, cannot open a connection to INET[via TCPSSL error : 'webserver' failed protocol test at INET[via TCPSSL - HTTP: Error receiving data - Resource temporarily unavailable error : skipping queued event /var/monit/state - unknown data format In my case, this caused multiple reboots: error : skipping queued event /var/monit/id - unknown data format It seems that the timeout action is re-run after a reboot under certaing circumstances. If someone knows how to do it better, advice is stil appreciated :) Thanks!Īfter some testing, I DO NOT recommend to use monit's timeout feature ( IF 2 REsTARTS WITHIN.) for second-order actions. This modification does not include the alert on first URL fail (a workaround would be to use dummy start/stop commands, here) but can do a restart after 2 fails and a reboot aber 4 fails - with only one server request. IF FAILED (url and content = 'test content' and timeout 20 seconds) Therefore, I would apprechiate some advice very much.Īfter spending some mot time with the monit man page (it's much better structured than the online manual, in my opinion), I found this optimization: CHECK HOST webserver WITH ADDRESS 127.0.0.1 I tried to find the answers from the official monit reference, but obviously, I do not understand the possibilities as decribed in that source. Is there any way to run one request per cycle and perform different activities after a different number of fails? To do different actions after 1 fail, 2 fails, and 4 fails, I need three if failed conditions, resulting in three server requests.Actually, I do not want to monitor the nginx process here, but the ports/URLs. ![]() That's not entirely wrong, but some questions remain: If failed (url and content = 'test string' and timeout 20 seconds) Here's my monit configuration file (in conf.d): check process webserver with pidfile /var/run/nginx.pid To do so, I create two bash scripts /etc/monit/ and /etc/monit/. I am not so much interested in the cause of a current problem, but want to restart both processes. When something happens, the both processes (ad their threads) usually exist and need a restart. Of course, I never know, if nginx may crash as well, some day. If some trouble occurs, usually php5-fpm hung up, resulting in a "bad gateway" server error. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |