regilero / check_phpfpm_status

Nagios check for php-fpm status report
GNU General Public License v3.0
39 stars 19 forks source link

url parameter is misleading #2

Closed Seegras closed 10 years ago

Seegras commented 11 years ago

It actually expects just a path on the webserver, like '/fpm-status' but NOT an URL like 'http://webserver/fpm-status':

DEBUG: HTTP url: http://host/http://url/fpm-status/ DEBUG: HTTP request: IP used (better if it's an IP):host GET http://host/http://url/fpm-status/

ipeacocks commented 10 years ago

How do you execute check? It is my output.

/usr/lib/nagios/plugins/check_phpfpm_status -d -H 1.2.3.4 -u /status -U test -P test20

...

DEBUG: HTTP url: http://1.2.3.4/status DEBUG: HTTP request: IP used (better if it's an IP):1.2.3.4 GET http://1.2.3.4/status Authorization: Basic ZGV0aG9tYXM6ZGV0aG9tYXMyMDEz

DEBUG: HTTP response:200 OK text/plain pool: default process manager: dynamic start time: 19/Mar/2014:17:35:30 +0100 start since: 63752 accepted conn: 898 listen queue: 0 max listen queue: 0 listen queue len: 0 idle processes: 1 active processes: 1 total processes: 2 max active processes: 1 max children reached: 0

DEBUG Parse results => Pool:default AcceptedConn:898 ActiveProcesses:1 TotalProcesses :2 IdleProcesses :1 MaxActiveProcesses :1 MaxChildrenReached :0 ListenQueue :0 ListenQueueLen : 0 MaxListenQueue: 0

Debug: data from temporary file: LastUptime: 63741 LastAcceptedConn: 897 LastMaxChildrenReached: 0 LastMaxListenQueue: 0

PHP-FPM OK - default, 0.047 sec. response time, Busy/Idle 1/1, (max: 1, reached: 0), ReqPerSec 0.1, Queue 0 (len: 0, reached: 0)|Idle=1;Busy=1;MaxProcesses=1;MaxProcessesReach=0;Queue=0;MaxQueueReach=0;QueueLen=0;ReqPerSec=0.090909

regilero commented 10 years ago

@ipeacocks , @Seegras The important parameter, as shown in the examples is -s which sets the hostname.

When you make an HTTP request on a web server for the same IP you could manage several different name based virtualhosts, and this would be set in the Hostname header of the HTTP request.

So using IP: 1.2.3.4 dos not mean you always want to use 1.2.3.4 for the host name in the HTTP request. And using www.example.com with -H option would give you an IP to query to server which is maybe not the IP you want to use when you monitor the server (it would be the public IP, which is maybe a proxy, for example).

So yo usually need two things:

The hostname part will let you wuery the web server on the right virtualhost, this allows you to query the /fpm-status page on a specific virtualhost, and if you have several virtualhosts you may have several php-fpm pools, that you should query on each host.

A classical check is then:

check_phpfpm_status  -H 1.2.3.4 -s www.example.com -u /status

Now, @Seegras is right that url is maybe not the right name, it's only the path part of the url. But I do not find a better name for now. But at least I should fix this parameter documentation which is wrong:

-u, --url=URL
   Specific URL to use, instead of the default "http:///fpm-status"

Should be:

-u, --url=URL
   Specific URL (only the path part of it in fact) to use, instead of the default "/fpm-status"

This is now fixed in git documentation.