菜鸟之家

菜鸟除了菜还是菜,总之一菜到底.

服务器监控之zabbix监控Nginx篇

最近一直在做服务器端性能优化的事, 而监控是性能优化的首要条件.下面是用zabbix监控Nginx安装的过程:

1.linux下Nginx的安装

大家可以参考我以前写的Nginx安装配置篇(Session共享)

2. 配置Nginx_status

在${NGINX_HOME}/conf/nginx.conf的server{}中添加以代码:
        location /nginx_status {
                stub_status on;
                access_log  off;
                #allow 127.0.0.1;
                #deny all;
        }
注: 为了安全可以添加allow, deny; allow 是允许某个ip或者一个ip段访问, deny禁止某个ip或者一个ip段访问;

3. 安装zabbix_server与zabbix_agent

大家可以去网上找找相关的资料.

4. 配置zabbix_agent: /etc/zabbix/zabbix_agentd.conf文件

Server=zabbix_server的ip
ServerActive=zabbix_server的ip
Hostname=本机ip #不要写127.0.0.1

5. 添加nginx_status.sh脚本文件

#!/bin/bash

#script to fetch nginx statuses for tribily monitoring systems
# Author: krish@toonheart.com
# License: GPLv2
# Set Variables
BKUP_DATE=`/bin/date +%Y%m%d`
LOG="/data/log/zabbix/webstatus.log"
HOST=127.0.0.1
PORT="80"
# Functions to return nginx stats
function active {
  /usr/bin/curl "http://$HOST:$PORT/nginx_status" 2>/dev/null| grep 'Active' | awk '{print $NF}'
}
function reading {
  /usr/bin/curl "http://$HOST:$PORT/nginx_status" 2>/dev/null| grep 'Reading' | awk '{print $2}'
}
function writing {
  /usr/bin/curl "http://$HOST:$PORT/nginx_status" 2>/dev/null| grep 'Writing' | awk '{print $4}'
}
function waiting {
  /usr/bin/curl "http://$HOST:$PORT/nginx_status" 2>/dev/null| grep 'Waiting' | awk '{print $6}'
}
function accepts {
  /usr/bin/curl "http://$HOST:$PORT/nginx_status" 2>/dev/null| awk NR==3 | awk '{print $1}'
}
function handled {
  /usr/bin/curl "http://$HOST:$PORT/nginx_status" 2>/dev/null| awk NR==3 | awk '{print $2}'
}
function requests {
  /usr/bin/curl "http://$HOST:$PORT/nginx_status" 2>/dev/null| awk NR==3 | awk '{print $3}'
}
# Run the requested function
$1

6. 在/etc/zabbix/zabbix_agentd.d/下添加zabbix_nginx的数据收集文件userparameter_nginx.conf

UserParameter=nginx.accepts,/etc/zabbix/scripts/nginx_status.sh accepts
UserParameter=nginx.handled,/etc/zabbix/scripts/nginx_status.sh handled  
UserParameter=nginx.requests,/etc/zabbix/scripts/nginx_status.sh requests  
UserParameter=nginx.connections.active,/etc/zabbix/scripts/nginx_status.sh active  
UserParameter=nginx.connections.reading,/etc/zabbix/scripts/nginx_status.sh reading  
UserParameter=nginx.connections.writing,/etc/zabbix/scripts/nginx_status.sh writing  
UserParameter=nginx.connections.waiting,/etc/zabbix/scripts/nginx_status.sh waiting

7. 重启zabbix-agent服务

service zabbix-agent restart

8.测试zabbix-server可以获取数据

zabbix_get -s nginx服务ip -p 10050 -k "nginx.connections.active"

9. 配置zabbix-server的nginx status模版

<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export version="1.0" date="14.03.11" time="08.48">
  <hosts>
    <host name="Nginx Status">
      <proxy_hostid>0</proxy_hostid>
      <useip>1</useip>
      <dns></dns>
      <ip>127.0.0.1</ip>
      <port>10050</port>
      <status>3</status>
      <useipmi>0</useipmi>
      <ipmi_ip>127.0.0.1</ipmi_ip>
      <ipmi_port>623</ipmi_port>
      <ipmi_authtype>0</ipmi_authtype>
      <ipmi_privilege>2</ipmi_privilege>
      <ipmi_username></ipmi_username>
      <ipmi_password></ipmi_password>
      <groups>
        <group>Freetrade</group>
      </groups>
      <triggers/>
      <items>
        <item type="7" key="nginx.accepts" value_type="3">
          <description>Nginx Accepts</description>
          <ipmi_sensor></ipmi_sensor>
          <delay>30</delay>
          <history>365</history>
          <trends>365</trends>
          <status>0</status>
          <data_type>0</data_type>
          <units></units>
          <multiplier>0</multiplier>
          <delta>0</delta>
          <formula>0</formula>
          <lastlogsize>0</lastlogsize>
          <logtimefmt></logtimefmt>
          <delay_flex></delay_flex>
          <authtype>0</authtype>
          <username></username>
          <password></password>
          <publickey></publickey>
          <privatekey></privatekey>
          <params></params>
          <trapper_hosts>localhost</trapper_hosts>
          <snmp_community></snmp_community>
          <snmp_oid></snmp_oid>
          <snmp_port>161</snmp_port>
          <snmpv3_securityname></snmpv3_securityname>
          <snmpv3_securitylevel>0</snmpv3_securitylevel>
          <snmpv3_authpassphrase></snmpv3_authpassphrase>
          <snmpv3_privpassphrase></snmpv3_privpassphrase>
          <applications>
            <application>Nginx</application>
          </applications>
        </item>
        <item type="7" key="nginx.connections.active" value_type="3">
          <description>Nginx Connections Active</description>
          <ipmi_sensor></ipmi_sensor>
          <delay>30</delay>
          <history>365</history>
          <trends>365</trends>
          <status>0</status>
          <data_type>0</data_type>
          <units></units>
          <multiplier>0</multiplier>
          <delta>0</delta>
          <formula>0</formula>
          <lastlogsize>0</lastlogsize>
          <logtimefmt></logtimefmt>
          <delay_flex></delay_flex>
          <authtype>0</authtype>
          <username></username>
          <password></password>
          <publickey></publickey>
          <privatekey></privatekey>
          <params></params>
          <trapper_hosts>localhost</trapper_hosts>
          <snmp_community></snmp_community>
          <snmp_oid></snmp_oid>
          <snmp_port>161</snmp_port>
          <snmpv3_securityname></snmpv3_securityname>
          <snmpv3_securitylevel>0</snmpv3_securitylevel>
          <snmpv3_authpassphrase></snmpv3_authpassphrase>
          <snmpv3_privpassphrase></snmpv3_privpassphrase>
          <applications>
            <application>Nginx</application>
          </applications>
        </item>
        <item type="7" key="nginx.connections.reading" value_type="3">
          <description>Nginx Connections Reading</description>
          <ipmi_sensor></ipmi_sensor>
          <delay>30</delay>
          <history>365</history>
          <trends>365</trends>
          <status>0</status>
          <data_type>0</data_type>
          <units></units>
          <multiplier>0</multiplier>
          <delta>0</delta>
          <formula>0</formula>
          <lastlogsize>0</lastlogsize>
          <logtimefmt></logtimefmt>
          <delay_flex></delay_flex>
          <authtype>0</authtype>
          <username></username>
          <password></password>
          <publickey></publickey>
          <privatekey></privatekey>
          <params></params>
          <trapper_hosts>localhost</trapper_hosts>
          <snmp_community></snmp_community>
          <snmp_oid></snmp_oid>
          <snmp_port>161</snmp_port>
          <snmpv3_securityname></snmpv3_securityname>
          <snmpv3_securitylevel>0</snmpv3_securitylevel>
          <snmpv3_authpassphrase></snmpv3_authpassphrase>
          <snmpv3_privpassphrase></snmpv3_privpassphrase>
          <applications>
            <application>Nginx</application>
          </applications>
        </item>
        <item type="7" key="nginx.connections.waiting" value_type="3">
          <description>Nginx Connections Waiting</description>
          <ipmi_sensor></ipmi_sensor>
          <delay>30</delay>
          <history>365</history>
          <trends>365</trends>
          <status>0</status>
          <data_type>0</data_type>
          <units></units>
          <multiplier>0</multiplier>
          <delta>0</delta>
          <formula>0</formula>
          <lastlogsize>0</lastlogsize>
          <logtimefmt></logtimefmt>
          <delay_flex></delay_flex>
          <authtype>0</authtype>
          <username></username>
          <password></password>
          <publickey></publickey>
          <privatekey></privatekey>
          <params></params>
          <trapper_hosts>localhost</trapper_hosts>
          <snmp_community></snmp_community>
          <snmp_oid></snmp_oid>
          <snmp_port>161</snmp_port>
          <snmpv3_securityname></snmpv3_securityname>
          <snmpv3_securitylevel>0</snmpv3_securitylevel>
          <snmpv3_authpassphrase></snmpv3_authpassphrase>
          <snmpv3_privpassphrase></snmpv3_privpassphrase>
          <applications>
            <application>Nginx</application>
          </applications>
        </item>
        <item type="7" key="nginx.connections.writing" value_type="3">
          <description>Nginx Connections Writing</description>
          <ipmi_sensor></ipmi_sensor>
          <delay>30</delay>
          <history>365</history>
          <trends>365</trends>
          <status>0</status>
          <data_type>0</data_type>
          <units></units>
          <multiplier>0</multiplier>
          <delta>0</delta>
          <formula>0</formula>
          <lastlogsize>0</lastlogsize>
          <logtimefmt></logtimefmt>
          <delay_flex></delay_flex>
          <authtype>0</authtype>
          <username></username>
          <password></password>
          <publickey></publickey>
          <privatekey></privatekey>
          <params></params>
          <trapper_hosts>localhost</trapper_hosts>
          <snmp_community></snmp_community>
          <snmp_oid></snmp_oid>
          <snmp_port>161</snmp_port>
          <snmpv3_securityname></snmpv3_securityname>
          <snmpv3_securitylevel>0</snmpv3_securitylevel>
          <snmpv3_authpassphrase></snmpv3_authpassphrase>
          <snmpv3_privpassphrase></snmpv3_privpassphrase>
          <applications>
            <application>Nginx</application>
          </applications>
        </item>
        <item type="7" key="nginx.handled" value_type="3">
          <description>Nginx Handled</description>
          <ipmi_sensor></ipmi_sensor>
          <delay>30</delay>
          <history>365</history>
          <trends>365</trends>
          <status>0</status>
          <data_type>0</data_type>
          <units></units>
          <multiplier>0</multiplier>
          <delta>0</delta>
          <formula>0</formula>
          <lastlogsize>0</lastlogsize>
          <logtimefmt></logtimefmt>
          <delay_flex></delay_flex>
          <authtype>0</authtype>
          <username></username>
          <password></password>
          <publickey></publickey>
          <privatekey></privatekey>
          <params></params>
          <trapper_hosts>localhost</trapper_hosts>
          <snmp_community></snmp_community>
          <snmp_oid></snmp_oid>
          <snmp_port>161</snmp_port>
          <snmpv3_securityname></snmpv3_securityname>
          <snmpv3_securitylevel>0</snmpv3_securitylevel>
          <snmpv3_authpassphrase></snmpv3_authpassphrase>
          <snmpv3_privpassphrase></snmpv3_privpassphrase>
          <applications>
            <application>Nginx</application>
          </applications>
        </item>
        <item type="7" key="nginx.requests" value_type="3">
          <description>Nginx Requests</description>
          <ipmi_sensor></ipmi_sensor>
          <delay>30</delay>
          <history>365</history>
          <trends>365</trends>
          <status>0</status>
          <data_type>0</data_type>
          <units></units>
          <multiplier>0</multiplier>
          <delta>0</delta>
          <formula>0</formula>
          <lastlogsize>0</lastlogsize>
          <logtimefmt></logtimefmt>
          <delay_flex></delay_flex>
          <authtype>0</authtype>
          <username></username>
          <password></password>
          <publickey></publickey>
          <privatekey></privatekey>
          <params></params>
          <trapper_hosts>localhost</trapper_hosts>
          <snmp_community></snmp_community>
          <snmp_oid></snmp_oid>
          <snmp_port>161</snmp_port>
          <snmpv3_securityname></snmpv3_securityname>
          <snmpv3_securitylevel>0</snmpv3_securitylevel>
          <snmpv3_authpassphrase></snmpv3_authpassphrase>
          <snmpv3_privpassphrase></snmpv3_privpassphrase>
          <applications>
            <application>Nginx</application>
          </applications>
        </item>
      </items>
      <templates/>
      <graphs>
        <graph name="Nginx Socket Status" width="900" height="200">
          <ymin_type>0</ymin_type>
          <ymax_type>0</ymax_type>
          <ymin_item_key></ymin_item_key>
          <ymax_item_key></ymax_item_key>
          <show_work_period>1</show_work_period>
          <show_triggers>1</show_triggers>
          <graphtype>0</graphtype>
          <yaxismin>0.0000</yaxismin>
          <yaxismax>100.0000</yaxismax>
          <show_legend>0</show_legend>
          <show_3d>0</show_3d>
          <percent_left>0.0000</percent_left>
          <percent_right>0.0000</percent_right>
          <graph_elements>
            <graph_element item="Nginx Status:nginx.accepts">
              <drawtype>0</drawtype>
              <sortorder>0</sortorder>
              <color>00EE00</color>
              <yaxisside>0</yaxisside>
              <calc_fnc>2</calc_fnc>
              <type>0</type>
              <periods_cnt>5</periods_cnt>
            </graph_element>
            <graph_element item="Nginx Status:nginx.handled">
              <drawtype>0</drawtype>
              <sortorder>0</sortorder>
              <color>EE0000</color>
              <yaxisside>0</yaxisside>
              <calc_fnc>2</calc_fnc>
              <type>0</type>
              <periods_cnt>5</periods_cnt>
            </graph_element>
            <graph_element item="Nginx Status:nginx.requests">
              <drawtype>0</drawtype>
              <sortorder>1</sortorder>
              <color>EEEE00</color>
              <yaxisside>0</yaxisside>
              <calc_fnc>2</calc_fnc>
              <type>0</type>
              <periods_cnt>5</periods_cnt>
            </graph_element>
          </graph_elements>
        </graph>
        <graph name="Nginx Clients Status" width="900" height="200">
          <ymin_type>0</ymin_type>
          <ymax_type>0</ymax_type>
          <ymin_item_key></ymin_item_key>
          <ymax_item_key></ymax_item_key>
          <show_work_period>1</show_work_period>
          <show_triggers>1</show_triggers>
          <graphtype>0</graphtype>
          <yaxismin>0.0000</yaxismin>
          <yaxismax>100.0000</yaxismax>
          <show_legend>0</show_legend>
          <show_3d>0</show_3d>
          <percent_left>0.0000</percent_left>
          <percent_right>0.0000</percent_right>
          <graph_elements>
            <graph_element item="Nginx Status:nginx.connections.active">
              <drawtype>0</drawtype>
              <sortorder>0</sortorder>
              <color>0000EE</color>
              <yaxisside>0</yaxisside>
              <calc_fnc>2</calc_fnc>
              <type>0</type>
              <periods_cnt>5</periods_cnt>
            </graph_element>
            <graph_element item="Nginx Status:nginx.connections.writing">
              <drawtype>0</drawtype>
              <sortorder>1</sortorder>
              <color>EE0000</color>
              <yaxisside>0</yaxisside>
              <calc_fnc>2</calc_fnc>
              <type>0</type>
              <periods_cnt>5</periods_cnt>
            </graph_element>
            <graph_element item="Nginx Status:nginx.connections.waiting">
              <drawtype>0</drawtype>
              <sortorder>2</sortorder>
              <color>EEEE00</color>
              <yaxisside>0</yaxisside>
              <calc_fnc>2</calc_fnc>
              <type>0</type>
              <periods_cnt>5</periods_cnt>
            </graph_element>
            <graph_element item="Nginx Status:nginx.connections.reading">
              <drawtype>0</drawtype>
              <sortorder>3</sortorder>
              <color>00EE00</color>
              <yaxisside>0</yaxisside>
              <calc_fnc>2</calc_fnc>
              <type>0</type>
              <periods_cnt>5</periods_cnt>
            </graph_element>
          </graph_elements>
        </graph>
      </graphs>
      <macros/>
    </host>
  </hosts>
  <dependencies/><?xml version="1.0" encoding="UTF-8"?>
<zabbix_export version="1.0" date="14.03.11" time="08.48">
  <hosts>
    <host name="Nginx Status">
      <proxy_hostid>0</proxy_hostid>
      <useip>1</useip>
      <dns></dns>
      <ip>127.0.0.1</ip>
      <port>10050</port>
      <status>3</status>
      <useipmi>0</useipmi>
      <ipmi_ip>127.0.0.1</ipmi_ip>
      <ipmi_port>623</ipmi_port>
      <ipmi_authtype>0</ipmi_authtype>
      <ipmi_privilege>2</ipmi_privilege>
      <ipmi_username></ipmi_username>
      <ipmi_password></ipmi_password>
      <groups>
        <group>Freetrade</group>
      </groups>
      <triggers/>
      <items>
        <item type="7" key="nginx.accepts" value_type="3">
          <description>Nginx Accepts</description>
          <ipmi_sensor></ipmi_sensor>
          <delay>30</delay>
          <history>365</history>
          <trends>365</trends>
          <status>0</status>
          <data_type>0</data_type>
          <units></units>
          <multiplier>0</multiplier>
          <delta>0</delta>
          <formula>0</formula>
          <lastlogsize>0</lastlogsize>
          <logtimefmt></logtimefmt>
          <delay_flex></delay_flex>
          <authtype>0</authtype>
          <username></username>
          <password></password>
          <publickey></publickey>
          <privatekey></privatekey>
          <params></params>
          <trapper_hosts>localhost</trapper_hosts>
          <snmp_community></snmp_community>
          <snmp_oid></snmp_oid>
          <snmp_port>161</snmp_port>
          <snmpv3_securityname></snmpv3_securityname>
          <snmpv3_securitylevel>0</snmpv3_securitylevel>
          <snmpv3_authpassphrase></snmpv3_authpassphrase>
          <snmpv3_privpassphrase></snmpv3_privpassphrase>
          <applications>
            <application>Nginx</application>
          </applications>
        </item>
        <item type="7" key="nginx.connections.active" value_type="3">
          <description>Nginx Connections Active</description>
          <ipmi_sensor></ipmi_sensor>
          <delay>30</delay>
          <history>365</history>
          <trends>365</trends>
          <status>0</status>
          <data_type>0</data_type>
          <units></units>
          <multiplier>0</multiplier>
          <delta>0</delta>
          <formula>0</formula>
          <lastlogsize>0</lastlogsize>
          <logtimefmt></logtimefmt>
          <delay_flex></delay_flex>
          <authtype>0</authtype>
          <username></username>
          <password></password>
          <publickey></publickey>
          <privatekey></privatekey>
          <params></params>
          <trapper_hosts>localhost</trapper_hosts>
          <snmp_community></snmp_community>
          <snmp_oid></snmp_oid>
          <snmp_port>161</snmp_port>
          <snmpv3_securityname></snmpv3_securityname>
          <snmpv3_securitylevel>0</snmpv3_securitylevel>
          <snmpv3_authpassphrase></snmpv3_authpassphrase>
          <snmpv3_privpassphrase></snmpv3_privpassphrase>
          <applications>
            <application>Nginx</application>
          </applications>
        </item>
        <item type="7" key="nginx.connections.reading" value_type="3">
          <description>Nginx Connections Reading</description>
          <ipmi_sensor></ipmi_sensor>
          <delay>30</delay>
          <history>365</history>
          <trends>365</trends>
          <status>0</status>
          <data_type>0</data_type>
          <units></units>
          <multiplier>0</multiplier>
          <delta>0</delta>
          <formula>0</formula>
          <lastlogsize>0</lastlogsize>
          <logtimefmt></logtimefmt>
          <delay_flex></delay_flex>
          <authtype>0</authtype>
          <username></username>
          <password></password>
          <publickey></publickey>
          <privatekey></privatekey>
          <params></params>
          <trapper_hosts>localhost</trapper_hosts>
          <snmp_community></snmp_community>
          <snmp_oid></snmp_oid>
          <snmp_port>161</snmp_port>
          <snmpv3_securityname></snmpv3_securityname>
          <snmpv3_securitylevel>0</snmpv3_securitylevel>
          <snmpv3_authpassphrase></snmpv3_authpassphrase>
          <snmpv3_privpassphrase></snmpv3_privpassphrase>
          <applications>
            <application>Nginx</application>
          </applications>
        </item>
        <item type="7" key="nginx.connections.waiting" value_type="3">
          <description>Nginx Connections Waiting</description>
          <ipmi_sensor></ipmi_sensor>
          <delay>30</delay>
          <history>365</history>
          <trends>365</trends>
          <status>0</status>
          <data_type>0</data_type>
          <units></units>
          <multiplier>0</multiplier>
          <delta>0</delta>
          <formula>0</formula>
          <lastlogsize>0</lastlogsize>
          <logtimefmt></logtimefmt>
          <delay_flex></delay_flex>
          <authtype>0</authtype>
          <username></username>
          <password></password>
          <publickey></publickey>
          <privatekey></privatekey>
          <params></params>
          <trapper_hosts>localhost</trapper_hosts>
          <snmp_community></snmp_community>
          <snmp_oid></snmp_oid>
          <snmp_port>161</snmp_port>
          <snmpv3_securityname></snmpv3_securityname>
          <snmpv3_securitylevel>0</snmpv3_securitylevel>
          <snmpv3_authpassphrase></snmpv3_authpassphrase>
          <snmpv3_privpassphrase></snmpv3_privpassphrase>
          <applications>
            <application>Nginx</application>
          </applications>
        </item>
        <item type="7" key="nginx.connections.writing" value_type="3">
          <description>Nginx Connections Writing</description>
          <ipmi_sensor></ipmi_sensor>
          <delay>30</delay>
          <history>365</history>
          <trends>365</trends>
          <status>0</status>
          <data_type>0</data_type>
          <units></units>
          <multiplier>0</multiplier>
          <delta>0</delta>
          <formula>0</formula>
          <lastlogsize>0</lastlogsize>
          <logtimefmt></logtimefmt>
          <delay_flex></delay_flex>
          <authtype>0</authtype>
          <username></username>
          <password></password>
          <publickey></publickey>
          <privatekey></privatekey>
          <params></params>
          <trapper_hosts>localhost</trapper_hosts>
          <snmp_community></snmp_community>
          <snmp_oid></snmp_oid>
          <snmp_port>161</snmp_port>
          <snmpv3_securityname></snmpv3_securityname>
          <snmpv3_securitylevel>0</snmpv3_securitylevel>
          <snmpv3_authpassphrase></snmpv3_authpassphrase>
          <snmpv3_privpassphrase></snmpv3_privpassphrase>
          <applications>
            <application>Nginx</application>
          </applications>
        </item>
        <item type="7" key="nginx.handled" value_type="3">
          <description>Nginx Handled</description>
          <ipmi_sensor></ipmi_sensor>
          <delay>30</delay>
          <history>365</history>
          <trends>365</trends>
          <status>0</status>
          <data_type>0</data_type>
          <units></units>
          <multiplier>0</multiplier>
          <delta>0</delta>
          <formula>0</formula>
          <lastlogsize>0</lastlogsize>
          <logtimefmt></logtimefmt>
          <delay_flex></delay_flex>
          <authtype>0</authtype>
          <username></username>
          <password></password>
          <publickey></publickey>
          <privatekey></privatekey>
          <params></params>
          <trapper_hosts>localhost</trapper_hosts>
          <snmp_community></snmp_community>
          <snmp_oid></snmp_oid>
          <snmp_port>161</snmp_port>
          <snmpv3_securityname></snmpv3_securityname>
          <snmpv3_securitylevel>0</snmpv3_securitylevel>
          <snmpv3_authpassphrase></snmpv3_authpassphrase>
          <snmpv3_privpassphrase></snmpv3_privpassphrase>
          <applications>
            <application>Nginx</application>
          </applications>
        </item>
        <item type="7" key="nginx.requests" value_type="3">
          <description>Nginx Requests</description>
          <ipmi_sensor></ipmi_sensor>
          <delay>30</delay>
          <history>365</history>
          <trends>365</trends>
          <status>0</status>
          <data_type>0</data_type>
          <units></units>
          <multiplier>0</multiplier>
          <delta>0</delta>
          <formula>0</formula>
          <lastlogsize>0</lastlogsize>
          <logtimefmt></logtimefmt>
          <delay_flex></delay_flex>
          <authtype>0</authtype>
          <username></username>
          <password></password>
          <publickey></publickey>
          <privatekey></privatekey>
          <params></params>
          <trapper_hosts>localhost</trapper_hosts>
          <snmp_community></snmp_community>
          <snmp_oid></snmp_oid>
          <snmp_port>161</snmp_port>
          <snmpv3_securityname></snmpv3_securityname>
          <snmpv3_securitylevel>0</snmpv3_securitylevel>
          <snmpv3_authpassphrase></snmpv3_authpassphrase>
          <snmpv3_privpassphrase></snmpv3_privpassphrase>
          <applications>
            <application>Nginx</application>
          </applications>
        </item>
      </items>
      <templates/>
      <graphs>
        <graph name="Nginx Socket Status" width="900" height="200">
          <ymin_type>0</ymin_type>
          <ymax_type>0</ymax_type>
          <ymin_item_key></ymin_item_key>
          <ymax_item_key></ymax_item_key>
          <show_work_period>1</show_work_period>
          <show_triggers>1</show_triggers>
          <graphtype>0</graphtype>
          <yaxismin>0.0000</yaxismin>
          <yaxismax>100.0000</yaxismax>
          <show_legend>0</show_legend>
          <show_3d>0</show_3d>
          <percent_left>0.0000</percent_left>
          <percent_right>0.0000</percent_right>
          <graph_elements>
            <graph_element item="Nginx Status:nginx.accepts">
              <drawtype>0</drawtype>
              <sortorder>0</sortorder>
              <color>00EE00</color>
              <yaxisside>0</yaxisside>
              <calc_fnc>2</calc_fnc>
              <type>0</type>
              <periods_cnt>5</periods_cnt>
            </graph_element>
            <graph_element item="Nginx Status:nginx.handled">
              <drawtype>0</drawtype>
              <sortorder>0</sortorder>
              <color>EE0000</color>
              <yaxisside>0</yaxisside>
              <calc_fnc>2</calc_fnc>
              <type>0</type>
              <periods_cnt>5</periods_cnt>
            </graph_element>
            <graph_element item="Nginx Status:nginx.requests">
              <drawtype>0</drawtype>
              <sortorder>1</sortorder>
              <color>EEEE00</color>
              <yaxisside>0</yaxisside>
              <calc_fnc>2</calc_fnc>
              <type>0</type>
              <periods_cnt>5</periods_cnt>
            </graph_element>
          </graph_elements>
        </graph>
        <graph name="Nginx Clients Status" width="900" height="200">
          <ymin_type>0</ymin_type>
          <ymax_type>0</ymax_type>
          <ymin_item_key></ymin_item_key>
          <ymax_item_key></ymax_item_key>
          <show_work_period>1</show_work_period>
          <show_triggers>1</show_triggers>
          <graphtype>0</graphtype>
          <yaxismin>0.0000</yaxismin>
          <yaxismax>100.0000</yaxismax>
          <show_legend>0</show_legend>
          <show_3d>0</show_3d>
          <percent_left>0.0000</percent_left>
          <percent_right>0.0000</percent_right>
          <graph_elements>
            <graph_element item="Nginx Status:nginx.connections.active">
              <drawtype>0</drawtype>
              <sortorder>0</sortorder>
              <color>0000EE</color>
              <yaxisside>0</yaxisside>
              <calc_fnc>2</calc_fnc>
              <type>0</type>
              <periods_cnt>5</periods_cnt>
            </graph_element>
            <graph_element item="Nginx Status:nginx.connections.writing">
              <drawtype>0</drawtype>
              <sortorder>1</sortorder>
              <color>EE0000</color>
              <yaxisside>0</yaxisside>
              <calc_fnc>2</calc_fnc>
              <type>0</type>
              <periods_cnt>5</periods_cnt>
            </graph_element>
            <graph_element item="Nginx Status:nginx.connections.waiting">
              <drawtype>0</drawtype>
              <sortorder>2</sortorder>
              <color>EEEE00</color>
              <yaxisside>0</yaxisside>
              <calc_fnc>2</calc_fnc>
              <type>0</type>
              <periods_cnt>5</periods_cnt>
            </graph_element>
            <graph_element item="Nginx Status:nginx.connections.reading">
              <drawtype>0</drawtype>
              <sortorder>3</sortorder>
              <color>00EE00</color>
              <yaxisside>0</yaxisside>
              <calc_fnc>2</calc_fnc>
              <type>0</type>
              <periods_cnt>5</periods_cnt>
            </graph_element>
          </graph_elements>
        </graph>
      </graphs>
      <macros/>
    </host>
  </hosts>
  <dependencies/>
</zabbix_export>

10. 监控图片如下





阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/a294039255/article/details/51543007
文章标签: nginx
个人分类: Nginx Linux
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

服务器监控之zabbix监控Nginx篇

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭