Table of Contents
一、监控 nginx server
1.1 配置 nginx 和 php-fpm
1.2 配置检测脚本和 userparameter
1.3 添加模板,调用
Home Backend Development PHP Tutorial zabbix 监控 nginx 跟 php-fpm

zabbix 监控 nginx 跟 php-fpm

Jun 13, 2016 pm 12:27 PM
nginx zabbix

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>
Copy after login
Copy after login
<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>
Copy after login

?

nginx 配置新增 server 段

<span style="height: 20px;" class="line">1</span><span style="height: 20px;" class="line">2</span>3456789101112131415161718
Copy after login
<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>
Copy after login

?

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

<span style="height: 20px;" class="line">1</span><span style="height: 20px;" class="line">2</span>
Copy after login
Copy after login
<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>
Copy after login

1.2 配置检测脚本和 userparameter

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

首先看目录结构

<span style="height: 20px;" class="line">1</span><span style="height: 20px;" class="line">2</span>3456789
Copy after login
<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>
Copy after login

?

下面分别对应每个文件

  • userparameter_nginx.conf
<span style="height: 20px;" class="line">1</span><span style="height: 20px;" class="line">2</span>34567
Copy after login
<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>
Copy after login
  • userparameter_phpfpm.conf
<span style="height: 20px;" class="line">1</span><span style="height: 20px;" class="line">2</span>3456789101112
Copy after login
<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>
Copy after login
  • check_nginx_status.sh
<span style="height: 20px;" class="line">1</span><span style="height: 20px;" class="line">2</span>3456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
Copy after login
<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>
Copy after login
  • check_phpfpm.sh
<span style="height: 20px;" class="line">1</span><span style="height: 20px;" class="line">2</span>3456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
Copy after login
<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>
Copy after login

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

1.3 添加模板,调用

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

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

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

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to allow external network access to tomcat server How to allow external network access to tomcat server Apr 21, 2024 am 07:22 AM

To allow the Tomcat server to access the external network, you need to: modify the Tomcat configuration file to allow external connections. Add a firewall rule to allow access to the Tomcat server port. Create a DNS record pointing the domain name to the Tomcat server public IP. Optional: Use a reverse proxy to improve security and performance. Optional: Set up HTTPS for increased security.

How to run thinkphp How to run thinkphp Apr 09, 2024 pm 05:39 PM

Steps to run ThinkPHP Framework locally: Download and unzip ThinkPHP Framework to a local directory. Create a virtual host (optional) pointing to the ThinkPHP root directory. Configure database connection parameters. Start the web server. Initialize the ThinkPHP application. Access the ThinkPHP application URL and run it.

Welcome to nginx!How to solve it? Welcome to nginx!How to solve it? Apr 17, 2024 am 05:12 AM

To solve the "Welcome to nginx!" error, you need to check the virtual host configuration, enable the virtual host, reload Nginx, if the virtual host configuration file cannot be found, create a default page and reload Nginx, then the error message will disappear and the website will be normal show.

How to communicate between docker containers How to communicate between docker containers Apr 07, 2024 pm 06:24 PM

There are five methods for container communication in the Docker environment: shared network, Docker Compose, network proxy, shared volume, and message queue. Depending on your isolation and security needs, choose the most appropriate communication method, such as leveraging Docker Compose to simplify connections or using a network proxy to increase isolation.

How to register phpmyadmin How to register phpmyadmin Apr 07, 2024 pm 02:45 PM

To register for phpMyAdmin, you need to first create a MySQL user and grant permissions to it, then download, install and configure phpMyAdmin, and finally log in to phpMyAdmin to manage the database.

How to deploy nodejs project to server How to deploy nodejs project to server Apr 21, 2024 am 04:40 AM

Server deployment steps for a Node.js project: Prepare the deployment environment: obtain server access, install Node.js, set up a Git repository. Build the application: Use npm run build to generate deployable code and dependencies. Upload code to the server: via Git or File Transfer Protocol. Install dependencies: SSH into the server and use npm install to install application dependencies. Start the application: Use a command such as node index.js to start the application, or use a process manager such as pm2. Configure a reverse proxy (optional): Use a reverse proxy such as Nginx or Apache to route traffic to your application

How to generate URL from html file How to generate URL from html file Apr 21, 2024 pm 12:57 PM

Converting an HTML file to a URL requires a web server, which involves the following steps: Obtain a web server. Set up a web server. Upload HTML file. Create a domain name. Route the request.

What to do if the installation of phpmyadmin fails What to do if the installation of phpmyadmin fails Apr 07, 2024 pm 03:15 PM

Troubleshooting steps for failed phpMyAdmin installation: Check system requirements (PHP version, MySQL version, web server); enable PHP extensions (mysqli, pdo_mysql, mbstring, token_get_all); check configuration file settings (host, port, username, password); Check file permissions (directory ownership, file permissions); check firewall settings (whitelist web server ports); view error logs (/var/log/apache2/error.log or /var/log/nginx/error.log); seek Technical support (phpMyAdmin

See all articles