phpfpm uses its own status optimization steps
php-fpm has a built-in status page like nginx, which is very helpful for understanding the status of php-fpm and monitoring php-fpm. For subsequent zabbix monitoring, we need to first understand what the php-fpm status page is.
1. Enable php-fpm status function
<code><span># cat /usr/local/php-5.5.10/etc/php-fpm.conf | grep status_path</span> pm.status_path = /status</code>
2. nginx configuration
<code>server { listen *:<span>80</span> default_server; server_name _; location ~ ^/(status|ping)$ { <span><strong>include</strong></span> fastcgi_params; fastcgi_pass <span>127.0</span><span>.0</span><span>.1</span>:<span>9000</span>; fastcgi_param SCRIPT_FILENAME <span>$fastcgi_script_name</span>; } }</code>
3. Restart nginx/php-fpm
<code>service nginx restart service php<span>-fpm</span> restart</code>
4. Open the status page
<code><span># curl http://www.ttlsa.com/status</span> pool: www process manager: dynamic start time: <span>14</span>/May/<span>2014</span>:<span>22</span>:<span>40</span>:<span>15</span> +<span>0800</span> start since: <span>58508</span> accepted conn: <span>33</span> listen queue: <span>0</span> max listen queue: <span>8</span> listen queue len: <span>0</span> idle processes: <span>2</span> active processes: <span>1</span> total processes: <span>3</span> max active processes: <span>5</span> max children reached: <span>0</span> slow requests: <span>2091</span></code>
5. Detailed explanation of php-fpm status
- pool – fpm pool name, mostly www
process manager – process management method, value: static, dynamic or ondemand. dynamic
start time – start date, if php-fpm is reloaded, the time will be updated
start since – running time
accepted conn – the number of requests accepted by the current poollisten queue
–request waiting<strong>queue</strong>, if this value is not 0, then increase the number of FPM processes
max listen queue – the highest number of requests waiting in the queue listen queue len – socket waiting queue
length idle processes – number of idle processes active processes – Number of active processes
total processes – total number of processes
max active processes - the maximum number of active processes (counted after FPM starts)
max children reached
-The number of times the maximum number of processes is limited. If this number is not 0, it means that your maximum number of processes is too small, please Make it bigger.
slow requests – php-fpm slow-log is enabled, the number of slow requests
6. Other parameters of php-fpm
One of the more personalized aspects of the php-fpm status page is that it can take parameters, it can take parameters
json, xml
, html
and the first three parameters can be combined with full
respectively.
6.1 json<code># curl http://<span>127.0</span><span>.0</span><span>.1</span>/status?json {"<span>pool</span>":<span><span>"www"</span></span>,"<span>process manager</span>":<span><span>"dynamic"</span></span>,"<span>start time</span>":<span><span>1400078415</span></span>,"<span>start since</span>":<span><span>59624</span></span>,"<span>accepted conn</span>":<span><span>27</span></span>,"<span>listen queue</span>":<span><span>0</span></span>,"<span>max listen queue</span>":<span><span>8</span></span>,"<span>listen queue len</span>":<span><span>0</span></span>,"<span>idle processes</span>":<span><span>2</span></span>,"<span>active processes</span>":<span><span>1</span></span>,"<span>total processes</span>":<span><span>3</span></span>,"<span>max active processes</span>":<span><span>5</span></span>,"<span>max children reached</span>":<span><span>0</span></span>,"<span>slow requests</span>":<span><span>2145</span></span>}</code>
Copy after login
<code># curl http://127.0.0.1/status?xml <span><?xml version="1.0" ?></span><span><<span>status</span>></span><span><<span>pool</span>></span>www<span></<span>pool</span>></span><span><<span>process-manager</span>></span>dynamic<span></<span>process-manager</span>></span><span><<span>start-time</span>></span>1400078415<span></<span>start-time</span>></span><span><<span>start-since</span>></span>59640<span></<span>start-since</span>></span><span><<span>accepted-conn</span>></span>36<span></<span>accepted-conn</span>></span><span><<span>listen-queue</span>></span>0<span></<span>listen-queue</span>></span><span><<span>max-listen-queue</span>></span>8<span></<span>max-listen-queue</span>></span><span><<span>listen-queue-len</span>></span>0<span></<span>listen-queue-len</span>></span><span><<span>idle-processes</span>></span>2<span></<span>idle-processes</span>></span><span><<span>active-processes</span>></span>1<span></<span>active-processes</span>></span><span><<span>total-processes</span>></span>3<span></<span>total-processes</span>></span><span><<span>max-active-processes</span>></span>5<span></<span>max-active-processes</span>></span><span><<span>max-children-reached</span>></span>0<span></<span>max-children-reached</span>></span><span><<span>slow-requests</span>></span>2145<span></<span>slow-requests</span>></span></code>
Copy after login
<code># curl http://127.0.0.1/status?html <span><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"></span><span><<span>html</span><span>xmlns</span>=<span>"http://www.w3.org/1999/xhtml"</span><span>xml:lang</span>=<span>"en"</span><span>lang</span>=<span>"en"</span>></span><span><<span>head</span>></span><span><<span>title</span>></span>PHP-FPM Status Page<span></<span>title</span>></span><span></<span>head</span>></span><span><<span>body</span>></span><span><<span>table</span>></span><span><<span>tr</span>></span><span><<span>th</span>></span>pool<span></<span>th</span>></span><span><<span>td</span>></span>www<span></<span>td</span>></span><span></<span>tr</span>></span><span><<span>tr</span>></span><span><<span>th</span>></span>process manager<span></<span>th</span>></span><span><<span>td</span>></span>dynamic<span></<span>td</span>></span><span></<span>tr</span>></span><span><<span>tr</span>></span><span><<span>th</span>></span>start time<span></<span>th</span>></span><span><<span>td</span>></span>14/May/2014:22:40:15 +0800<span></<span>td</span>></span><span></<span>tr</span>></span><span><<span>tr</span>></span><span><<span>th</span>></span>start since<span></<span>th</span>></span><span><<span>td</span>></span>59662<span></<span>td</span>></span><span></<span>tr</span>></span><span><<span>tr</span>></span><span><<span>th</span>></span>accepted conn<span></<span>th</span>></span><span><<span>td</span>></span>8<span></<span>td</span>></span><span></<span>tr</span>></span><span><<span>tr</span>></span><span><<span>th</span>></span>listen queue<span></<span>th</span>></span><span><<span>td</span>></span>0<span></<span>td</span>></span><span></<span>tr</span>></span><span><<span>tr</span>></span><span><<span>th</span>></span>max listen queue<span></<span>th</span>></span><span><<span>td</span>></span>8<span></<span>td</span>></span><span></<span>tr</span>></span><span><<span>tr</span>></span><span><<span>th</span>></span>listen queue len<span></<span>th</span>></span><span><<span>td</span>></span>0<span></<span>td</span>></span><span></<span>tr</span>></span><span><<span>tr</span>></span><span><<span>th</span>></span>idle processes<span></<span>th</span>></span><span><<span>td</span>></span>2<span></<span>td</span>></span><span></<span>tr</span>></span><span><<span>tr</span>></span><span><<span>th</span>></span>active processes<span></<span>th</span>></span><span><<span>td</span>></span>1<span></<span>td</span>></span><span></<span>tr</span>></span><span><<span>tr</span>></span><span><<span>th</span>></span>total processes<span></<span>th</span>></span><span><<span>td</span>></span>3<span></<span>td</span>></span><span></<span>tr</span>></span><span><<span>tr</span>></span><span><<span>th</span>></span>max active processes<span></<span>th</span>></span><span><<span>td</span>></span>5<span></<span>td</span>></span><span></<span>tr</span>></span><span><<span>tr</span>></span><span><<span>th</span>></span>max children reached<span></<span>th</span>></span><span><<span>td</span>></span>0<span></<span>td</span>></span><span></<span>tr</span>></span><span><<span>tr</span>></span><span><<span>th</span>></span>slow requests<span></<span>th</span>></span><span><<span>td</span>></span>2147<span></<span>td</span>></span><span></<span>tr</span>></span><span></<span>table</span>></span><span></<span>body</span>></span><span></<span>html</span>></span></code>
Copy after login
<code># curl http://127.0.0.1/status?full pool: www process manager: dynamic start time: 14/May/2014:22:40:15 +0800 start since: 59695 accepted conn: 1 listen queue: 0 max listen queue: 8 listen queue len: 0 idle processes: 2 active processes: 1 total processes: 3 max active processes: 5 max children reached: 0 slow requests: 2148 ************************ pid: 29050 state: Idle start time: 15/May/2014:15:09:32 +0800 start since: 338 requests: 62 request duration: 1025585 request method: GET request URI: /index.php content length: 0 user: - script: /data/site/www.ttlsa.com/index.php last request cpu: 45.83 last request memory: 24903680 .....省略几个PID....</code>
Copy after login
- pid – Process PID, you can kill this process alone. You can use this PID to kill a long running process. state – the state of the current process (Idle, Running, …)
-
start time – the date the process started
start since – how long the current process has been running
requests – How many requests have been processed by the current process
request duration – request duration (subtle)
request method – request method (GET, POST, …)
request URI – request URI
content length – request content length (only for POST)
user – user (PHP_AUTH_USER) (or ‘-’ if not set)
script – PHP script (or ‘-’ if not set)
last request cpu – Last request CPU usage.
last request memorythe - the memory used by the last request
7. Complete
php-fpm status page is very useful. When using zabbix or nagios monitoring, you can consider using xml or the default method. If you use the web, it is recommended to use html, the table will be clearer.
The above introduces the steps for phpfpm to use its own status optimization, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Many users will choose the Huawei brand when choosing smart watches. Among them, Huawei GT3pro and GT4 are very popular choices. Many users are curious about the difference between Huawei GT3pro and GT4. Let’s introduce the two to you. . What are the differences between Huawei GT3pro and GT4? 1. Appearance GT4: 46mm and 41mm, the material is glass mirror + stainless steel body + high-resolution fiber back shell. GT3pro: 46.6mm and 42.9mm, the material is sapphire glass + titanium body/ceramic body + ceramic back shell 2. Healthy GT4: Using the latest Huawei Truseen5.5+ algorithm, the results will be more accurate. GT3pro: Added ECG electrocardiogram and blood vessel and safety

As applications become more complex, handling and managing large amounts of data and processes is a challenge. In order to handle this situation, Laravel provides users with a very powerful tool, the Laravel Queue (Queue). It allows developers to run tasks like sending emails, generating PDFs, handling image cropping, etc. in the background without any impact on the user interface. In this article, we will take a deep dive into how to use Laravel queues. What is LaravelQueue queue

Why Snipping Tool Not Working on Windows 11 Understanding the root cause of the problem can help find the right solution. Here are the top reasons why the Snipping Tool might not be working properly: Focus Assistant is On: This prevents the Snipping Tool from opening. Corrupted application: If the snipping tool crashes on launch, it might be corrupted. Outdated graphics drivers: Incompatible drivers may interfere with the snipping tool. Interference from other applications: Other running applications may conflict with the Snipping Tool. Certificate has expired: An error during the upgrade process may cause this issu simple solution. These are suitable for most users and do not require any special technical knowledge. 1. Update Windows and Microsoft Store apps

Part 1: Initial Troubleshooting Steps Checking Apple’s System Status: Before delving into complex solutions, let’s start with the basics. The problem may not lie with your device; Apple's servers may be down. Visit Apple's System Status page to see if the AppStore is working properly. If there's a problem, all you can do is wait for Apple to fix it. Check your internet connection: Make sure you have a stable internet connection as the "Unable to connect to AppStore" issue can sometimes be attributed to a poor connection. Try switching between Wi-Fi and mobile data or resetting network settings (General > Reset > Reset Network Settings > Settings). Update your iOS version:

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

Security issues and solutions for JavaQueue queues in multi-threaded environments Introduction: In multi-threaded programming, shared resources in the program may face race conditions, which may lead to data inconsistency or errors. In Java, Queue is a commonly used data structure. When multiple threads operate the queue at the same time, there are security issues. This article will discuss the security issues of JavaQueue queues in multi-threaded environments, and introduce several solutions, focusing on explanations in the form of code examples. one

Usage of Queue in Java In Java, Queue (queue) is a commonly used data structure that follows the first-in, first-out (FIFO) principle. Queue can be used to implement message queues, task scheduling and other scenarios, and can well manage the arrangement and processing order of data. This article will introduce the usage of Queue and provide specific code examples. The definition and common methods of Queue are in Java. Queue is an interface in JavaCollectionsFramework

Watch4pro and gt each have different features and applicable scenarios. If you focus on comprehensive functions, high performance and stylish appearance, and are willing to bear a higher price, then Watch 4 Pro may be more suitable. If you don’t have high functional requirements and pay more attention to battery life and reasonable price, then the GT series may be more suitable. The final choice should be decided based on personal needs, budget and preferences. It is recommended to carefully consider your own needs before purchasing and refer to the reviews and comparisons of various products to make a more informed choice.
