Source: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/app/php-fpm_http?at=release/7.4
PHP-FPM by HTTP
Overview
This template is developed to monitor the FastCGI Process Manager (PHP-FPM) by Zabbix that work without any external scripts. Most of the metrics are collected in one go, thanks to Zabbix bulk data collection.
The template PHP-FPM by Zabbix agent
- collects metrics by polling PHP-FPM status-page with HTTP agent remotely.
Note that this solution supports HTTPS and redirects.
Requirements
Zabbix version: 7.4 and higher.
Tested versions
This template has been tested on:
- PHP 7
- PHP 8
Configuration
Zabbix should be configured according to the instructions in the Templates out of the box section.
Setup
Note that depending on your OS distribution, the PHP-FPM executable/service name can vary. RHEL-like distributions usually name both process and service as php-fpm
, while for Debian/Ubuntu based distributions it may include the version, for example: executable name - php-fpm8.2
, systemd service name - php8.2-fpm
. Adjust the following instructions accordingly if needed.
- Open the PHP-FPM configuration file and enable the status page as shown.
pm.status_path = /status
ping.path = /ping
- Validate the syntax to ensure it is correct before you reload the service. Replace the
<version>
in the command if needed.
$ php-fpm -t
or
$ php-fpm<version> -t
- Reload the
php-fpm
service to make the change active. Replace the<version>
in the command if needed.
$ systemctl reload php-fpm
or
$ systemctl reload php<version>-fpm
- Next, edit the configuration of your web server.
If you use Nginx, edit the configuration file of your Nginx server block (virtual host) and add the location block below it.
# Enable php-fpm status page
location ~ ^/(status|ping)$ {
## disable access logging for request if you prefer
access_log off;
## Only allow trusted IPs for security, deny everyone else
# allow 127.0.0.1;
# allow 1.2.3.4; # your IP here
# deny all;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
## Now the port or socket of the php-fpm pool we want the status of
fastcgi_pass 127.0.0.1:9000;
# fastcgi_pass unix:/run/php-fpm/your_socket.sock;
}
If you use Apache, edit the configuration file of the virtual host and add the following location blocks.
<LocationMatch "/status">
Require ip 127.0.0.1
# Require ip 1.2.3.4 # Your IP here
# Adjust the path to the socket if needed
ProxyPass "unix:/run/php-fpm/www.sock|fcgi://localhost/status"
</LocationMatch>
<LocationMatch "/ping">
Require ip 127.0.0.1
# Require ip 1.2.3.4 # Your IP here
# Adjust the path to the socket if needed
ProxyPass "unix:/run/php-fpm/www.sock|fcgi://localhost/ping"
</LocationMatch>
- Check the web server configuration syntax. The command may vary depending on the OS distribution and web server.
$ nginx -t
or
$ httpd -t
or
$ apachectl configtest
- Reload the web server configuration. The command may vary depending on the OS distribution and web server.
$ systemctl reload nginx
or
$ systemctl reload httpd
or
$ systemctl reload apache2
- Verify that the pages are available with these commands.
curl -L 127.0.0.1/status
curl -L 127.0.0.1/ping
If you use another location of the status/ping pages, don't forget to change the {$PHP_FPM.STATUS.PAGE}/{$PHP_FPM.PING.PAGE}
macro.
If you use another web server port or scheme for the location of the PHP-FPM status/ping pages, don't forget to change the macros {$PHP_FPM.SCHEME}
and {$PHP_FPM.PORT}
.
Macros used
Name | Description | Default |
---|---|---|
{$PHP_FPM.PORT} | The port of the PHP-FPM status host or container. |
80 |
{$PHP_FPM.SCHEME} | Request scheme which may be http or https |
http |
{$PHP_FPM.HOST} | The hostname or IP address of the PHP-FPM status for a host or container. |
localhost |
{$PHP_FPM.STATUS.PAGE} | The path of the PHP-FPM status page. |
status |
{$PHP_FPM.PING.PAGE} | The path of the PHP-FPM ping page. |
ping |
{$PHP_FPM.PING.REPLY} | The expected reply to the ping. |
pong |
{$PHP_FPM.QUEUE.WARN.MAX} | The maximum percent of the PHP-FPM queue usage for a trigger expression. |
80 |
Items
Name | Description | Type | Key and additional info |
---|---|---|---|
Get ping page | HTTP agent | php-fpm.get_ping | |
Get status page | HTTP agent | php-fpm.get_status | |
Ping | Dependent item | php-fpm.ping Preprocessing
|
|
Processes, active | The total number of active processes. |
Dependent item | php-fpm.processes_active Preprocessing
|
Version | The current version of the PHP. You can get it from the HTTP-Header "X-Powered-By"; it may not work if you have changed the default HTTP-headers. |
Dependent item | php-fpm.version Preprocessing
|
Pool name | The name of the current pool. |
Dependent item | php-fpm.name Preprocessing
|
Uptime | It indicates how long has this pool been running. |
Dependent item | php-fpm.uptime Preprocessing
|
Start time | The time when this pool was started. |
Dependent item | php-fpm.start_time Preprocessing
|
Processes, total | The total number of server processes currently running. |
Dependent item | php-fpm.processes_total Preprocessing
|
Processes, idle | The total number of idle processes. |
Dependent item | php-fpm.processes_idle Preprocessing
|
Process manager | The method used by the process manager to control the number of child processes for this pool. |
Dependent item | php-fpm.process_manager Preprocessing
|
Processes, max active | The highest value of "active processes" since the PHP-FPM server was started. |
Dependent item | php-fpm.processes_max_active Preprocessing
|
Accepted connections per second | The number of accepted requests per second. |
Dependent item | php-fpm.conn_accepted.rate Preprocessing
|
Slow requests | The number of requests that has exceeded your |
Dependent item | php-fpm.slow_requests Preprocessing
|
Listen queue | The current number of connections that have been initiated but not yet accepted. |
Dependent item | php-fpm.listen_queue Preprocessing
|
Listen queue, max | The maximum number of requests in the queue of pending connections since this FPM pool was started. |
Dependent item | php-fpm.listen_queue_max Preprocessing
|
Listen queue, len | The size of the socket queue of pending connections. |
Dependent item | php-fpm.listen_queue_len Preprocessing
|
Queue usage | The utilization of the queue. |
Calculated | php-fpm.listen_queue_usage |
Max children reached | The number of times that |
Dependent item | php-fpm.max_children Preprocessing
|
Triggers
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
PHP-FPM: Service is down | last(/PHP-FPM by HTTP/php-fpm.ping)=0 or nodata(/PHP-FPM by HTTP/php-fpm.ping,3m)=1 |
High | Manual close: Yes | |
PHP-FPM: Version has changed | The PHP-FPM version has changed. Acknowledge to close the problem manually. |
last(/PHP-FPM by HTTP/php-fpm.version,#1)<>last(/PHP-FPM by HTTP/php-fpm.version,#2) and length(last(/PHP-FPM by HTTP/php-fpm.version))>0 |
Info | Manual close: Yes |
PHP-FPM: Failed to fetch info data | Zabbix has not received any data for items for the last 30 minutes. |
nodata(/PHP-FPM by HTTP/php-fpm.uptime,30m)=1 |
Info | Manual close: Yes Depends on:
|
PHP-FPM: Pool has been restarted | Uptime is less than 10 minutes. |
last(/PHP-FPM by HTTP/php-fpm.uptime)<10m |
Info | Manual close: Yes |
PHP-FPM: Manager changed | The PHP-FPM manager has changed. Acknowledge to close the problem manually. |
last(/PHP-FPM by HTTP/php-fpm.process_manager,#1)<>last(/PHP-FPM by HTTP/php-fpm.process_manager,#2) |
Info | Manual close: Yes |
PHP-FPM: Detected slow requests | The PHP-FPM has detected a slow request. |
min(/PHP-FPM by HTTP/php-fpm.slow_requests,#3)>0 |
Warning | |
PHP-FPM: Queue utilization is high | The queue for this pool has reached |
min(/PHP-FPM by HTTP/php-fpm.listen_queue_usage,15m) > {$PHP_FPM.QUEUE.WARN.MAX} |
Warning |
Feedback
Please report any issues with the template at https://support.zabbix.com
You can also provide feedback, discuss the template, or ask for help at ZABBIX forums
Source: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/app/php-fpm_http?at=release/7.2
PHP-FPM by HTTP
Overview
This template is developed to monitor the FastCGI Process Manager (PHP-FPM) by Zabbix that work without any external scripts. Most of the metrics are collected in one go, thanks to Zabbix bulk data collection.
The template PHP-FPM by Zabbix agent
- collects metrics by polling PHP-FPM status-page with HTTP agent remotely.
Note that this solution supports HTTPS and redirects.
Requirements
Zabbix version: 7.2 and higher.
Tested versions
This template has been tested on:
- PHP 7
- PHP 8
Configuration
Zabbix should be configured according to the instructions in the Templates out of the box section.
Setup
Note that depending on your OS distribution, the PHP-FPM executable/service name can vary. RHEL-like distributions usually name both process and service as php-fpm
, while for Debian/Ubuntu based distributions it may include the version, for example: executable name - php-fpm8.2
, systemd service name - php8.2-fpm
. Adjust the following instructions accordingly if needed.
- Open the PHP-FPM configuration file and enable the status page as shown.
pm.status_path = /status
ping.path = /ping
- Validate the syntax to ensure it is correct before you reload the service. Replace the
<version>
in the command if needed.
$ php-fpm -t
or
$ php-fpm<version> -t
- Reload the
php-fpm
service to make the change active. Replace the<version>
in the command if needed.
$ systemctl reload php-fpm
or
$ systemctl reload php<version>-fpm
- Next, edit the configuration of your web server.
If you use Nginx, edit the configuration file of your Nginx server block (virtual host) and add the location block below it.
# Enable php-fpm status page
location ~ ^/(status|ping)$ {
## disable access logging for request if you prefer
access_log off;
## Only allow trusted IPs for security, deny everyone else
# allow 127.0.0.1;
# allow 1.2.3.4; # your IP here
# deny all;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
## Now the port or socket of the php-fpm pool we want the status of
fastcgi_pass 127.0.0.1:9000;
# fastcgi_pass unix:/run/php-fpm/your_socket.sock;
}
If you use Apache, edit the configuration file of the virtual host and add the following location blocks.
<LocationMatch "/status">
Require ip 127.0.0.1
# Require ip 1.2.3.4 # Your IP here
# Adjust the path to the socket if needed
ProxyPass "unix:/run/php-fpm/www.sock|fcgi://localhost/status"
</LocationMatch>
<LocationMatch "/ping">
Require ip 127.0.0.1
# Require ip 1.2.3.4 # Your IP here
# Adjust the path to the socket if needed
ProxyPass "unix:/run/php-fpm/www.sock|fcgi://localhost/ping"
</LocationMatch>
- Check the web server configuration syntax. The command may vary depending on the OS distribution and web server.
$ nginx -t
or
$ httpd -t
or
$ apachectl configtest
- Reload the web server configuration. The command may vary depending on the OS distribution and web server.
$ systemctl reload nginx
or
$ systemctl reload httpd
or
$ systemctl reload apache2
- Verify that the pages are available with these commands.
curl -L 127.0.0.1/status
curl -L 127.0.0.1/ping
If you use another location of the status/ping pages, don't forget to change the {$PHP_FPM.STATUS.PAGE}/{$PHP_FPM.PING.PAGE}
macro.
If you use another web server port or scheme for the location of the PHP-FPM status/ping pages, don't forget to change the macros {$PHP_FPM.SCHEME}
and {$PHP_FPM.PORT}
.
Macros used
Name | Description | Default |
---|---|---|
{$PHP_FPM.PORT} | The port of the PHP-FPM status host or container. |
80 |
{$PHP_FPM.SCHEME} | Request scheme which may be http or https |
http |
{$PHP_FPM.HOST} | The hostname or IP address of the PHP-FPM status for a host or container. |
localhost |
{$PHP_FPM.STATUS.PAGE} | The path of the PHP-FPM status page. |
status |
{$PHP_FPM.PING.PAGE} | The path of the PHP-FPM ping page. |
ping |
{$PHP_FPM.PING.REPLY} | The expected reply to the ping. |
pong |
{$PHP_FPM.QUEUE.WARN.MAX} | The maximum percent of the PHP-FPM queue usage for a trigger expression. |
80 |
Items
Name | Description | Type | Key and additional info |
---|---|---|---|
Get ping page | HTTP agent | php-fpm.get_ping | |
Get status page | HTTP agent | php-fpm.get_status | |
Ping | Dependent item | php-fpm.ping Preprocessing
|
|
Processes, active | The total number of active processes. |
Dependent item | php-fpm.processes_active Preprocessing
|
Version | The current version of the PHP. You can get it from the HTTP-Header "X-Powered-By"; it may not work if you have changed the default HTTP-headers. |
Dependent item | php-fpm.version Preprocessing
|
Pool name | The name of the current pool. |
Dependent item | php-fpm.name Preprocessing
|
Uptime | It indicates how long has this pool been running. |
Dependent item | php-fpm.uptime Preprocessing
|
Start time | The time when this pool was started. |
Dependent item | php-fpm.start_time Preprocessing
|
Processes, total | The total number of server processes currently running. |
Dependent item | php-fpm.processes_total Preprocessing
|
Processes, idle | The total number of idle processes. |
Dependent item | php-fpm.processes_idle Preprocessing
|
Process manager | The method used by the process manager to control the number of child processes for this pool. |
Dependent item | php-fpm.process_manager Preprocessing
|
Processes, max active | The highest value of "active processes" since the PHP-FPM server was started. |
Dependent item | php-fpm.processes_max_active Preprocessing
|
Accepted connections per second | The number of accepted requests per second. |
Dependent item | php-fpm.conn_accepted.rate Preprocessing
|
Slow requests | The number of requests that has exceeded your |
Dependent item | php-fpm.slow_requests Preprocessing
|
Listen queue | The current number of connections that have been initiated but not yet accepted. |
Dependent item | php-fpm.listen_queue Preprocessing
|
Listen queue, max | The maximum number of requests in the queue of pending connections since this FPM pool was started. |
Dependent item | php-fpm.listen_queue_max Preprocessing
|
Listen queue, len | The size of the socket queue of pending connections. |
Dependent item | php-fpm.listen_queue_len Preprocessing
|
Queue usage | The utilization of the queue. |
Calculated | php-fpm.listen_queue_usage |
Max children reached | The number of times that |
Dependent item | php-fpm.max_children Preprocessing
|
Triggers
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
PHP-FPM: Service is down | last(/PHP-FPM by HTTP/php-fpm.ping)=0 or nodata(/PHP-FPM by HTTP/php-fpm.ping,3m)=1 |
High | Manual close: Yes | |
PHP-FPM: Version has changed | The PHP-FPM version has changed. Acknowledge to close the problem manually. |
last(/PHP-FPM by HTTP/php-fpm.version,#1)<>last(/PHP-FPM by HTTP/php-fpm.version,#2) and length(last(/PHP-FPM by HTTP/php-fpm.version))>0 |
Info | Manual close: Yes |
PHP-FPM: Failed to fetch info data | Zabbix has not received any data for items for the last 30 minutes. |
nodata(/PHP-FPM by HTTP/php-fpm.uptime,30m)=1 |
Info | Manual close: Yes Depends on:
|
PHP-FPM: Pool has been restarted | Uptime is less than 10 minutes. |
last(/PHP-FPM by HTTP/php-fpm.uptime)<10m |
Info | Manual close: Yes |
PHP-FPM: Manager changed | The PHP-FPM manager has changed. Acknowledge to close the problem manually. |
last(/PHP-FPM by HTTP/php-fpm.process_manager,#1)<>last(/PHP-FPM by HTTP/php-fpm.process_manager,#2) |
Info | Manual close: Yes |
PHP-FPM: Detected slow requests | The PHP-FPM has detected a slow request. |
min(/PHP-FPM by HTTP/php-fpm.slow_requests,#3)>0 |
Warning | |
PHP-FPM: Queue utilization is high | The queue for this pool has reached |
min(/PHP-FPM by HTTP/php-fpm.listen_queue_usage,15m) > {$PHP_FPM.QUEUE.WARN.MAX} |
Warning |
Feedback
Please report any issues with the template at https://support.zabbix.com
You can also provide feedback, discuss the template, or ask for help at ZABBIX forums
Source: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/app/php-fpm_http?at=release/7.0
PHP-FPM by HTTP
Overview
This template is developed to monitor the FastCGI Process Manager (PHP-FPM) by Zabbix that work without any external scripts. Most of the metrics are collected in one go, thanks to Zabbix bulk data collection.
The template PHP-FPM by Zabbix agent
- collects metrics by polling PHP-FPM status-page with HTTP agent remotely.
Note that this solution supports HTTPS and redirects.
Requirements
Zabbix version: 7.0 and higher.
Tested versions
This template has been tested on:
- PHP 7
- PHP 8
Configuration
Zabbix should be configured according to the instructions in the Templates out of the box section.
Setup
Note that depending on your OS distribution, the PHP-FPM executable/service name can vary. RHEL-like distributions usually name both process and service as php-fpm
, while for Debian/Ubuntu based distributions it may include the version, for example: executable name - php-fpm8.2
, systemd service name - php8.2-fpm
. Adjust the following instructions accordingly if needed.
- Open the PHP-FPM configuration file and enable the status page as shown.
pm.status_path = /status
ping.path = /ping
- Validate the syntax to ensure it is correct before you reload the service. Replace the
<version>
in the command if needed.
$ php-fpm -t
or
$ php-fpm<version> -t
- Reload the
php-fpm
service to make the change active. Replace the<version>
in the command if needed.
$ systemctl reload php-fpm
or
$ systemctl reload php<version>-fpm
- Next, edit the configuration of your web server.
If you use Nginx, edit the configuration file of your Nginx server block (virtual host) and add the location block below it.
# Enable php-fpm status page
location ~ ^/(status|ping)$ {
## disable access logging for request if you prefer
access_log off;
## Only allow trusted IPs for security, deny everyone else
# allow 127.0.0.1;
# allow 1.2.3.4; # your IP here
# deny all;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
## Now the port or socket of the php-fpm pool we want the status of
fastcgi_pass 127.0.0.1:9000;
# fastcgi_pass unix:/run/php-fpm/your_socket.sock;
}
If you use Apache, edit the configuration file of the virtual host and add the following location blocks.
<LocationMatch "/status">
Require ip 127.0.0.1
# Require ip 1.2.3.4 # Your IP here
# Adjust the path to the socket if needed
ProxyPass "unix:/run/php-fpm/www.sock|fcgi://localhost/status"
</LocationMatch>
<LocationMatch "/ping">
Require ip 127.0.0.1
# Require ip 1.2.3.4 # Your IP here
# Adjust the path to the socket if needed
ProxyPass "unix:/run/php-fpm/www.sock|fcgi://localhost/ping"
</LocationMatch>
- Check the web server configuration syntax. The command may vary depending on the OS distribution and web server.
$ nginx -t
or
$ httpd -t
or
$ apachectl configtest
- Reload the web server configuration. The command may vary depending on the OS distribution and web server.
$ systemctl reload nginx
or
$ systemctl reload httpd
or
$ systemctl reload apache2
- Verify that the pages are available with these commands.
curl -L 127.0.0.1/status
curl -L 127.0.0.1/ping
If you use another location of the status/ping pages, don't forget to change the {$PHP_FPM.STATUS.PAGE}/{$PHP_FPM.PING.PAGE}
macro.
If you use another web server port or scheme for the location of the PHP-FPM status/ping pages, don't forget to change the macros {$PHP_FPM.SCHEME}
and {$PHP_FPM.PORT}
.
Macros used
Name | Description | Default |
---|---|---|
{$PHP_FPM.PORT} | The port of the PHP-FPM status host or container. |
80 |
{$PHP_FPM.SCHEME} | Request scheme which may be http or https |
http |
{$PHP_FPM.HOST} | The hostname or IP address of the PHP-FPM status for a host or container. |
localhost |
{$PHP_FPM.STATUS.PAGE} | The path of the PHP-FPM status page. |
status |
{$PHP_FPM.PING.PAGE} | The path of the PHP-FPM ping page. |
ping |
{$PHP_FPM.PING.REPLY} | The expected reply to the ping. |
pong |
{$PHP_FPM.QUEUE.WARN.MAX} | The maximum percent of the PHP-FPM queue usage for a trigger expression. |
80 |
Items
Name | Description | Type | Key and additional info |
---|---|---|---|
Get ping page | HTTP agent | php-fpm.get_ping | |
Get status page | HTTP agent | php-fpm.get_status | |
Ping | Dependent item | php-fpm.ping Preprocessing
|
|
Processes, active | The total number of active processes. |
Dependent item | php-fpm.processes_active Preprocessing
|
Version | The current version of the PHP. You can get it from the HTTP-Header "X-Powered-By"; it may not work if you have changed the default HTTP-headers. |
Dependent item | php-fpm.version Preprocessing
|
Pool name | The name of the current pool. |
Dependent item | php-fpm.name Preprocessing
|
Uptime | It indicates how long has this pool been running. |
Dependent item | php-fpm.uptime Preprocessing
|
Start time | The time when this pool was started. |
Dependent item | php-fpm.start_time Preprocessing
|
Processes, total | The total number of server processes currently running. |
Dependent item | php-fpm.processes_total Preprocessing
|
Processes, idle | The total number of idle processes. |
Dependent item | php-fpm.processes_idle Preprocessing
|
Process manager | The method used by the process manager to control the number of child processes for this pool. |
Dependent item | php-fpm.process_manager Preprocessing
|
Processes, max active | The highest value of "active processes" since the PHP-FPM server was started. |
Dependent item | php-fpm.processes_max_active Preprocessing
|
Accepted connections per second | The number of accepted requests per second. |
Dependent item | php-fpm.conn_accepted.rate Preprocessing
|
Slow requests | The number of requests that has exceeded your |
Dependent item | php-fpm.slow_requests Preprocessing
|
Listen queue | The current number of connections that have been initiated but not yet accepted. |
Dependent item | php-fpm.listen_queue Preprocessing
|
Listen queue, max | The maximum number of requests in the queue of pending connections since this FPM pool was started. |
Dependent item | php-fpm.listen_queue_max Preprocessing
|
Listen queue, len | The size of the socket queue of pending connections. |
Dependent item | php-fpm.listen_queue_len Preprocessing
|
Queue usage | The utilization of the queue. |
Calculated | php-fpm.listen_queue_usage |
Max children reached | The number of times that |
Dependent item | php-fpm.max_children Preprocessing
|
Triggers
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
PHP-FPM: Service is down | last(/PHP-FPM by HTTP/php-fpm.ping)=0 or nodata(/PHP-FPM by HTTP/php-fpm.ping,3m)=1 |
High | Manual close: Yes | |
PHP-FPM: Version has changed | The PHP-FPM version has changed. Acknowledge to close the problem manually. |
last(/PHP-FPM by HTTP/php-fpm.version,#1)<>last(/PHP-FPM by HTTP/php-fpm.version,#2) and length(last(/PHP-FPM by HTTP/php-fpm.version))>0 |
Info | Manual close: Yes |
PHP-FPM: Failed to fetch info data | Zabbix has not received any data for items for the last 30 minutes. |
nodata(/PHP-FPM by HTTP/php-fpm.uptime,30m)=1 |
Info | Manual close: Yes Depends on:
|
PHP-FPM: Pool has been restarted | Uptime is less than 10 minutes. |
last(/PHP-FPM by HTTP/php-fpm.uptime)<10m |
Info | Manual close: Yes |
PHP-FPM: Manager changed | The PHP-FPM manager has changed. Acknowledge to close the problem manually. |
last(/PHP-FPM by HTTP/php-fpm.process_manager,#1)<>last(/PHP-FPM by HTTP/php-fpm.process_manager,#2) |
Info | Manual close: Yes |
PHP-FPM: Detected slow requests | The PHP-FPM has detected a slow request. |
min(/PHP-FPM by HTTP/php-fpm.slow_requests,#3)>0 |
Warning | |
PHP-FPM: Queue utilization is high | The queue for this pool has reached |
min(/PHP-FPM by HTTP/php-fpm.listen_queue_usage,15m) > {$PHP_FPM.QUEUE.WARN.MAX} |
Warning |
Feedback
Please report any issues with the template at https://support.zabbix.com
You can also provide feedback, discuss the template, or ask for help at ZABBIX forums
Source: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/app/php-fpm_http?at=release/6.4
PHP-FPM by HTTP
Overview
This template is developed to monitor the FastCGI Process Manager (PHP-FPM) by Zabbix that work without any external scripts. Most of the metrics are collected in one go, thanks to Zabbix bulk data collection.
The template PHP-FPM by Zabbix agent
- collects metrics by polling PHP-FPM status-page with HTTP agent remotely.
Note that this solution supports HTTPS and redirects.
Requirements
Zabbix version: 6.4 and higher.
Tested versions
This template has been tested on:
- PHP 7
- PHP 8
Configuration
Zabbix should be configured according to the instructions in the Templates out of the box section.
Setup
Note that depending on your OS distribution, the PHP-FPM executable/service name can vary. RHEL-like distributions usually name both process and service as php-fpm
, while for Debian/Ubuntu based distributions it may include the version, for example: executable name - php-fpm8.2
, systemd service name - php8.2-fpm
. Adjust the following instructions accordingly if needed.
- Open the PHP-FPM configuration file and enable the status page as shown.
pm.status_path = /status
ping.path = /ping
- Validate the syntax to ensure it is correct before you reload the service. Replace the
<version>
in the command if needed.
$ php-fpm -t
or
$ php-fpm<version> -t
- Reload the
php-fpm
service to make the change active. Replace the<version>
in the command if needed.
$ systemctl reload php-fpm
or
$ systemctl reload php<version>-fpm
- Next, edit the configuration of your web server.
If you use Nginx, edit the configuration file of your Nginx server block (virtual host) and add the location block below it.
# Enable php-fpm status page
location ~ ^/(status|ping)$ {
## disable access logging for request if you prefer
access_log off;
## Only allow trusted IPs for security, deny everyone else
# allow 127.0.0.1;
# allow 1.2.3.4; # your IP here
# deny all;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
## Now the port or socket of the php-fpm pool we want the status of
fastcgi_pass 127.0.0.1:9000;
# fastcgi_pass unix:/run/php-fpm/your_socket.sock;
}
If you use Apache, edit the configuration file of the virtual host and add the following location blocks.
<LocationMatch "/status">
Require ip 127.0.0.1
# Require ip 1.2.3.4 # Your IP here
# Adjust the path to the socket if needed
ProxyPass "unix:/run/php-fpm/www.sock|fcgi://localhost/status"
</LocationMatch>
<LocationMatch "/ping">
Require ip 127.0.0.1
# Require ip 1.2.3.4 # Your IP here
# Adjust the path to the socket if needed
ProxyPass "unix:/run/php-fpm/www.sock|fcgi://localhost/ping"
</LocationMatch>
- Check the web server configuration syntax. The command may vary depending on the OS distribution and web server.
$ nginx -t
or
$ httpd -t
or
$ apachectl configtest
- Reload the web server configuration. The command may vary depending on the OS distribution and web server.
$ systemctl reload nginx
or
$ systemctl reload httpd
or
$ systemctl reload apache2
- Verify that the pages are available with these commands.
curl -L 127.0.0.1/status
curl -L 127.0.0.1/ping
If you use another location of the status/ping pages, don't forget to change the {$PHP_FPM.STATUS.PAGE}/{$PHP_FPM.PING.PAGE}
macro.
If you use another web server port or scheme for the location of the PHP-FPM status/ping pages, don't forget to change the macros {$PHP_FPM.SCHEME}
and {$PHP_FPM.PORT}
.
Macros used
Name | Description | Default |
---|---|---|
{$PHP_FPM.PORT} | The port of the PHP-FPM status host or container. |
80 |
{$PHP_FPM.SCHEME} | Request scheme which may be http or https |
http |
{$PHP_FPM.HOST} | The hostname or IP address of the PHP-FPM status for a host or container. |
localhost |
{$PHP_FPM.STATUS.PAGE} | The path of the PHP-FPM status page. |
status |
{$PHP_FPM.PING.PAGE} | The path of the PHP-FPM ping page. |
ping |
{$PHP_FPM.PING.REPLY} | The expected reply to the ping. |
pong |
{$PHP_FPM.QUEUE.WARN.MAX} | The maximum percent of the PHP-FPM queue usage for a trigger expression. |
80 |
Items
Name | Description | Type | Key and additional info |
---|---|---|---|
PHP-FPM: Get ping page | HTTP agent | php-fpm.get_ping | |
PHP-FPM: Get status page | HTTP agent | php-fpm.get_status | |
PHP-FPM: Ping | Dependent item | php-fpm.ping Preprocessing
|
|
PHP-FPM: Processes, active | The total number of active processes. |
Dependent item | php-fpm.processes_active Preprocessing
|
PHP-FPM: Version | The current version of the PHP. You can get it from the HTTP-Header "X-Powered-By"; it may not work if you have changed the default HTTP-headers. |
Dependent item | php-fpm.version Preprocessing
|
PHP-FPM: Pool name | The name of the current pool. |
Dependent item | php-fpm.name Preprocessing
|
PHP-FPM: Uptime | It indicates how long has this pool been running. |
Dependent item | php-fpm.uptime Preprocessing
|
PHP-FPM: Start time | The time when this pool was started. |
Dependent item | php-fpm.start_time Preprocessing
|
PHP-FPM: Processes, total | The total number of server processes currently running. |
Dependent item | php-fpm.processes_total Preprocessing
|
PHP-FPM: Processes, idle | The total number of idle processes. |
Dependent item | php-fpm.processes_idle Preprocessing
|
PHP-FPM: Process manager | The method used by the process manager to control the number of child processes for this pool. |
Dependent item | php-fpm.process_manager Preprocessing
|
PHP-FPM: Processes, max active | The highest value of "active processes" since the PHP-FPM server was started. |
Dependent item | php-fpm.processes_max_active Preprocessing
|
PHP-FPM: Accepted connections per second | The number of accepted requests per second. |
Dependent item | php-fpm.conn_accepted.rate Preprocessing
|
PHP-FPM: Slow requests | The number of requests that has exceeded your |
Dependent item | php-fpm.slow_requests Preprocessing
|
PHP-FPM: Listen queue | The current number of connections that have been initiated but not yet accepted. |
Dependent item | php-fpm.listen_queue Preprocessing
|
PHP-FPM: Listen queue, max | The maximum number of requests in the queue of pending connections since this FPM pool was started. |
Dependent item | php-fpm.listen_queue_max Preprocessing
|
PHP-FPM: Listen queue, len | The size of the socket queue of pending connections. |
Dependent item | php-fpm.listen_queue_len Preprocessing
|
PHP-FPM: Queue usage | The utilization of the queue. |
Calculated | php-fpm.listen_queue_usage |
PHP-FPM: Max children reached | The number of times that |
Dependent item | php-fpm.max_children Preprocessing
|
Triggers
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
PHP-FPM: Service is down | last(/PHP-FPM by HTTP/php-fpm.ping)=0 or nodata(/PHP-FPM by HTTP/php-fpm.ping,3m)=1 |
High | Manual close: Yes | |
PHP-FPM: Version has changed | The PHP-FPM version has changed. Acknowledge to close the problem manually. |
last(/PHP-FPM by HTTP/php-fpm.version,#1)<>last(/PHP-FPM by HTTP/php-fpm.version,#2) and length(last(/PHP-FPM by HTTP/php-fpm.version))>0 |
Info | Manual close: Yes |
PHP-FPM: Failed to fetch info data | Zabbix has not received any data for items for the last 30 minutes. |
nodata(/PHP-FPM by HTTP/php-fpm.uptime,30m)=1 |
Info | Manual close: Yes Depends on:
|
PHP-FPM: Pool has been restarted | Uptime is less than 10 minutes. |
last(/PHP-FPM by HTTP/php-fpm.uptime)<10m |
Info | Manual close: Yes |
PHP-FPM: Manager changed | The PHP-FPM manager has changed. Acknowledge to close the problem manually. |
last(/PHP-FPM by HTTP/php-fpm.process_manager,#1)<>last(/PHP-FPM by HTTP/php-fpm.process_manager,#2) |
Info | Manual close: Yes |
PHP-FPM: Detected slow requests | The PHP-FPM has detected a slow request. |
min(/PHP-FPM by HTTP/php-fpm.slow_requests,#3)>0 |
Warning | |
PHP-FPM: Queue utilization is high | The queue for this pool has reached |
min(/PHP-FPM by HTTP/php-fpm.listen_queue_usage,15m) > {$PHP_FPM.QUEUE.WARN.MAX} |
Warning |
Feedback
Please report any issues with the template at https://support.zabbix.com
You can also provide feedback, discuss the template, or ask for help at ZABBIX forums
Source: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/app/php-fpm_http?at=release/6.2
PHP-FPM by HTTP
Overview
For Zabbix version: 6.2 and higher
The template to monitor PHP-FPM by Zabbix that work without any external scripts.
Most of the metrics are collected in one go, thanks to Zabbix bulk data collection.
Template PHP-FPM by HTTP
collects metrics by polling PHP-FPM status-page with HTTP agent remotely.
Note that this solution supports https and redirects.
This template was tested on:
- PHP, version 7
Setup
See Zabbix template operation for basic instructions.
-
Open the php-fpm configuration file and enable the status page as shown.
pm.status_path = /status ping.path = /ping
-
Validate the syntax is fine before we reload the service
$ php-fpm7 -t
-
Reload the php-fpm service to make the change active
$ systemctl reload php-fpm
-
Next, edit your Nginx server block (virtual host) configuration file and add the location block below in it.
# Enable php-fpm status page location ~ ^/(status|ping)$ { ## disable access logging for request if you prefer access_log off; ## Only allow trusted IPs for security, deny everyone else # allow 127.0.0.1; # allow 1.2.3.4; # your IP here # deny all; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_index index.php; include fastcgi_params; ## Now the port or socket of the php-fpm pool we want the status of fastcgi_pass 127.0.0.1:9000; # fastcgi_pass unix:/run/php-fpm/your_socket.sock; }
-
Check the syntax
$ nginx -t
-
Reload Nginx
$ systemctl reload nginx
-
Verify
curl -L 127.0.0.1/status
If you use another location of status/ping page, don't forget to change {$PHP_FPM.STATUS.PAGE}/{$PHP_FPM.PING.PAGE} macro.
If you use an atypical location for PHP-FPM status-page don't forget to change the macros {$PHP_FPM.SCHEME},{$PHP_FPM.PORT}.
Zabbix configuration
No specific Zabbix configuration is required.
Macros used
Name | Description | Default |
---|---|---|
{$PHP_FPM.HOST} | Hostname or IP of PHP-FPM status host or container. |
localhost |
{$PHP_FPM.PING.PAGE} | The path of PHP-FPM ping page. |
ping |
{$PHP_FPM.PING.REPLY} | Expected reply to the ping. |
pong |
{$PHP_FPM.PORT} | The port of PHP-FPM status host or container. |
80 |
{$PHP_FPM.QUEUE.WARN.MAX} | The maximum PHP-FPM queue usage percent for trigger expression. |
80 |
{$PHP_FPM.SCHEME} | Request scheme which may be http or https |
http |
{$PHP_FPM.STATUS.PAGE} | The path of PHP-FPM status page. |
status |
Template links
There are no template links in this template.
Discovery rules
Items collected
Group | Name | Description | Type | Key and additional info |
---|---|---|---|---|
PHP-FPM | PHP-FPM: Ping | - |
DEPENDENT | php-fpm.ping Preprocessing: - REGEX: `{$PHP_FPM.PING.REPLY}($ |
PHP-FPM | PHP-FPM: Processes, active | The total number of active processes. |
DEPENDENT | php-fpm.processes_active Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Version | Current version PHP. Get from HTTP-Header "X-Powered-By" and may not work if you change default HTTP-headers. |
DEPENDENT | php-fpm.version Preprocessing: - REGEX: ⛔️ON_FAIL: - DISCARD_UNCHANGED_HEARTBEAT: |
PHP-FPM | PHP-FPM: Pool name | The name of current pool. |
DEPENDENT | php-fpm.name Preprocessing: - JSONPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
PHP-FPM | PHP-FPM: Uptime | How long has this pool been running. |
DEPENDENT | php-fpm.uptime Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Start time | The time when this pool was started. |
DEPENDENT | php-fpm.start_time Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Processes, total | The total number of server processes currently running. |
DEPENDENT | php-fpm.processes_total Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Processes, idle | The total number of idle processes. |
DEPENDENT | php-fpm.processes_idle Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Process manager | The method used by the process manager to control the number of child processes for this pool. |
DEPENDENT | php-fpm.process_manager Preprocessing: - JSONPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
PHP-FPM | PHP-FPM: Processes, max active | The highest value that 'active processes' has reached since the php-fpm server started. |
DEPENDENT | php-fpm.processes_max_active Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Accepted connections per second | The number of accepted requests per second. |
DEPENDENT | php-fpm.conn_accepted.rate Preprocessing: - JSONPATH: - CHANGE_PER_SECOND |
PHP-FPM | PHP-FPM: Slow requests | The number of requests that exceeded your request_slowlog_timeout value. |
DEPENDENT | php-fpm.slow_requests Preprocessing: - JSONPATH: - SIMPLE_CHANGE |
PHP-FPM | PHP-FPM: Listen queue | The current number of connections that have been initiated, but not yet accepted. |
DEPENDENT | php-fpm.listen_queue Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Listen queue, max | The maximum number of requests in the queue of pending connections since this FPM pool has started. |
DEPENDENT | php-fpm.listen_queue_max Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Listen queue, len | Size of the socket queue of pending connections. |
DEPENDENT | php-fpm.listen_queue_len Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Queue usage | Queue utilization |
CALCULATED | php-fpm.listen_queue_usage Expression: last(//php-fpm.listen_queue)/(last(//php-fpm.listen_queue_len)+(last(//php-fpm.listen_queue_len)=0))*100 |
PHP-FPM | PHP-FPM: Max children reached | The number of times that pm.max_children has been reached since the php-fpm pool started |
DEPENDENT | php-fpm.max_children Preprocessing: - JSONPATH: - SIMPLE_CHANGE |
Zabbix raw items | PHP-FPM: Get ping page | - |
HTTP_AGENT | php-fpm.get_ping |
Zabbix raw items | PHP-FPM: Get status page | - |
HTTP_AGENT | php-fpm.get_status |
Triggers
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
PHP-FPM: Service is down | - |
last(/PHP-FPM by HTTP/php-fpm.ping)=0 or nodata(/PHP-FPM by HTTP/php-fpm.ping,3m)=1 |
HIGH | Manual close: YES |
PHP-FPM: Version has changed | PHP-FPM version has changed. Ack to close. |
last(/PHP-FPM by HTTP/php-fpm.version,#1)<>last(/PHP-FPM by HTTP/php-fpm.version,#2) and length(last(/PHP-FPM by HTTP/php-fpm.version))>0 |
INFO | Manual close: YES |
PHP-FPM: Failed to fetch info data | Zabbix has not received data for items for the last 30 minutes |
nodata(/PHP-FPM by HTTP/php-fpm.uptime,30m)=1 |
INFO | Manual close: YES Depends on: - PHP-FPM: Service is down |
PHP-FPM: Pool has been restarted | Uptime is less than 10 minutes. |
last(/PHP-FPM by HTTP/php-fpm.uptime)<10m |
INFO | Manual close: YES |
PHP-FPM: Manager changed | PHP-FPM manager changed. Ack to close. |
last(/PHP-FPM by HTTP/php-fpm.process_manager,#1)<>last(/PHP-FPM by HTTP/php-fpm.process_manager,#2) |
INFO | Manual close: YES |
PHP-FPM: Detected slow requests | PHP-FPM detected slow request. A slow request means that it took more time to execute than expected (defined in the configuration of your pool). |
min(/PHP-FPM by HTTP/php-fpm.slow_requests,#3)>0 |
WARNING | |
PHP-FPM: Queue utilization is high | The queue for this pool reached {$PHP_FPM.QUEUE.WARN.MAX}% of its maximum capacity. Items in queue represent the current number of connections that have been initiated on this pool, but not yet accepted. |
min(/PHP-FPM by HTTP/php-fpm.listen_queue_usage,15m) > {$PHP_FPM.QUEUE.WARN.MAX} |
WARNING |
Feedback
Please report any issues with the template at https://support.zabbix.com
Source: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/app/php-fpm_http?at=release/6.0
PHP-FPM by HTTP
Overview
This template is developed to monitor the FastCGI Process Manager (PHP-FPM) by Zabbix that work without any external scripts. Most of the metrics are collected in one go, thanks to Zabbix bulk data collection.
The template PHP-FPM by Zabbix agent
- collects metrics by polling PHP-FPM status-page with HTTP agent remotely.
Note that this solution supports HTTPS and redirects.
Requirements
Zabbix version: 6.0 and higher.
Tested versions
This template has been tested on:
- PHP 7
- PHP 8
Configuration
Zabbix should be configured according to the instructions in the Templates out of the box section.
Setup
Note that depending on your OS distribution, the PHP-FPM executable/service name can vary. RHEL-like distributions usually name both process and service as php-fpm
, while for Debian/Ubuntu based distributions it may include the version, for example: executable name - php-fpm8.2
, systemd service name - php8.2-fpm
. Adjust the following instructions accordingly if needed.
- Open the PHP-FPM configuration file and enable the status page as shown.
pm.status_path = /status
ping.path = /ping
- Validate the syntax to ensure it is correct before you reload the service. Replace the
<version>
in the command if needed.
$ php-fpm -t
or
$ php-fpm<version> -t
- Reload the
php-fpm
service to make the change active. Replace the<version>
in the command if needed.
$ systemctl reload php-fpm
or
$ systemctl reload php<version>-fpm
- Next, edit the configuration of your web server.
If you use Nginx, edit the configuration file of your Nginx server block (virtual host) and add the location block below it.
# Enable php-fpm status page
location ~ ^/(status|ping)$ {
## disable access logging for request if you prefer
access_log off;
## Only allow trusted IPs for security, deny everyone else
# allow 127.0.0.1;
# allow 1.2.3.4; # your IP here
# deny all;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
## Now the port or socket of the php-fpm pool we want the status of
fastcgi_pass 127.0.0.1:9000;
# fastcgi_pass unix:/run/php-fpm/your_socket.sock;
}
If you use Apache, edit the configuration file of the virtual host and add the following location blocks.
<LocationMatch "/status">
Require ip 127.0.0.1
# Require ip 1.2.3.4 # Your IP here
# Adjust the path to the socket if needed
ProxyPass "unix:/run/php-fpm/www.sock|fcgi://localhost/status"
</LocationMatch>
<LocationMatch "/ping">
Require ip 127.0.0.1
# Require ip 1.2.3.4 # Your IP here
# Adjust the path to the socket if needed
ProxyPass "unix:/run/php-fpm/www.sock|fcgi://localhost/ping"
</LocationMatch>
- Check the web server configuration syntax. The command may vary depending on the OS distribution and web server.
$ nginx -t
or
$ httpd -t
or
$ apachectl configtest
- Reload the web server configuration. The command may vary depending on the OS distribution and web server.
$ systemctl reload nginx
or
$ systemctl reload httpd
or
$ systemctl reload apache2
- Verify that the pages are available with these commands.
curl -L 127.0.0.1/status
curl -L 127.0.0.1/ping
If you use another location of the status/ping pages, don't forget to change the {$PHP_FPM.STATUS.PAGE}/{$PHP_FPM.PING.PAGE}
macro.
If you use another web server port or scheme for the location of the PHP-FPM status/ping pages, don't forget to change the macros {$PHP_FPM.SCHEME}
and {$PHP_FPM.PORT}
.
Macros used
Name | Description | Default |
---|---|---|
{$PHP_FPM.PORT} | The port of the PHP-FPM status host or container. |
80 |
{$PHP_FPM.SCHEME} | Request scheme which may be http or https |
http |
{$PHP_FPM.HOST} | The hostname or IP address of the PHP-FPM status for a host or container. |
localhost |
{$PHP_FPM.STATUS.PAGE} | The path of the PHP-FPM status page. |
status |
{$PHP_FPM.PING.PAGE} | The path of the PHP-FPM ping page. |
ping |
{$PHP_FPM.PING.REPLY} | The expected reply to the ping. |
pong |
{$PHP_FPM.QUEUE.WARN.MAX} | The maximum percent of the PHP-FPM queue usage for a trigger expression. |
80 |
Items
Name | Description | Type | Key and additional info |
---|---|---|---|
PHP-FPM: Get ping page | HTTP agent | php-fpm.get_ping | |
PHP-FPM: Get status page | HTTP agent | php-fpm.get_status | |
PHP-FPM: Ping | Dependent item | php-fpm.ping Preprocessing
|
|
PHP-FPM: Processes, active | The total number of active processes. |
Dependent item | php-fpm.processes_active Preprocessing
|
PHP-FPM: Version | The current version of the PHP. You can get it from the HTTP-Header "X-Powered-By"; it may not work if you have changed the default HTTP-headers. |
Dependent item | php-fpm.version Preprocessing
|
PHP-FPM: Pool name | The name of the current pool. |
Dependent item | php-fpm.name Preprocessing
|
PHP-FPM: Uptime | It indicates how long has this pool been running. |
Dependent item | php-fpm.uptime Preprocessing
|
PHP-FPM: Start time | The time when this pool was started. |
Dependent item | php-fpm.start_time Preprocessing
|
PHP-FPM: Processes, total | The total number of server processes currently running. |
Dependent item | php-fpm.processes_total Preprocessing
|
PHP-FPM: Processes, idle | The total number of idle processes. |
Dependent item | php-fpm.processes_idle Preprocessing
|
PHP-FPM: Process manager | The method used by the process manager to control the number of child processes for this pool. |
Dependent item | php-fpm.process_manager Preprocessing
|
PHP-FPM: Processes, max active | The highest value of "active processes" since the PHP-FPM server was started. |
Dependent item | php-fpm.processes_max_active Preprocessing
|
PHP-FPM: Accepted connections per second | The number of accepted requests per second. |
Dependent item | php-fpm.conn_accepted.rate Preprocessing
|
PHP-FPM: Slow requests | The number of requests that has exceeded your |
Dependent item | php-fpm.slow_requests Preprocessing
|
PHP-FPM: Listen queue | The current number of connections that have been initiated but not yet accepted. |
Dependent item | php-fpm.listen_queue Preprocessing
|
PHP-FPM: Listen queue, max | The maximum number of requests in the queue of pending connections since this FPM pool was started. |
Dependent item | php-fpm.listen_queue_max Preprocessing
|
PHP-FPM: Listen queue, len | The size of the socket queue of pending connections. |
Dependent item | php-fpm.listen_queue_len Preprocessing
|
PHP-FPM: Queue usage | The utilization of the queue. |
Calculated | php-fpm.listen_queue_usage |
PHP-FPM: Max children reached | The number of times that |
Dependent item | php-fpm.max_children Preprocessing
|
Triggers
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
PHP-FPM: Service is down | last(/PHP-FPM by HTTP/php-fpm.ping)=0 or nodata(/PHP-FPM by HTTP/php-fpm.ping,3m)=1 |
High | Manual close: Yes | |
PHP-FPM: Version has changed | The PHP-FPM version has changed. Acknowledge to close the problem manually. |
last(/PHP-FPM by HTTP/php-fpm.version,#1)<>last(/PHP-FPM by HTTP/php-fpm.version,#2) and length(last(/PHP-FPM by HTTP/php-fpm.version))>0 |
Info | Manual close: Yes |
PHP-FPM: Failed to fetch info data | Zabbix has not received any data for items for the last 30 minutes. |
nodata(/PHP-FPM by HTTP/php-fpm.uptime,30m)=1 |
Info | Manual close: Yes Depends on:
|
PHP-FPM: Pool has been restarted | Uptime is less than 10 minutes. |
last(/PHP-FPM by HTTP/php-fpm.uptime)<10m |
Info | Manual close: Yes |
PHP-FPM: Manager changed | The PHP-FPM manager has changed. Acknowledge to close the problem manually. |
last(/PHP-FPM by HTTP/php-fpm.process_manager,#1)<>last(/PHP-FPM by HTTP/php-fpm.process_manager,#2) |
Info | Manual close: Yes |
PHP-FPM: Detected slow requests | The PHP-FPM has detected a slow request. |
min(/PHP-FPM by HTTP/php-fpm.slow_requests,#3)>0 |
Warning | |
PHP-FPM: Queue utilization is high | The queue for this pool has reached |
min(/PHP-FPM by HTTP/php-fpm.listen_queue_usage,15m) > {$PHP_FPM.QUEUE.WARN.MAX} |
Warning |
Feedback
Please report any issues with the template at https://support.zabbix.com
You can also provide feedback, discuss the template, or ask for help at ZABBIX forums
Source: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/app/php-fpm_http?at=release/5.4
PHP-FPM by HTTP
Overview
For Zabbix version: 5.4 and higher
The template to monitor PHP-FPM by Zabbix that work without any external scripts.
Most of the metrics are collected in one go, thanks to Zabbix bulk data collection.
Template PHP-FPM by HTTP
collects metrics by polling PHP-FPM status-page with HTTP agent remotely.
Note that this solution supports https and redirects.
This template was tested on:
- PHP, version 7
Setup
See Zabbix template operation for basic instructions.
-
Open the php-fpm configuration file and enable the status page as shown.
pm.status_path = /status ping.path = /ping
-
Validate the syntax is fine before we reload the service
$ php-fpm7 -t
-
Reload the php-fpm service to make the change active
$ systemctl reload php-fpm
-
Next, edit your Nginx server block (virtual host) configuration file and add the location block below in it.
# Enable php-fpm status page location ~ ^/(status|ping)$ { ## disable access logging for request if you prefer access_log off; ## Only allow trusted IPs for security, deny everyone else # allow 127.0.0.1; # allow 1.2.3.4; # your IP here # deny all; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_index index.php; include fastcgi_params; ## Now the port or socket of the php-fpm pool we want the status of fastcgi_pass 127.0.0.1:9000; # fastcgi_pass unix:/run/php-fpm/your_socket.sock; }
-
Check the syntax
$ nginx -t
-
Reload Nginx
$ systemctl reload nginx
-
Verify
curl -L 127.0.0.1/status
If you use another location of status/ping page, don't forget to change {$PHP_FPM.STATUS.PAGE}/{$PHP_FPM.PING.PAGE} macro.
If you use an atypical location for PHP-FPM status-page don't forget to change the macros {$PHP_FPM.SCHEME},{$PHP_FPM.PORT}.
Zabbix configuration
No specific Zabbix configuration is required.
Macros used
Name | Description | Default |
---|---|---|
{$PHP_FPM.HOST} | Hostname or IP of PHP-FPM status host or container. |
localhost |
{$PHP_FPM.PING.PAGE} | The path of PHP-FPM ping page. |
ping |
{$PHP_FPM.PING.REPLY} | Expected reply to the ping. |
pong |
{$PHP_FPM.PORT} | The port of PHP-FPM status host or container. |
80 |
{$PHP_FPM.QUEUE.WARN.MAX} | The maximum PHP-FPM queue usage percent for trigger expression. |
80 |
{$PHP_FPM.SCHEME} | Request scheme which may be http or https |
http |
{$PHP_FPM.STATUS.PAGE} | The path of PHP-FPM status page. |
status |
Template links
There are no template links in this template.
Discovery rules
Items collected
Group | Name | Description | Type | Key and additional info |
---|---|---|---|---|
PHP-FPM | PHP-FPM: Ping | - |
DEPENDENT | php-fpm.ping Preprocessing: - REGEX: `{$PHP_FPM.PING.REPLY}($ |
PHP-FPM | PHP-FPM: Processes, active | The total number of active processes. |
DEPENDENT | php-fpm.processes_active Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Version | Current version PHP. Get from HTTP-Header "X-Powered-By" and may not work if you change default HTTP-headers. |
DEPENDENT | php-fpm.version Preprocessing: - REGEX: ⛔️ON_FAIL: - DISCARD_UNCHANGED_HEARTBEAT: |
PHP-FPM | PHP-FPM: Pool name | The name of current pool. |
DEPENDENT | php-fpm.name Preprocessing: - JSONPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
PHP-FPM | PHP-FPM: Uptime | How long has this pool been running. |
DEPENDENT | php-fpm.uptime Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Start time | The time when this pool was started. |
DEPENDENT | php-fpm.start_time Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Processes, total | The total number of server processes currently running. |
DEPENDENT | php-fpm.processes_total Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Processes, idle | The total number of idle processes. |
DEPENDENT | php-fpm.processes_idle Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Process manager | The method used by the process manager to control the number of child processes for this pool. |
DEPENDENT | php-fpm.process_manager Preprocessing: - JSONPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
PHP-FPM | PHP-FPM: Processes, max active | The highest value that 'active processes' has reached since the php-fpm server started. |
DEPENDENT | php-fpm.processes_max_active Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Accepted connections per second | The number of accepted requests per second. |
DEPENDENT | php-fpm.conn_accepted.rate Preprocessing: - JSONPATH: - CHANGE_PER_SECOND |
PHP-FPM | PHP-FPM: Slow requests | The number of requests that exceeded your request_slowlog_timeout value. |
DEPENDENT | php-fpm.slow_requests Preprocessing: - JSONPATH: - SIMPLE_CHANGE |
PHP-FPM | PHP-FPM: Listen queue | The current number of connections that have been initiated, but not yet accepted. |
DEPENDENT | php-fpm.listen_queue Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Listen queue, max | The maximum number of requests in the queue of pending connections since this FPM pool has started. |
DEPENDENT | php-fpm.listen_queue_max Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Listen queue, len | Size of the socket queue of pending connections. |
DEPENDENT | php-fpm.listen_queue_len Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Queue usage | Queue utilization |
CALCULATED | php-fpm.listen_queue_usage Expression: last(//php-fpm.listen_queue)/(last(//php-fpm.listen_queue_len)+(last(//php-fpm.listen_queue_len)=0))*100 |
PHP-FPM | PHP-FPM: Max children reached | The number of times that pm.max_children has been reached since the php-fpm pool started |
DEPENDENT | php-fpm.max_children Preprocessing: - JSONPATH: - SIMPLE_CHANGE |
Zabbix_raw_items | PHP-FPM: Get ping page | - |
HTTP_AGENT | php-fpm.get_ping |
Zabbix_raw_items | PHP-FPM: Get status page | - |
HTTP_AGENT | php-fpm.get_status |
Triggers
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
PHP-FPM: Service is down | - |
last(/PHP-FPM by HTTP/php-fpm.ping)=0 or nodata(/PHP-FPM by HTTP/php-fpm.ping,3m)=1 |
HIGH | Manual close: YES |
PHP-FPM: Version has changed (new version: {ITEM.VALUE}) | PHP-FPM version has changed. Ack to close. |
last(/PHP-FPM by HTTP/php-fpm.version,#1)<>last(/PHP-FPM by HTTP/php-fpm.version,#2) and length(last(/PHP-FPM by HTTP/php-fpm.version))>0 |
INFO | Manual close: YES |
PHP-FPM: Failed to fetch info data (or no data for 30m) | Zabbix has not received data for items for the last 30 minutes |
nodata(/PHP-FPM by HTTP/php-fpm.uptime,30m)=1 |
INFO | Manual close: YES Depends on: - PHP-FPM: Service is down |
PHP-FPM: has been restarted (uptime < 10m) | Uptime is less than 10 minutes |
last(/PHP-FPM by HTTP/php-fpm.uptime)<10m |
INFO | Manual close: YES |
PHP-FPM: Manager changed (new value received: {ITEM.VALUE}) | PHP-FPM manager changed. Ack to close. |
last(/PHP-FPM by HTTP/php-fpm.process_manager,#1)<>last(/PHP-FPM by HTTP/php-fpm.process_manager,#2) |
INFO | Manual close: YES |
PHP-FPM: Detected slow requests | PHP-FPM detected slow request. A slow request means that it took more time to execute than expected (defined in the configuration of your pool). |
min(/PHP-FPM by HTTP/php-fpm.slow_requests,#3)>0 |
WARNING | |
PHP-FPM: Queue utilization is high (over {$PHP_FPM.QUEUE.WARN.MAX}% for 15m) | The queue for this pool reached {$PHP_FPM.QUEUE.WARN.MAX}% of its maximum capacity. Items in queue represent the current number of connections that have been initiated on this pool, but not yet accepted. |
min(/PHP-FPM by HTTP/php-fpm.listen_queue_usage,15m) > {$PHP_FPM.QUEUE.WARN.MAX} |
WARNING |
Feedback
Please report any issues with the template at https://support.zabbix.com
Source: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/app/php-fpm_http?at=release/5.0
Template App PHP-FPM by HTTP
Overview
For Zabbix version: 5.0 and higher
The template to monitor PHP-FPM by Zabbix that work without any external scripts.
Most of the metrics are collected in one go, thanks to Zabbix bulk data collection.
Template PHP-FPM by HTTP
collects metrics by polling PHP-FPM status-page with HTTP agent remotely.
Note that this solution supports https and redirects.
This template was tested on:
- PHP, version 7
Setup
See Zabbix template operation for basic instructions.
-
Open the php-fpm configuration file and enable the status page as shown.
pm.status_path = /status ping.path = /ping
-
Validate the syntax is fine before we reload the service
$ php-fpm7 -t
-
Reload the php-fpm service to make the change active
$ systemctl reload php-fpm
-
Next, edit your Nginx server block (virtual host) configuration file and add the location block below in it.
# Enable php-fpm status page location ~ ^/(status|ping)$ { ## disable access logging for request if you prefer access_log off; ## Only allow trusted IPs for security, deny everyone else # allow 127.0.0.1; # allow 1.2.3.4; # your IP here # deny all; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_index index.php; include fastcgi_params; ## Now the port or socket of the php-fpm pool we want the status of fastcgi_pass 127.0.0.1:9000; # fastcgi_pass unix:/run/php-fpm/your_socket.sock; }
-
Check the syntax
$ nginx -t
-
Reload Nginx
$ systemctl reload nginx
-
Verify
curl -L 127.0.0.1/status
If you use another location of status/ping page, don't forget to change {$PHP_FPM.STATUS.PAGE}/{$PHP_FPM.PING.PAGE} macro.
If you use an atypical location for PHP-FPM status-page don't forget to change the macros {$PHP_FPM.SCHEME},{$PHP_FPM.PORT}.
Zabbix configuration
No specific Zabbix configuration is required.
Macros used
Name | Description | Default |
---|---|---|
{$PHP_FPM.HOST} | Hostname or IP of PHP-FPM status host or container. |
localhost |
{$PHP_FPM.PING.PAGE} | The path of PHP-FPM ping page. |
ping |
{$PHP_FPM.PING.REPLY} | Expected reply to the ping. |
pong |
{$PHP_FPM.PORT} | The port of PHP-FPM status host or container. |
80 |
{$PHP_FPM.QUEUE.WARN.MAX} | The maximum PHP-FPM queue usage percent for trigger expression. |
80 |
{$PHP_FPM.SCHEME} | Request scheme which may be http or https |
http |
{$PHP_FPM.STATUS.PAGE} | The path of PHP-FPM status page. |
status |
Template links
There are no template links in this template.
Discovery rules
Items collected
Group | Name | Description | Type | Key and additional info |
---|---|---|---|---|
PHP-FPM | PHP-FPM: Ping | - |
DEPENDENT | php-fpm.ping Preprocessing: - REGEX: `{$PHP_FPM.PING.REPLY}($ |
PHP-FPM | PHP-FPM: Processes, active | The total number of active processes. |
DEPENDENT | php-fpm.processes_active Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Version | Current version PHP. Get from HTTP-Header "X-Powered-By" and may not work if you change default HTTP-headers. |
DEPENDENT | php-fpm.version Preprocessing: - REGEX: ⛔️ON_FAIL: - DISCARD_UNCHANGED_HEARTBEAT: |
PHP-FPM | PHP-FPM: Pool name | The name of current pool. |
DEPENDENT | php-fpm.name Preprocessing: - JSONPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
PHP-FPM | PHP-FPM: Uptime | How long has this pool been running. |
DEPENDENT | php-fpm.uptime Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Start time | The time when this pool was started. |
DEPENDENT | php-fpm.start_time Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Processes, total | The total number of server processes currently running. |
DEPENDENT | php-fpm.processes_total Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Processes, idle | The total number of idle processes. |
DEPENDENT | php-fpm.processes_idle Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Process manager | The method used by the process manager to control the number of child processes for this pool. |
DEPENDENT | php-fpm.process_manager Preprocessing: - JSONPATH: - DISCARD_UNCHANGED_HEARTBEAT: |
PHP-FPM | PHP-FPM: Processes, max active | The highest value that 'active processes' has reached since the php-fpm server started. |
DEPENDENT | php-fpm.processes_max_active Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Accepted connections per second | The number of accepted requests per second. |
DEPENDENT | php-fpm.conn_accepted.rate Preprocessing: - JSONPATH: - CHANGE_PER_SECOND |
PHP-FPM | PHP-FPM: Slow requests | The number of requests that exceeded your request_slowlog_timeout value. |
DEPENDENT | php-fpm.slow_requests Preprocessing: - JSONPATH: - SIMPLE_CHANGE |
PHP-FPM | PHP-FPM: Listen queue | The current number of connections that have been initiated, but not yet accepted. |
DEPENDENT | php-fpm.listen_queue Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Listen queue, max | The maximum number of requests in the queue of pending connections since this FPM pool has started. |
DEPENDENT | php-fpm.listen_queue_max Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Listen queue, len | Size of the socket queue of pending connections. |
DEPENDENT | php-fpm.listen_queue_len Preprocessing: - JSONPATH: |
PHP-FPM | PHP-FPM: Queue usage | Queue utilization |
CALCULATED | php-fpm.listen_queue_usage Expression: last(php-fpm.listen_queue)/(last(php-fpm.listen_queue_len)+(last(php-fpm.listen_queue_len)=0))*100 |
PHP-FPM | PHP-FPM: Max children reached | The number of times that pm.max_children has been reached since the php-fpm pool started |
DEPENDENT | php-fpm.max_children Preprocessing: - JSONPATH: - SIMPLE_CHANGE |
Zabbix_raw_items | PHP-FPM: Get ping page | - |
HTTP_AGENT | php-fpm.get_ping |
Zabbix_raw_items | PHP-FPM: Get status page | - |
HTTP_AGENT | php-fpm.get_status |
Triggers
Name | Description | Expression | Severity | Dependencies and additional info |
---|---|---|---|---|
PHP-FPM: Service is down | - |
{TEMPLATE_NAME:php-fpm.ping.last()}=0 or {TEMPLATE_NAME:php-fpm.ping.nodata(3m)}=1 |
HIGH | Manual close: YES |
PHP-FPM: Version has changed (new version: {ITEM.VALUE}) | PHP-FPM version has changed. Ack to close. |
{TEMPLATE_NAME:php-fpm.version.diff()}=1 and {TEMPLATE_NAME:php-fpm.version.strlen()}>0 |
INFO | Manual close: YES |
PHP-FPM: Failed to fetch info data (or no data for 30m) | Zabbix has not received data for items for the last 30 minutes |
{TEMPLATE_NAME:php-fpm.uptime.nodata(30m)}=1 |
INFO | Manual close: YES Depends on: - PHP-FPM: Service is down |
PHP-FPM: Pool has been restarted (uptime < 10m) | Uptime is less than 10 minutes. |
{TEMPLATE_NAME:php-fpm.uptime.last()}<10m |
INFO | Manual close: YES |
PHP-FPM: Manager changed (new value received: {ITEM.VALUE}) | PHP-FPM manager changed. Ack to close. |
{TEMPLATE_NAME:php-fpm.process_manager.diff()}=1 |
INFO | Manual close: YES |
PHP-FPM: Detected slow requests | PHP-FPM detected slow request. A slow request means that it took more time to execute than expected (defined in the configuration of your pool). |
{TEMPLATE_NAME:php-fpm.slow_requests.min(#3)}>0 |
WARNING | |
PHP-FPM: Queue utilization is high (over {$PHP_FPM.QUEUE.WARN.MAX}% for 15m) | The queue for this pool reached {$PHP_FPM.QUEUE.WARN.MAX}% of its maximum capacity. Items in queue represent the current number of connections that have been initiated on this pool, but not yet accepted. |
{TEMPLATE_NAME:php-fpm.listen_queue_usage.min(15m)} > {$PHP_FPM.QUEUE.WARN.MAX} |
WARNING |
Feedback
Please report any issues with the template at https://support.zabbix.com