찾다
백엔드 개발PHP 튜토리얼zabbix 监控 nginx 跟 php-fpm

zabbix 监控 nginx 和 php-fpm

监控常规的任务自然少不了 nginx 和 php-fpm 的监控,最近也是重新开始整理 zabbix,重新学习之,里面的脚本,配置文件以及模板都来源《zabbix 企业级分布式监控系统》一书,根据自身环境适当修改

一、监控 nginx server

1.1 配置 nginx 和 php-fpm

php-fpm 中 [www] 段中配置文件新增

<span style="height: 20px;" class="line">1</span><span style="height: 20px;" class="line">2</span>
<span style="height: 20px;" class="line">[www]</span><span style="height: 20px;" class="line">pm<span class="class">.status_path</span> = /fpm_status.php</span>

?

nginx 配置新增 server 段

<span style="height: 20px;" class="line">1</span><span style="height: 20px;" class="line">2</span>3456789101112131415161718
<span style="height: 20px;" class="line"><span style="color: #3e999f;" class="title">server</span> {</span><span style="height: 20px;" class="line">    <span style="color: #3e999f;" class="title">listen</span>  <span style="color: #f5871f;" class="number">127.0.0.1:80</span>;</span><span style="height: 20px;" class="line">    <span style="color: #3e999f;" class="title">allow</span> <span style="color: #f5871f;" class="number">127.0.0.1</span>;</span><span style="height: 20px;" class="line">    <span style="color: #3e999f;" class="title">deny</span> all;			<span style="color: #8e908c;" class="comment"># 这里两行控制权限</span></span><span style="height: 20px;" class="line">    <span style="color: #8e908c;" class="comment"># 开启 nginx 状态页</span></span><span style="height: 20px;" class="line">    <span style="color: #3e999f;" class="title">location</span> /nginxstatus {</span><span style="height: 20px;" class="line">        <span style="color: #3e999f;" class="title">stub_status</span> <span style="color: #f5871f;" class="built_in">on</span>;</span><span style="height: 20px;" class="line">        <span style="color: #3e999f;" class="title">access_log</span> <span style="color: #f5871f;" class="built_in">off</span>;</span><span style="height: 20px;" class="line">    }</span><span style="height: 20px;" class="line">	<span style="color: #8e908c;" class="comment"># 开启 php-fpm 状态页</span></span><span style="height: 20px;" class="line">    <span style="color: #3e999f;" class="title">location</span> <span style="color: #c82829;" class="regexp">~ ^/(fpm_status)</span> {</span><span style="height: 20px;" class="line">            <span style="color: #3e999f;" class="title">fastcgi_pass</span> <span style="color: #f5871f;" class="number">127.0.0.1:9000</span>;</span><span style="height: 20px;" class="line">            <span style="color: #3e999f;" class="title">fastcgi_index</span> index.php;</span><span style="height: 20px;" class="line">            <span style="color: #3e999f;" class="title">include</span> fastcgi.conf;</span><span style="height: 20px;" class="line">    }</span><span style="height: 20px;" class="line">}</span>

?

访问测试,确保可以查看状态信息

<span style="height: 20px;" class="line">1</span><span style="height: 20px;" class="line">2</span>
<span style="height: 20px;" class="line">curl <span style="color: #718c00;" class="string">http:</span><span style="color: #8e908c;" class="comment">//127.0.0.1/nginxstatus</span></span><span style="height: 20px;" class="line">curl <span style="color: #718c00;" class="string">http:</span><span style="color: #8e908c;" class="comment">//127.0.0.1/fpm_status.php</span></span>

1.2 配置检测脚本和 userparameter

我配置了 agent 主动发送数据到 server 的 active 模式

首先看目录结构

<span style="height: 20px;" class="line">1</span><span style="height: 20px;" class="line">2</span>3456789
<span style="height: 20px;" class="line"># tree /etc/zabbix/</span><span style="height: 20px;" class="line">/etc/zabbix/</span><span style="height: 20px;" class="line">├── scripts</span><span style="height: 20px;" class="line">│?? ├── check_nginx_status.<span style="color: #8959a8;" class="keyword">sh</span></span><span style="height: 20px;" class="line">│?? └── check_phpfpm.<span style="color: #8959a8;" class="keyword">sh</span></span><span style="height: 20px;" class="line">├── zabbix_agentd.<span style="color: #8959a8;" class="keyword">conf</span></span><span style="height: 20px;" class="line">└── zabbix_agentd.<span style="color: #f5871f;" class="literal">d</span></span><span style="height: 20px;" class="line">    ├── userparameter_nginx.<span style="color: #8959a8;" class="keyword">conf</span></span><span style="height: 20px;" class="line">    └── userparameter_phpfpm.<span style="color: #8959a8;" class="keyword">conf</span></span>

?

下面分别对应每个文件

  • userparameter_nginx.conf
<span style="height: 20px;" class="line">1</span><span style="height: 20px;" class="line">2</span>34567
<span style="height: 20px;" class="line">UserParameter=nginx<span class="class">.accepts</span>,/etc/zabbix/scripts/check_nginx_status<span class="class">.sh</span> accepts</span><span style="height: 20px;" class="line">UserParameter=nginx<span class="class">.handled</span>,/etc/zabbix/scripts/check_nginx_status<span class="class">.sh</span> handled</span><span style="height: 20px;" class="line">UserParameter=nginx<span class="class">.requests</span>,/etc/zabbix/scripts/check_nginx_status<span class="class">.sh</span> requests</span><span style="height: 20px;" class="line">UserParameter=nginx<span class="class">.connections</span><span class="class">.active</span>,/etc/zabbix/scripts/check_nginx_status<span class="class">.sh</span> active</span><span style="height: 20px;" class="line">UserParameter=nginx<span class="class">.connections</span><span class="class">.reading</span>,/etc/zabbix/scripts/check_nginx_status<span class="class">.sh</span> reading</span><span style="height: 20px;" class="line">UserParameter=nginx<span class="class">.connections</span><span class="class">.writing</span>,/etc/zabbix/scripts/check_nginx_status<span class="class">.sh</span> writing</span><span style="height: 20px;" class="line">UserParameter=nginx<span class="class">.connections</span><span class="class">.waiting</span>,/etc/zabbix/scripts/check_nginx_status<span class="class">.sh</span> waiting</span>
  • userparameter_phpfpm.conf
<span style="height: 20px;" class="line">1</span><span style="height: 20px;" class="line">2</span>3456789101112
<span style="height: 20px;" class="line">UserParameter=phpfpm<span class="class">.status</span><span class="class">.pool</span>,/etc/zabbix/scripts/check_phpfpm<span class="class">.sh</span> pool</span><span style="height: 20px;" class="line">UserParameter=phpfpm<span class="class">.status</span><span class="class">.process</span><span class="class">.manager</span>,/etc/zabbix/scripts/check_phpfpm<span class="class">.sh</span> process_manager</span><span style="height: 20px;" class="line">UserParameter=phpfpm<span class="class">.status</span><span class="class">.start</span><span class="class">.since</span>,/etc/zabbix/scripts/check_phpfpm<span class="class">.sh</span> start_since</span><span style="height: 20px;" class="line">UserParameter=phpfpm<span class="class">.status</span><span class="class">.accepted</span><span class="class">.conn</span>,/etc/zabbix/scripts/check_phpfpm<span class="class">.sh</span> accepted_conn</span><span style="height: 20px;" class="line">UserParameter=phpfpm<span class="class">.status</span><span class="class">.listen</span><span class="class">.queue</span>,/etc/zabbix/scripts/check_phpfpm<span class="class">.sh</span> listen_queue</span><span style="height: 20px;" class="line">UserParameter=phpfpm<span class="class">.status</span><span class="class">.max</span><span class="class">.listen</span><span class="class">.queue</span>,/etc/zabbix/scripts/check_phpfpm<span class="class">.sh</span> max_listen_queue</span><span style="height: 20px;" class="line">UserParameter=phpfpm<span class="class">.status</span><span class="class">.listen</span><span class="class">.queue</span><span class="class">.len</span>,/etc/zabbix/scripts/check_phpfpm<span class="class">.sh</span> listen_queue_len</span><span style="height: 20px;" class="line">UserParameter=phpfpm<span class="class">.status</span><span class="class">.idle</span><span class="class">.processes</span>,/etc/zabbix/scripts/check_phpfpm<span class="class">.sh</span> idle_processes</span><span style="height: 20px;" class="line">UserParameter=phpfpm<span class="class">.status</span><span class="class">.active</span><span class="class">.processes</span>,/etc/zabbix/scripts/check_phpfpm<span class="class">.sh</span> active_processes</span><span style="height: 20px;" class="line">UserParameter=phpfpm<span class="class">.status</span><span class="class">.total</span><span class="class">.processes</span>,/etc/zabbix/scripts/check_phpfpm<span class="class">.sh</span> total_processes</span><span style="height: 20px;" class="line">UserParameter=phpfpm<span class="class">.status</span><span class="class">.max</span><span class="class">.active</span><span class="class">.processes</span>,/etc/zabbix/scripts/check_phpfpm<span class="class">.sh</span> max_active_processes</span><span style="height: 20px;" class="line">UserParameter=phpfpm<span class="class">.status</span><span class="class">.max</span><span class="class">.children</span><span class="class">.reached</span>,/etc/zabbix/scripts/check_phpfpm<span class="class">.sh</span> max_children_reached</span>
  • check_nginx_status.sh
<span style="height: 20px;" class="line">1</span><span style="height: 20px;" class="line">2</span>3456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
<span style="height: 20px;" class="line"><span class="shebang">#!/bin/bash</span></span><span style="height: 20px;" class="line"><span style="color: #f5871f;" class="built_in">source</span> /etc/bashrc >/dev/null <span style="color: #f5871f;" class="number">2</span>>&<span style="color: #f5871f;" class="number">1</span></span><span style="height: 20px;" class="line"><span style="color: #f5871f;" class="built_in">source</span> /etc/profile  >/dev/null <span style="color: #f5871f;" class="number">2</span>>&<span style="color: #f5871f;" class="number">1</span></span><span style="height: 20px;" class="line">nginxstatus=http://<span style="color: #f5871f;" class="number">127.0</span>.<span style="color: #f5871f;" class="number">0.1</span>/nginxstatus</span><span style="height: 20px;" class="line"><span style="color: #8e908c;" class="comment"># Functions to return nginx stats</span></span><span style="height: 20px;" class="line"><span style="color: #8959a8;" class="keyword">function</span> checkavailable {</span><span style="height: 20px;" class="line">    code=$(curl -o /dev/null <span class="operator">-s</span> -w %{http_code} <span style="color: #c82829;" class="variable">${nginxstatus}</span>)</span><span style="height: 20px;" class="line">    <span style="color: #8959a8;" class="keyword">if</span> [ <span style="color: #718c00;" class="string">"<span style="color: #c82829;" class="variable">${code}</span>"</span> == <span style="color: #718c00;" class="string">"200"</span> ]</span><span style="height: 20px;" class="line">    <span style="color: #8959a8;" class="keyword">then</span></span><span style="height: 20px;" class="line">        <span style="color: #f5871f;" class="built_in">return</span> <span style="color: #f5871f;" class="number">1</span></span><span style="height: 20px;" class="line">    <span style="color: #8959a8;" class="keyword">else</span></span><span style="height: 20px;" class="line">        <span style="color: #f5871f;" class="built_in">echo</span>  <span style="color: #f5871f;" class="number">0</span></span><span style="height: 20px;" class="line">    <span style="color: #8959a8;" class="keyword">fi</span></span><span style="height: 20px;" class="line">}</span><span style="height: 20px;" class="line"><span style="color: #8959a8;" class="keyword">function</span> active {</span><span style="height: 20px;" class="line">    checkavailable|| curl <span class="operator">-s</span> <span style="color: #718c00;" class="string">"<span style="color: #c82829;" class="variable">${nginxstatus}</span>"</span> | grep <span style="color: #718c00;" class="string">'Active'</span> | awk <span style="color: #718c00;" class="string">'{print $3}'</span></span><span style="height: 20px;" class="line">}</span><span style="height: 20px;" class="line"><span style="color: #8959a8;" class="keyword">function</span> reading {</span><span style="height: 20px;" class="line">    checkavailable|| curl <span class="operator">-s</span> <span style="color: #718c00;" class="string">"<span style="color: #c82829;" class="variable">${nginxstatus}</span>"</span> | grep <span style="color: #718c00;" class="string">'Reading'</span> | awk <span style="color: #718c00;" class="string">'{print $2}'</span></span><span style="height: 20px;" class="line">}</span><span style="height: 20px;" class="line"><span style="color: #8959a8;" class="keyword">function</span> writing {</span><span style="height: 20px;" class="line">    checkavailable|| curl <span class="operator">-s</span> <span style="color: #718c00;" class="string">"<span style="color: #c82829;" class="variable">${nginxstatus}</span>"</span> | grep <span style="color: #718c00;" class="string">'Writing'</span> | awk <span style="color: #718c00;" class="string">'{print $4}'</span></span><span style="height: 20px;" class="line">}</span><span style="height: 20px;" class="line"><span style="color: #8959a8;" class="keyword">function</span> waiting {</span><span style="height: 20px;" class="line">    checkavailable|| curl <span class="operator">-s</span> <span style="color: #718c00;" class="string">"<span style="color: #c82829;" class="variable">${nginxstatus}</span>"</span> | grep <span style="color: #718c00;" class="string">'Waiting'</span> | awk <span style="color: #718c00;" class="string">'{print $6}'</span></span><span style="height: 20px;" class="line">}</span><span style="height: 20px;" class="line"><span style="color: #8959a8;" class="keyword">function</span> accepts {</span><span style="height: 20px;" class="line">    checkavailable|| curl <span class="operator">-s</span> <span style="color: #718c00;" class="string">"<span style="color: #c82829;" class="variable">${nginxstatus}</span>"</span> | awk NR==<span style="color: #f5871f;" class="number">3</span> | awk <span style="color: #718c00;" class="string">'{print $1}'</span></span><span style="height: 20px;" class="line">}</span><span style="height: 20px;" class="line"><span style="color: #8959a8;" class="keyword">function</span> handled {</span><span style="height: 20px;" class="line">    checkavailable|| curl <span class="operator">-s</span> <span style="color: #718c00;" class="string">"<span style="color: #c82829;" class="variable">${nginxstatus}</span>"</span> | awk NR==<span style="color: #f5871f;" class="number">3</span> | awk <span style="color: #718c00;" class="string">'{print $2}'</span></span><span style="height: 20px;" class="line">}</span><span style="height: 20px;" class="line"><span style="color: #8959a8;" class="keyword">function</span> requests {</span><span style="height: 20px;" class="line">    checkavailable|| curl <span class="operator">-s</span> <span style="color: #718c00;" class="string">"<span style="color: #c82829;" class="variable">${nginxstatus}</span>"</span> | awk NR==<span style="color: #f5871f;" class="number">3</span> | awk <span style="color: #718c00;" class="string">'{print $3}'</span></span><span style="height: 20px;" class="line">}</span><span style="height: 20px;" class="line"><span style="color: #8959a8;" class="keyword">case</span> <span style="color: #718c00;" class="string">"<span style="color: #c82829;" class="variable">$1</span>"</span> <span style="color: #8959a8;" class="keyword">in</span></span><span style="height: 20px;" class="line">    active)</span><span style="height: 20px;" class="line">        active</span><span style="height: 20px;" class="line">        ;;</span><span style="height: 20px;" class="line">    reading)</span><span style="height: 20px;" class="line">        reading</span><span style="height: 20px;" class="line">        ;;</span><span style="height: 20px;" class="line">    writing)</span><span style="height: 20px;" class="line">        writing</span><span style="height: 20px;" class="line">        ;;</span><span style="height: 20px;" class="line">    waiting)</span><span style="height: 20px;" class="line">        waiting</span><span style="height: 20px;" class="line">        ;;</span><span style="height: 20px;" class="line">    accepts)</span><span style="height: 20px;" class="line">        accepts</span><span style="height: 20px;" class="line">        ;;</span><span style="height: 20px;" class="line">    handled)</span><span style="height: 20px;" class="line">        handled</span><span style="height: 20px;" class="line">        ;;</span><span style="height: 20px;" class="line">    requests)</span><span style="height: 20px;" class="line">        requests</span><span style="height: 20px;" class="line">        ;;</span><span style="height: 20px;" class="line">    *)</span><span style="height: 20px;" class="line">        <span style="color: #f5871f;" class="built_in">echo</span> <span style="color: #718c00;" class="string">"Usage: <span style="color: #c82829;" class="variable">$0</span> {active |reading |writing |waiting |accepts |handled |requests }"</span></span><span style="height: 20px;" class="line"><span style="color: #8959a8;" class="keyword">esac</span></span>
  • check_phpfpm.sh
<span style="height: 20px;" class="line">1</span><span style="height: 20px;" class="line">2</span>3456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
<span style="height: 20px;" class="line"><span class="shebang">#!/bin/bash</span></span><span style="height: 20px;" class="line"><span style="color: #f5871f;" class="built_in">source</span> /etc/bashrc >/dev/null <span style="color: #f5871f;" class="number">2</span>>&<span style="color: #f5871f;" class="number">1</span></span><span style="height: 20px;" class="line"><span style="color: #f5871f;" class="built_in">source</span> /etc/profile  >/dev/null <span style="color: #f5871f;" class="number">2</span>>&<span style="color: #f5871f;" class="number">1</span></span><span style="height: 20px;" class="line">LOG_FILE=/var/<span style="color: #f5871f;" class="built_in">log</span>/zabbix/phpfpmstatus.log</span><span style="height: 20px;" class="line">curl http://<span style="color: #f5871f;" class="number">127.0</span>.<span style="color: #f5871f;" class="number">0.1</span>/fpm_status.php ><span style="color: #c82829;" class="variable">${LOG_FILE}</span> <span style="color: #f5871f;" class="number">2</span>>&<span style="color: #f5871f;" class="number">1</span></span><span style="height: 20px;" class="line"><span style="color: #4271ae;" class="function"><span style="color: #3e999f;" class="title">pool</span></span>(){</span><span style="height: 20px;" class="line">     awk <span style="color: #718c00;" class="string">'/pool/ {print $NF}'</span> <span style="color: #c82829;" class="variable">${LOG_FILE}</span></span><span style="height: 20px;" class="line">}</span><span style="height: 20px;" class="line"><span style="color: #4271ae;" class="function"><span style="color: #3e999f;" class="title">process_manager</span></span>() {</span><span style="height: 20px;" class="line">     awk <span style="color: #718c00;" class="string">'/process manager/ {print $NF}'</span> <span style="color: #c82829;" class="variable">${LOG_FILE}</span></span><span style="height: 20px;" class="line">}</span><span style="height: 20px;" class="line"><span style="color: #4271ae;" class="function"><span style="color: #3e999f;" class="title">start_since</span></span>(){</span><span style="height: 20px;" class="line">    awk <span style="color: #718c00;" class="string">'/^start since:/ {print $NF}'</span> <span style="color: #c82829;" class="variable">${LOG_FILE}</span></span><span style="height: 20px;" class="line">}</span><span style="height: 20px;" class="line"><span style="color: #4271ae;" class="function"><span style="color: #3e999f;" class="title">accepted_conn</span></span>(){</span><span style="height: 20px;" class="line">    awk <span style="color: #718c00;" class="string">'/^accepted conn:/ {print $NF}'</span> <span style="color: #c82829;" class="variable">${LOG_FILE}</span></span><span style="height: 20px;" class="line">}</span><span style="height: 20px;" class="line"><span style="color: #4271ae;" class="function"><span style="color: #3e999f;" class="title">listen_queue</span></span>(){</span><span style="height: 20px;" class="line">    awk <span style="color: #718c00;" class="string">'/^listen queue:/ {print $NF}'</span> <span style="color: #c82829;" class="variable">${LOG_FILE}</span></span><span style="height: 20px;" class="line">}</span><span style="height: 20px;" class="line"><span style="color: #4271ae;" class="function"><span style="color: #3e999f;" class="title">max_listen_queue</span></span>(){</span><span style="height: 20px;" class="line">    awk <span style="color: #718c00;" class="string">'/^max listen queue:/ {print $NF}'</span> <span style="color: #c82829;" class="variable">${LOG_FILE}</span></span><span style="height: 20px;" class="line">}</span><span style="height: 20px;" class="line"><span style="color: #4271ae;" class="function"><span style="color: #3e999f;" class="title">listen_queue_len</span></span>(){</span><span style="height: 20px;" class="line">    awk <span style="color: #718c00;" class="string">'/^listen queue len:/ {print $NF}'</span> <span style="color: #c82829;" class="variable">${LOG_FILE}</span></span><span style="height: 20px;" class="line">}</span><span style="height: 20px;" class="line"><span style="color: #4271ae;" class="function"><span style="color: #3e999f;" class="title">idle_processes</span></span>(){</span><span style="height: 20px;" class="line">    awk <span style="color: #718c00;" class="string">'/^idle processes:/ {print $NF}'</span> <span style="color: #c82829;" class="variable">${LOG_FILE}</span></span><span style="height: 20px;" class="line">}</span><span style="height: 20px;" class="line"><span style="color: #4271ae;" class="function"><span style="color: #3e999f;" class="title">active_processes</span></span>(){</span><span style="height: 20px;" class="line">    awk <span style="color: #718c00;" class="string">'/^active processes:/ {print $NF}'</span> <span style="color: #c82829;" class="variable">${LOG_FILE}</span></span><span style="height: 20px;" class="line">}</span><span style="height: 20px;" class="line"><span style="color: #4271ae;" class="function"><span style="color: #3e999f;" class="title">total_processes</span></span>(){</span><span style="height: 20px;" class="line">    awk <span style="color: #718c00;" class="string">'/^total processes:/ {print $NF}'</span> <span style="color: #c82829;" class="variable">${LOG_FILE}</span></span><span style="height: 20px;" class="line">}</span><span style="height: 20px;" class="line"><span style="color: #4271ae;" class="function"><span style="color: #3e999f;" class="title">max_active_processes</span></span>(){</span><span style="height: 20px;" class="line">    awk <span style="color: #718c00;" class="string">'/^max active processes:/ {print $NF}'</span> <span style="color: #c82829;" class="variable">${LOG_FILE}</span></span><span style="height: 20px;" class="line">}</span><span style="height: 20px;" class="line"><span style="color: #4271ae;" class="function"><span style="color: #3e999f;" class="title">max_children_reached</span></span>(){</span><span style="height: 20px;" class="line">    awk <span style="color: #718c00;" class="string">'/^max children reached:/ {print $NF}'</span> <span style="color: #c82829;" class="variable">${LOG_FILE}</span></span><span style="height: 20px;" class="line">}</span><span style="height: 20px;" class="line"><span style="color: #8959a8;" class="keyword">case</span> <span style="color: #718c00;" class="string">"<span style="color: #c82829;" class="variable">$1</span>"</span> <span style="color: #8959a8;" class="keyword">in</span></span><span style="height: 20px;" class="line">pool)</span><span style="height: 20px;" class="line">    pool</span><span style="height: 20px;" class="line">    ;;</span><span style="height: 20px;" class="line">process_manager)</span><span style="height: 20px;" class="line">    process_manager</span><span style="height: 20px;" class="line">    ;;</span><span style="height: 20px;" class="line">start_since)</span><span style="height: 20px;" class="line">    start_since</span><span style="height: 20px;" class="line">    ;;</span><span style="height: 20px;" class="line">accepted_conn)</span><span style="height: 20px;" class="line">    accepted_conn</span><span style="height: 20px;" class="line">    ;;</span><span style="height: 20px;" class="line">listen_queue)</span><span style="height: 20px;" class="line">    listen_queue</span><span style="height: 20px;" class="line">    ;;</span><span style="height: 20px;" class="line">max_listen_queue)</span><span style="height: 20px;" class="line">    max_listen_queue</span><span style="height: 20px;" class="line">    ;;</span><span style="height: 20px;" class="line">listen_queue_len)</span><span style="height: 20px;" class="line">    listen_queue_len</span><span style="height: 20px;" class="line">    ;;</span><span style="height: 20px;" class="line">idle_processes)</span><span style="height: 20px;" class="line">    idle_processes</span><span style="height: 20px;" class="line">    ;;</span><span style="height: 20px;" class="line">active_processes)</span><span style="height: 20px;" class="line">    active_processes</span><span style="height: 20px;" class="line">    ;;</span><span style="height: 20px;" class="line">total_processes)</span><span style="height: 20px;" class="line">    total_processes</span><span style="height: 20px;" class="line">    ;;</span><span style="height: 20px;" class="line">max_active_processes)</span><span style="height: 20px;" class="line">    max_active_processes</span><span style="height: 20px;" class="line">    ;;</span><span style="height: 20px;" class="line">max_children_reached)</span><span style="height: 20px;" class="line">    max_children_reached</span><span style="height: 20px;" class="line">    ;;</span><span style="height: 20px;" class="line">*)</span><span style="height: 20px;" class="line">    <span style="color: #f5871f;" class="built_in">echo</span> <span style="color: #718c00;" class="string">"Usage: <span style="color: #c82829;" class="variable">$0</span> {pool|process_manager|start_since|accepted_conn|listen_queue|max_listen_queue|listen_queue_len|idle_processes|active_processes|total_processes|max_active_processes|max_children_reached}"</span></span><span style="height: 20px;" class="line"><span style="color: #8959a8;" class="keyword">esac</span></span>

以上全部配置完成之后重启 agent 即可

1.3 添加模板,调用

松爷的书里提供了大量的模板,如果不想自己重写生成模板,直接拿着这个模板进行根据自身的环境修改即可

  • nginx 的模板
  • php-fpm 的模板

最后呈现出来的效果如下图(zatree中)
zabbix-nginx-phpfpm.jpg

성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
zabbix怎么监控redis内存zabbix怎么监控redis内存Jun 03, 2023 am 10:00 AM

1、导入模板直接下载,通过下面的步骤导入模板:点击configuration->templates>import->导入下载的xml文件。2、客户端key配置在被监控的主机上,打开/etc/zabbix/zabbix_agentd.conf配置文件,在最后一行加入:UserParameter=redis_stats[*],redis-cli-h127.0.0.1-p$1info|grep$2|cut-d:-f2配置完成后通过/etc/init.d/zabbix_agentdre

内存飙升!记一次nginx拦截爬虫内存飙升!记一次nginx拦截爬虫Mar 30, 2023 pm 04:35 PM

本篇文章给大家带来了关于nginx的相关知识,其中主要介绍了nginx拦截爬虫相关的,感兴趣的朋友下面一起来看一下吧,希望对大家有帮助。

nginx限流模块源码分析nginx限流模块源码分析May 11, 2023 pm 06:16 PM

高并发系统有三把利器:缓存、降级和限流;限流的目的是通过对并发访问/请求进行限速来保护系统,一旦达到限制速率则可以拒绝服务(定向到错误页)、排队等待(秒杀)、降级(返回兜底数据或默认数据);高并发系统常见的限流有:限制总并发数(数据库连接池)、限制瞬时并发数(如nginx的limit_conn模块,用来限制瞬时并发连接数)、限制时间窗口内的平均速率(nginx的limit_req模块,用来限制每秒的平均速率);另外还可以根据网络连接数、网络流量、cpu或内存负载等来限流。1.限流算法最简单粗暴的

nginx+rsync+inotify怎么配置实现负载均衡nginx+rsync+inotify怎么配置实现负载均衡May 11, 2023 pm 03:37 PM

实验环境前端nginx:ip192.168.6.242,对后端的wordpress网站做反向代理实现复杂均衡后端nginx:ip192.168.6.36,192.168.6.205都部署wordpress,并使用相同的数据库1、在后端的两个wordpress上配置rsync+inotify,两服务器都开启rsync服务,并且通过inotify分别向对方同步数据下面配置192.168.6.205这台服务器vim/etc/rsyncd.confuid=nginxgid=nginxport=873ho

nginx php403错误怎么解决nginx php403错误怎么解决Nov 23, 2022 am 09:59 AM

nginx php403错误的解决办法:1、修改文件权限或开启selinux;2、修改php-fpm.conf,加入需要的文件扩展名;3、修改php.ini内容为“cgi.fix_pathinfo = 0”;4、重启php-fpm即可。

如何解决跨域?常见解决方案浅析如何解决跨域?常见解决方案浅析Apr 25, 2023 pm 07:57 PM

跨域是开发中经常会遇到的一个场景,也是面试中经常会讨论的一个问题。掌握常见的跨域解决方案及其背后的原理,不仅可以提高我们的开发效率,还能在面试中表现的更加

nginx部署react刷新404怎么办nginx部署react刷新404怎么办Jan 03, 2023 pm 01:41 PM

nginx部署react刷新404的解决办法:1、修改Nginx配置为“server {listen 80;server_name https://www.xxx.com;location / {root xxx;index index.html index.htm;...}”;2、刷新路由,按当前路径去nginx加载页面即可。

nginx怎么禁止访问phpnginx怎么禁止访问phpNov 22, 2022 am 09:52 AM

nginx禁止访问php的方法:1、配置nginx,禁止解析指定目录下的指定程序;2、将“location ~^/images/.*\.(php|php5|sh|pl|py)${deny all...}”语句放置在server标签内即可。

See all articles

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

AI Hentai를 무료로 생성하십시오.

뜨거운 도구

Dreamweaver Mac版

Dreamweaver Mac版

시각적 웹 개발 도구

mPDF

mPDF

mPDF는 UTF-8로 인코딩된 HTML에서 PDF 파일을 생성할 수 있는 PHP 라이브러리입니다. 원저자인 Ian Back은 자신의 웹 사이트에서 "즉시" PDF 파일을 출력하고 다양한 언어를 처리하기 위해 mPDF를 작성했습니다. HTML2FPDF와 같은 원본 스크립트보다 유니코드 글꼴을 사용할 때 속도가 느리고 더 큰 파일을 생성하지만 CSS 스타일 등을 지원하고 많은 개선 사항이 있습니다. RTL(아랍어, 히브리어), CJK(중국어, 일본어, 한국어)를 포함한 거의 모든 언어를 지원합니다. 중첩된 블록 수준 요소(예: P, DIV)를 지원합니다.

PhpStorm 맥 버전

PhpStorm 맥 버전

최신(2018.2.1) 전문 PHP 통합 개발 도구

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

MinGW - Windows용 미니멀리스트 GNU

MinGW - Windows용 미니멀리스트 GNU

이 프로젝트는 osdn.net/projects/mingw로 마이그레이션되는 중입니다. 계속해서 그곳에서 우리를 팔로우할 수 있습니다. MinGW: GCC(GNU Compiler Collection)의 기본 Windows 포트로, 기본 Windows 애플리케이션을 구축하기 위한 무료 배포 가능 가져오기 라이브러리 및 헤더 파일로 C99 기능을 지원하는 MSVC 런타임에 대한 확장이 포함되어 있습니다. 모든 MinGW 소프트웨어는 64비트 Windows 플랫폼에서 실행될 수 있습니다.