php-fmp サイトの .sock ファイルを追跡するための monit の設定

php-fmp サイトの .sock ファイルを追跡するための monit の設定

PHP がクラッシュした場合に備えてドメインを追跡するように Monit を設定しようとしています。例:

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

簡単なテストとして:

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

しかし、Monit を再起動すると最終的に失敗します。

/etc/monit/conf-enabled/php-fpm:14: 構文エラー 'unixsocket'

私は〜に乗っていますモニタ 5.31.0、オプションがあるほど新しいはずですunixsocket。何が足りないのでしょうか?

答え1

確かにファイルをチェックするのですか、私の観点からするとプロセスをチェックするのでしょうか?

unixsocket とプロセスを確認するための私の提案:

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

すべてのチェック内で利用可能なすべてのテスト (「if」ステートメント) を使用することはできません。

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

マニュアルからの抜粋、参照https://www.mmonit.com/monit/documentation/monit.html

接続テスト

Monit は、ネットワーク ポートまたは Unix ソケット経由で接続テストを実行できます。接続テストは、プロセスまたはホスト サービス タイプのコンテキスト内でのみ使用できます。

接続テストはプロセス サービスまたはホスト サービスでのみ使用できます。

関連情報