
Ich versuche Monit so einzurichten, dass es Domänen im Auge behält, falls PHP abstürzt. Beispiel:
check file php7.3-fpm-pidfile with path /var/run/php/php7.3-fpm.pid
start program = "/usr/sbin/service php7.3-fpm start" with timeout 60 seconds
stop program = "/usr/sbin/service php7.3-fpm stop"
if does not exist then restart
if failed unixsocket /run/php/php7.3-fpm-domain.co.uk.sock then restart
if failed unixsocket /run/php/php7.3-fpm-domain2.co.uk.sock then restart
if failed unixsocket /run/php/php7.3-fpm-domain3.co.uk.sock then restart
Als einfacher Test:
check file php7.3-fpm-pidfile with path /var/run/php/php7.3-fpm.pid
start program = "/usr/sbin/service php7.3-fpm start" with timeout 60 seconds
stop program = "/usr/sbin/service php7.3-fpm stop"
if does not exist then restart
if failed unixsocket /run/php/php7.3-fpm-domain.co.uk.sock then restart
Der letzte Schritt schlägt jedoch beim Neustart von Monit fehl:
/etc/monit/conf-enabled/php-fpm:14: Syntaxfehler „unixsocket“
Ich bin dabeiÜberwachen 5.31.0, das neu genug sein sollte, um diese unixsocket
Option zu haben. Was übersehe ich?
Antwort1
Sind Sie sicher, dass Sie eine Datei prüfen werden? Aus meiner Sicht werden Sie einen Prozess prüfen?
Mein Vorschlag, den Unixsocket und den Prozess zu überprüfen:
check process php7.3-fpm-pidfile with path /var/run/php/php7.3-fpm.pid
start program = "/usr/sbin/service php7.3-fpm start" with timeout 60 seconds
stop program = "/usr/sbin/service php7.3-fpm stop"
if does not exist then restart
if failed unixsocket /run/php/php7.3-fpm-domain.co.uk.sock then restart
Sie können nicht alle verfügbaren Tests („if“-Anweisungen) in allen Prüfungen verwenden.
monit -v -t
Process Name = php7.3-fpm-pidfile
Pid file = /var/run/php/php7.3-fpm.pid
Monitoring mode = active
On reboot = start
Start program = '/usr/sbin/service php7.3-fpm start' timeout 1 m
Stop program = '/usr/sbin/service php7.3-fpm stop' timeout 30 s
Existence = if does not exist then restart
Unix Socket = if failed /run/php/php7.3-fpm-domain.co.uk.sock type TCP protocol DEFAULT with timeout 5 s then restart
Ausschnitt aus dem Handbuch, siehehttps://www.mmonit.com/monit/documentation/monit.html
VERBINDUNGSTESTS
Monit kann Verbindungstests über Netzwerkports oder Unix-Sockets durchführen. Ein Verbindungstest kann nur im Kontext eines Prozess- oder Host-Servicetyps verwendet werden.
Verbindungstests sind nur mit Prozess- oder Hostdiensten verfügbar.