Apache php5-fpm monitoring

From snippet wiki
Jump to: navigation, search

If you are using the MPM worker under debian 8 try this configuration:


I'm using /etc/apache2/conf-available/fpm.conf as central configuration for apache 2.4:

<IfModule mod_fastcgi.c>
        AddHandler php5-fcgi .php
        FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization
 
        <LocationMatch "/fpm-(ping|status)">
                SetHandler      php5-fcgi-virt
                Action          php5-fcgi-virt /php5-fcgi virtual
        </LocationMatch>
 
        Action php5-fcgi /php5-fcgi
        Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
 
        <Directory /usr/lib/cgi-bin>
                Require all granted
        </Directory>
</IfModule>

Configure /etc/php5/fpm/pool.d/www.conf enabling the status and ping urls:

pm.status_path = /fpm-status
ping.path = /fpm-ping
ping.response = pong

Now you can monitor the ping path from monit using the file /etc/monit/conf.d/fpm:

check process php5-fpm with pidfile /var/run/php5-fpm.pid
        group web
        start program = "/etc/init.d/php5-fpm start"
        stop program = "/etc/init.d/php5-fpm stop"
        if failed host localhost port 80 protocol http
                and request '/fpm-ping'
                with timeout 20 seconds for 5 cycles
                then restart
        depends on apache

Autoren der Seite / Contributors of the page

» Kai Kretschmann, (google+)