服务器监控之zabbix监控Nginx篇

原创 2016年05月31日 09:40:39

最近一直在做服务器端性能优化的事, 而监控是性能优化的首要条件.下面是用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. 监控图片如下





版权声明:本文为博主原创文章,未经博主允许不得转载。

[Zabbix3.0 ]添加Nginx监控

通过Nginx的http_stub_status_module模块提供的状态信息来监控,所以在Agent端需要配置Nginx状态获取的脚本,和添加key信息等,然后在Server端配置Nginx的监控...
  • lzz957748332
  • lzz957748332
  • 2016年04月10日 17:40
  • 6925

zabbix监控nginx性能状态

来源URL: http://liqingbiao.blog.51cto.com/3044896/1894902?b4 nginx在生产环境中的应用越来越广泛,所以需要对nginx的性能状态做...
  • u013160024
  • u013160024
  • 2017年02月16日 09:34
  • 2919

zabbix监控之nginx模板

  • 2017年08月02日 16:42
  • 20KB
  • 下载

Zabbix监控nginx服务进程状态

zabbix监控nginx需要开启nginx status,要确认nginx编译http_sub_module模块!   1、检查当前nginx是否安装配置http_sub_module模块  ...
  • qq942477618
  • qq942477618
  • 2017年01月22日 17:31
  • 1262

zabbix监控nginx(python脚本)

1 配置nginx的http_stub_status_module模块 编译nginx加上参数:–with-http_stub_status_module 配置nginx.conf: locat...
  • weixin_35829542
  • weixin_35829542
  • 2016年11月09日 16:38
  • 831

Zabbix监控nginx性能

需要使用zabbix监控nginx,首先nginx需要配置ngx_status,如果开启请看凉白开之前的文章《启用nginx status状态详解》 nginx status信息 12345# ...
  • slovyz
  • slovyz
  • 2016年01月05日 16:10
  • 680

Centos7下通过zabbix监控nginx status

操作环境 Centos 7.2 zabbix 3.2 nginx 1.10 操作步骤 1.安装配置zabbix-server以及agent参照《Centos ...
  • bobpen
  • bobpen
  • 2016年12月02日 10:25
  • 685

zabbix3.2 添加nginx监控(连接数)

nginx端相关操作在nginx.conf中添加如下内容#vi nginx.conf ... location /nginx-status { stub_status on; ...
  • Maikilee_sys
  • Maikilee_sys
  • 2017年02月03日 16:44
  • 1801

Zabbix监控nginx性能

需要使用zabbix监控nginx,首先nginx需要配置ngx_status,如果开启请看凉白开之前的文章《启用nginx status状态详解》 nginx status信息 ...
  • Hu_wen
  • Hu_wen
  • 2017年03月20日 14:30
  • 552

zabbix监控nginx性能状态

来源URL: http://liqingbiao.blog.51cto.com/3044896/1894902?b4 nginx在生产环境中的应用越来越广泛,所以需要对nginx的性能状态做...
  • u013160024
  • u013160024
  • 2017年02月16日 09:34
  • 2919
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:服务器监控之zabbix监控Nginx篇
举报原因:
原因补充:

(最多只允许输入30个字)