Inhaltsverzeichnis
一、监控 nginx server
1.1 配置 nginx 和 php-fpm
1.2 配置检测脚本和 userparameter
1.3 添加模板,调用
Heim Backend-Entwicklung 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>
Nach dem Login kopieren
Nach dem Login kopieren
<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>
Nach dem Login kopieren

?

nginx 配置新增 server 段

<span style="height: 20px;" class="line">1</span><span style="height: 20px;" class="line">2</span>3456789101112131415161718
Nach dem Login kopieren
<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>
Nach dem Login kopieren

?

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

<span style="height: 20px;" class="line">1</span><span style="height: 20px;" class="line">2</span>
Nach dem Login kopieren
Nach dem Login kopieren
<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>
Nach dem Login kopieren

1.2 配置检测脚本和 userparameter

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

首先看目录结构

<span style="height: 20px;" class="line">1</span><span style="height: 20px;" class="line">2</span>3456789
Nach dem Login kopieren
<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>
Nach dem Login kopieren

?

下面分别对应每个文件

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

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

1.3 添加模板,调用

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

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

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

Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn

Heiße KI -Werkzeuge

Undresser.AI Undress

Undresser.AI Undress

KI-gestützte App zum Erstellen realistischer Aktfotos

AI Clothes Remover

AI Clothes Remover

Online-KI-Tool zum Entfernen von Kleidung aus Fotos.

Undress AI Tool

Undress AI Tool

Ausziehbilder kostenlos

Clothoff.io

Clothoff.io

KI-Kleiderentferner

AI Hentai Generator

AI Hentai Generator

Erstellen Sie kostenlos Ai Hentai.

Heißer Artikel

R.E.P.O. Energiekristalle erklärten und was sie tun (gelber Kristall)
3 Wochen vor By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Beste grafische Einstellungen
3 Wochen vor By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. So reparieren Sie Audio, wenn Sie niemanden hören können
3 Wochen vor By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: Wie man alles in Myrise freischaltet
3 Wochen vor By 尊渡假赌尊渡假赌尊渡假赌

Heiße Werkzeuge

Notepad++7.3.1

Notepad++7.3.1

Einfach zu bedienender und kostenloser Code-Editor

SublimeText3 chinesische Version

SublimeText3 chinesische Version

Chinesische Version, sehr einfach zu bedienen

Senden Sie Studio 13.0.1

Senden Sie Studio 13.0.1

Leistungsstarke integrierte PHP-Entwicklungsumgebung

Dreamweaver CS6

Dreamweaver CS6

Visuelle Webentwicklungstools

SublimeText3 Mac-Version

SublimeText3 Mac-Version

Codebearbeitungssoftware auf Gottesniveau (SublimeText3)

So erlauben Sie den externen Netzwerkzugriff auf den Tomcat-Server So erlauben Sie den externen Netzwerkzugriff auf den Tomcat-Server Apr 21, 2024 am 07:22 AM

Um dem Tomcat-Server den Zugriff auf das externe Netzwerk zu ermöglichen, müssen Sie Folgendes tun: Ändern Sie die Tomcat-Konfigurationsdatei, um externe Verbindungen zuzulassen. Fügen Sie eine Firewallregel hinzu, um den Zugriff auf den Tomcat-Server-Port zu ermöglichen. Erstellen Sie einen DNS-Eintrag, der den Domänennamen auf die öffentliche IP des Tomcat-Servers verweist. Optional: Verwenden Sie einen Reverse-Proxy, um Sicherheit und Leistung zu verbessern. Optional: Richten Sie HTTPS für mehr Sicherheit ein.

So führen Sie thinkphp aus So führen Sie thinkphp aus Apr 09, 2024 pm 05:39 PM

Schritte zum lokalen Ausführen von ThinkPHP Framework: Laden Sie ThinkPHP Framework herunter und entpacken Sie es in ein lokales Verzeichnis. Erstellen Sie einen virtuellen Host (optional), der auf das ThinkPHP-Stammverzeichnis verweist. Konfigurieren Sie Datenbankverbindungsparameter. Starten Sie den Webserver. Initialisieren Sie die ThinkPHP-Anwendung. Greifen Sie auf die URL der ThinkPHP-Anwendung zu und führen Sie sie aus.

Willkommen bei Nginx! Wie kann ich es lösen? Willkommen bei Nginx! Wie kann ich es lösen? Apr 17, 2024 am 05:12 AM

Um den Fehler „Willkommen bei Nginx!“ zu beheben, müssen Sie die Konfiguration des virtuellen Hosts überprüfen, den virtuellen Host aktivieren, Nginx neu laden. Wenn die Konfigurationsdatei des virtuellen Hosts nicht gefunden werden kann, erstellen Sie eine Standardseite und laden Sie Nginx neu. Anschließend wird die Fehlermeldung angezeigt verschwindet und die Website wird normal angezeigt.

So generieren Sie eine URL aus einer HTML-Datei So generieren Sie eine URL aus einer HTML-Datei Apr 21, 2024 pm 12:57 PM

Für die Konvertierung einer HTML-Datei in eine URL ist ein Webserver erforderlich. Dazu sind die folgenden Schritte erforderlich: Besorgen Sie sich einen Webserver. Richten Sie einen Webserver ein. Laden Sie eine HTML-Datei hoch. Erstellen Sie einen Domainnamen. Leiten Sie die Anfrage weiter.

So stellen Sie das NodeJS-Projekt auf dem Server bereit So stellen Sie das NodeJS-Projekt auf dem Server bereit Apr 21, 2024 am 04:40 AM

Serverbereitstellungsschritte für ein Node.js-Projekt: Bereiten Sie die Bereitstellungsumgebung vor: Erhalten Sie Serverzugriff, installieren Sie Node.js, richten Sie ein Git-Repository ein. Erstellen Sie die Anwendung: Verwenden Sie npm run build, um bereitstellbaren Code und Abhängigkeiten zu generieren. Code auf den Server hochladen: über Git oder File Transfer Protocol. Abhängigkeiten installieren: Stellen Sie eine SSH-Verbindung zum Server her und installieren Sie Anwendungsabhängigkeiten mit npm install. Starten Sie die Anwendung: Verwenden Sie einen Befehl wie node index.js, um die Anwendung zu starten, oder verwenden Sie einen Prozessmanager wie pm2. Konfigurieren Sie einen Reverse-Proxy (optional): Verwenden Sie einen Reverse-Proxy wie Nginx oder Apache, um den Datenverkehr an Ihre Anwendung weiterzuleiten

Was sind die häufigsten Anweisungen in einer Docker-Datei? Was sind die häufigsten Anweisungen in einer Docker-Datei? Apr 07, 2024 pm 07:21 PM

Die am häufigsten verwendeten Anweisungen in Dockerfile sind: FROM: Neues Image erstellen oder neues Image ableiten RUN: Befehle ausführen (Software installieren, System konfigurieren) COPY: Lokale Dateien in das Image kopieren ADD: Ähnlich wie COPY kann es automatisch dekomprimiert werden tar-Archive oder URL-Dateien abrufen CMD: Geben Sie den Befehl an, wenn der Container gestartet wird. EXPOSE: Deklarieren Sie den Container-Überwachungsport (aber nicht öffentlich). ENV: Legen Sie die Umgebungsvariable fest. VOLUME: Mounten Sie das Hostverzeichnis oder das anonyme Volume. WORKDIR: Legen Sie das Arbeitsverzeichnis im fest Container ENTRYPOINT: Geben Sie an, was beim Start des Containers ausgeführt werden soll. Ausführbare Datei (ähnlich wie CMD, kann aber nicht überschrieben werden)

Kann von außen auf Nodejs zugegriffen werden? Kann von außen auf Nodejs zugegriffen werden? Apr 21, 2024 am 04:43 AM

Ja, auf Node.js kann von außen zugegriffen werden. Sie können die folgenden Methoden verwenden: Verwenden Sie Cloud Functions, um die Funktion bereitzustellen und öffentlich zugänglich zu machen. Verwenden Sie das Express-Framework, um Routen zu erstellen und Endpunkte zu definieren. Verwenden Sie Nginx, um Proxy-Anfragen an Node.js-Anwendungen umzukehren. Verwenden Sie Docker-Container, um Node.js-Anwendungen auszuführen und sie über Port-Mapping verfügbar zu machen.

So stellen Sie eine Website mit PHP bereit und pflegen sie So stellen Sie eine Website mit PHP bereit und pflegen sie May 03, 2024 am 08:54 AM

Um eine PHP-Website erfolgreich bereitzustellen und zu warten, müssen Sie die folgenden Schritte ausführen: Wählen Sie einen Webserver (z. B. Apache oder Nginx). Installieren Sie PHP. Erstellen Sie eine Datenbank und verbinden Sie PHP. Laden Sie Code auf den Server hoch. Richten Sie den Domänennamen und die DNS-Überwachung der Website-Wartung ein Zu den Schritten gehören die Aktualisierung von PHP und Webservern sowie die Sicherung der Website, die Überwachung von Fehlerprotokollen und die Aktualisierung von Inhalten.

See all articles