Skip to content

Vebryn/check_phpfpm_status

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CHECK_PHPFPM_STATUS
===================

Nagios check checking the fpm-status page report from php-fpm. Tracking Idle processes, max processes reached and process queue.
You can use this script to draw some graphics. Details for centreon graphics are available in the CENTREON_GRAPHICS.txt doc
PHP-FPM Monitor for Nagios version 0.1
GPL licence, (c)2012 Leroy Regis

Installation:
=============

1.  Copy check_phpfpm_status.pl to the server's nagios plugins directory.
2.  Edit check_phpfpm_status.pl (line #25) and verify the lib path specified is correct for your platform

Script Documentation:
=====================

Usage: ./check_phpfpm_status.pl -H <host ip> [-p <port>] [-s servername] [-t <timeout>] [-w <WARN_THRESOLD> -c <CRIT_THRESOLD>] [-V] [-d] [-u <url>] [-U user -P pass -r realm]
-h, --help
   print this help message
-H, --hostname=HOST
   name or IP address of host to check
-p, --port=PORT
   Http port
-u, --url=URL
   Specific URL (only the path part of it in fact) to use, instead of the default "/fpm-status"
-s, --servername=SERVERNAME
   ServerName, (host header of HTTP request) use it if you specified an IP in -H to match the good Virtualhost in your target
-S, --ssl
   Wether we should use HTTPS instead of HTTP
-U, --user=user
   Username for basic auth
-P, --pass=PASS
   Password for basic auth
-r, --realm=REALM
   Realm for basic auth
-d, --debug
   Debug mode (show http request response)
-t, --timeout=INTEGER
   timeout in seconds (Default: 15)
-w, --warn=MIN_AVAILABLE_PROCESSES,PROC_MAX_REACHED,QUEUE_MAX_REACHED
   number of available workers, or max states reached that will cause a warning
   -1 for no warning
-c, --critical=MIN_AVAILABLE_PROCESSES,PROC_MAX_REACHED,QUEUE_MAX_REACHED
   number of available workers, or max states reached that will cause an error
   -1 for no CRITICAL
-V, --version
   prints version number

Note :
  3 items can be managed on this check, this is why -w and -c parameters are using 3 values thresolds
  - MIN_AVAILABLE_PROCESSES: Working with the number of available (Idle) and working process (Busy). 
    Generating WARNING and CRITICAL if you do not have enough Idle processes.
  - PROC_MAX_REACHED: the fpm-status report will show us how many times the max processes were reached sinc start, 
    this script will record how many time this happended since last check, letting you fix thresolds for alerts
  - QUEUE_MAX_REACHED: the php-fpm report will show us how many times the max queue was reached since start,
    this script will record how many time this happended since last check, letting you fix thresolds for alerts

Examples: 

  This will lead to CRITICAL if you have 0 Idle process, or you have reached the max processes 2 times between last check,
  or you have reached the max queue len 5 times. A Warning will be reached for 1 Idle process only.
check_phpfpm_status.pl -H 10.0.0.10 -u /foo/my-fpm-status -s mydomain.example.com -t 8 -w 1,-1,-1 -c 0,2,5

  this will generate WARNING and CRITICAL alerts only on the number of times you have reached the max process
check_phpfpm_status.pl -H 10.0.0.10 -u /foo/my-fpm-status -s mydomain.example.com -t 8 -w -1,10,-1 -c -1,20,-1

  theses two equivalents will not generate any alert (if the php-fpm page is reachable) but could be used for graphics
check_phpfpm_status.pl -H 10.0.0.10 -s mydomain.example.com -w -1,-1,-1 -c -1,-1,-1
check_phpfpm_status.pl -H 10.0.0.10 -s mydomain.example.com
 
  And this one is a basic starting example
check_phpfpm_status.pl -H 127.0.0.1 -s nagios.example.com -w 1,1,1 -c 0,2,2

Licence: GNU GPL v3

About

Nagios check for php-fpm status report

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Perl 100.0%