This article will help you get the Php_fpm plugin for sd-agent configured and returning metrics
Installing the php_fpm plugin package
Install the php_fpm plugin on Debian/Ubuntu:
sudo apt-get install sd-agent-phpfpm
Install the php_fpm plugin on RHEL/CentOS:
sudo yum install sd-agent-phpfpm
Read more about agent plugins.
Configuring the agent to monitor PHP-FPM
1. To monitor PHP-FPM, you'll need to enable the status option in your PHP config.
2. Configure /etc/sd-agent/conf.d/php_fpm.yaml
init_config:
instances:
- # Get metrics from your FPM pool with this URL
status_url: http://localhost/status
# Get a reliable service check of your FPM pool with that one
ping_url: http://localhost/ping
# Set the expected reply to the ping.
ping_reply: pong
- If you have auth enabled on the status page, amend the config file as necessary.
3. Restart the agent
sudo /etc/init.d/sd-agent restart
or
sudo systemctl restart sd-agent
Verifying the configuration
Execute info to verify the configuration with the following:
sudo /etc/init.d/sd-agent info
or
/usr/share/python/sd-agent/agent.py info
If the agent has been configured correctly you'll see an output such as:
php_fpm ----- - instance #0 [OK] - Collected * metrics
You can also view the metrics returned with the following command:
sudo -u sd-agent /usr/share/python/sd-agent/agent.py check php_fpm
Configuring graphs
Click the name of your server from the Devices list in your Server Density account then go to the Metrics tab. Click the + Graph button on the right then choose the php_fpm metrics to display the graphs. The metrics will also be available to select when building dashboard graphs.
Monitored metrics
Metric | Values |
---|---|
php_fpm.listen_queue.size Size of the socket queue of pending connections |
None / None Type: float |
php_fpm.processes.active Total number of active processes |
process / None Type: float |
php_fpm.processes.idle Total number of idle processes |
process / None Type: float |
php_fpm.processes.max_reached The number of times the process limit has been reached |
process / None Type: float |
php_fpm.processes.total Total number of processes |
process / None Type: float |
php_fpm.requests.accepted Total number of accepted requests |
request / None Type: float |
php_fpm.requests.slow Total number of sloq requests |
request / None Type: float |
Comments