I’ve created the php-fpm status collector for Diamond. It’s available on github under Diamond-PhpCollectors: https://github.com/charlesnagy/Diamond-PhpCollectors
Collected metrics
1 2 3 4 5 6 7 8 9 10 11 12 |
$ curl http://localhost/fpm_status [...ignored values] start since: 2926 accepted conn: 113 listen queue: 0 max listen queue: 0 listen queue len: 128 idle processes: 2 active processes: 1 total processes: 3 max active processes: 1 max children reached: 0 |
Configuration
First of all you will need to enable status page in php-fpm.conf.
PHP-FPM
The following line should be in the config file.
1 |
pm.status_path = /fpm_status |
Reload php-fpm service.
Nginx
In the Nginx config most likely you have to create an explicit location for this. It’s good practice to allow connection from only localhost.
1 2 3 4 5 6 7 8 9 10 11 12 |
location = /fpm_status987 { access_log off; allow 127.0.0.1; allow 192.168.1.0/24; deny all; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; fastcgi_pass 127.0.0.1:9000; } |
After reload nginx you can test the setup from commandline.
1 |
curl http://localhost/fpm_status |
If this returned the list of metrics that means it’s working.
Diamond
In /etc/diamond/collectors/PhpFpmCollector.conf insert the followings
1 |
enabled = True status_uri = /fpm_status |
Restart Diamond and you’re all set.
Recent comments