phpfpm_exporter "failed to get php-fpm status"

Hi. I use net-mgmt/prometheus and want to get php-fpm statistic over "phpfpm_exporter" but get it problem:
Code:
root@sfn:/# /usr/local/etc/rc.d/phpfpm_exporter start
Starting phpfpm_exporter.
root@sfn:/#
{"level":"error","ts":1570619327.8761797,"msg":"failed to get php-fpm status","error":"HTTP request failed: Get http://127.0.0.1:9000/status: EOF","errorVerbose":"Get http://127.0.0.1:9000/status: EOF\nHTTP request failed\ngithub.com/bakins/php-fpm-exporter.getData\n\t/usr/ports/sysutils/phpfpm_exporter/work/src/github.com/bakins/php-fpm-exporter/collector.go:86\ngithub.com/bakins/php-fpm-exporter.(*collector).Collect\n\t/usr/ports/sysutils/phpfpm_exporter/work/src/github.com/bakins/php-fpm-exporter/collector.go:105\ngithub.com/bakins/php-fpm-exporter/vendor/github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func2\n\t/usr/ports/sysutils/phpfpm_exporter/work/src/github.com/bakins/php-fpm-exporter/vendor/github.com/prometheus/client_golang/prometheus/registry.go:433\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1357"}
On the FreeBSD 12.0-RELEASE amd64 run php-fpm and works fine ( i see phpinfo()):
Code:
root@sfn:/ # sockstat -4 | grep 9000
www      php-fpm    27109 5  tcp4   127.0.0.1:9000        *:*
www      php-fpm    26903 5  tcp4   127.0.0.1:9000        *:*
root     php-fpm    26837 7  tcp4   127.0.0.1:9000        *:*
root@sfn:/ #
In the php.ini i add string in pool file:
Code:
pm.status_path = /status
Please help me.
 
Have you tried to do the query "by hand"? fetch http://127.0.0.1:9000/status
 
Code:
root@sfn:/ # fetch http://127.0.0.1:9000/status
fetch: http://127.0.0.1:9000/status: No error: 0
 
Did it create a status file in your current directory? If there is, what does it contain?
 
Code:
oot@sfn:/ # curl http://127.0.0.1:9000/status
curl: (52) Empty reply from server
And do not create file "status".
 
Then you should probably look at your php-fpm configuration. It looks like the status page is never created. Also check the relevant logs for errors, it may be missing a required PHP module.
 
fix.
1. Step in nginx.conf for local server add this:
Code:
server {
...
            location ~ ^/(status|ping)$ {
            index index.html;
            #access_log off;
            #allow 127.0.0.1;
            #deny all;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
            fastcgi_pass 127.0.0.1:9000;
            access_log /var/log/nginx/php_access.log;
        }
...
}
2. edit
root@sfn:/ # vi /usr/local/etc/rc.d/phpfpm_exporter
Code:
# phpfpm_exporter_endpoint (string):      Set status endpoint
#               Default is "http://127.0.0.1:9000/status".

: ${phpfpm_exporter_endpoint:="http://127.0.0.1/status"}
3. Restart phpfpm_exporter and all works fine!
 
Back
Top