Monday, May 27, 2013

nagios:: check_fcgi script

Ok, so we have deployed nginx/php-fpm setup to our test environment. So it got me thinking of how to monitor the php-fpm service via NRPE nagios. My initial findings where,

  1. Monitor it via nginx that proxies the /status path
  2. Monitor php-fpm directly from command line
The first option was the easiest, but what if nginx went down and couldn't proxy the /status path, and what if php-fpm was on a different server? That's where option 2 came in. So I've started to google around and found this awesome command line tool called cgi-fcgi. (Can be installed via yum, # yum install fcgi)

After a afternoon of testing I've written a script that checks the status of php-fpm directly. This is still a initial version of the script. I will at a later date update the script to be more granular with warnings, e.g. worker levels, etc. Depending if it needs to be monitored. If you need that, then let me know. 

Script location:

No comments:

Post a Comment