saltstack/salt-contrib — pull request #31 by yvasiyarov (2013-03-04 11:43:51+00:00)
Title: PHP- FPM monitoring module

Hi guys,

I've developed module for PHP-FPM monitoring. I'm newbie in python, so if I did something wrong - please, correct me. PHP FPM is used a lot, so I hope my module will be useful for somebody.

This module implement two actions:
status - show php-fpm pool statistic
ping - just make sure what php-fpm is running and able to process requests

Module try to autodetect location of php fpm pool configs (It tryes /etc/php5/fpm/pool.d/) and read configurations from them. You can also pass config files location as parameter if in your OS they are located in different place.

The expample output for status action is:

salt 'web-d2.butik.ru' php_fpm.status
web-d2.butik.ru:
pool: admin
process manager: dynamic
start time: 04/Mar/2013:15:11:15 +0400
start since: 115
accepted conn: 1
listen queue: 0
max listen queue: 0
listen queue len: 128
idle processes: 15
active processes: 1
total processes: 16
max active processes: 1
max children reached: 0

pool: frontend
process manager: dynamic
start time: 04/Mar/2013:15:11:15 +0400
start since: 115
accepted conn: 747
listen queue: 0
max listen queue: 0
listen queue len: 128
idle processes: 15
active processes: 4
total processes: 19
max active processes: 6
max children reached: 0

salt 'web-d2.butik.ru' php_fpm.ping

web-d2.butik.ru:
Ping path is not configured for pool:admin
Pool: frontend is UP