服务器监控之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的监控...

zabbix监控nginx性能状态

来源URL: http://liqingbiao.blog.51cto.com/3044896/1894902?b4 nginx在生产环境中的应用越来越广泛,所以需要对nginx的性能状态做...

Zabbix监控nginx服务进程状态

zabbix监控nginx需要开启nginx status,要确认nginx编译http_sub_module模块!   1、检查当前nginx是否安装配置http_sub_module模块  ...

zabbix系列(四)Zabbix3.0.4添加对Nginx服务的监控

Zabbix3.0.4添加对Nginx服务的监控 通过Nginx的http_stub_status_module模块提供的状态信息来监控,所以在Agent端需要配置Nginx状态获取的脚本,和添加...

zabbix监控 nginx 模板

0   1     127.0.0.1   10050   3   0   127.0.0.1   623   0   2       Templates   ...

Delphi7高级应用开发随书源码

  • 2003年04月30日 00:00
  • 676KB
  • 下载

Nginx负载均衡+监控状态检测

Nginx负载均衡与可用性检查 在业界,一直流传这样一句话:Nginx抗并发能力强!为什么Nginx抗并发能力强?原因是使用了非阻塞、异步传输 阻塞:如apache代理tomcat时,apac...
  • ye1992
  • ye1992
  • 2016年05月11日 09:08
  • 3403

zabbix监控日志文件 MySQL日志为例

一般情况下,日志最先反映出应用当前的问题,在海量日志里面找到我们异常记录,然后记录下来,并且根据情况报警,大家可以监控系统日志、nginx、Apache、业务日志。这边我拿常见的MySQL日志做监控,...
  • slovyz
  • slovyz
  • 2016年01月05日 15:11
  • 2101

用nginx-rrd监控nginx访问数

以下两种方法都未进行实测。 http://laoxu.blog.51cto.com/4120547/1159491/   //推荐 http://www.linuxde.net/2012/04/953...

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

nginx端相关操作在nginx.conf中添加如下内容#vi nginx.conf ... location /nginx-status { stub_status on; ...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:服务器监控之zabbix监控Nginx篇
举报原因:
原因补充:

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