6 zabbix_get获取数据(服务器端) (测试是否能接受到数据)
zabbix_get -s 172.16.145.7 -p 10050 -k "nginx.connections.active"10zabbix_get -s 172.16.145.7 -p 10050 -k "nginx.connections.waiting"0zabbix_get -s 172.16.145.7 -p 10050 -k "nginx.connections.writing"1zabbix_get -s 172.16.145.7 -p 10050 -k "nginx.accepts" 9zabbix_get -s 172.16.145.7 -p 10050 -k "nginx.requests"9
能得到正确数据就行,只是测试。
7.zabbix web端配置
下载一个关于nginx的模版,然后导入到zabbix中去
到了最后一个阶段,登陆zabbix管理端,link模板到nginx服务器:configuration->hosts->点击nginx所在服务器->点击template->Link new templates输入"Template App NGINX"->Add->最后点击update。
总结:zabbix是一个很好的监控预警程序+nginx是一个支持高并发的,目前比较流行的是一个高性能的http和反向代理服务器,双剑合璧,你懂得,高大上
系统linux/redhat6.5 zabbix 2.47监控nginx1.8.0 (上)
http://my.oschina.net/u/2618987/blog/608259
下面是一个我修改的关于nginx的模板,
<?xml version="1.0" encoding="UTF-8"?> <zabbix_export> <version>2.0</version> <date>2016-01-23T10:51:24Z</date> <groups> <group> <name>Templates</name> </group> </groups> <templates> <template> <template>Template App NGINX</template> <name>Template App NGINX</name> <description>nginx监控模板 - 红杉红杉,我是</description> <groups> <group> <name>Templates</name> </group> </groups> <applications> <application> <name>nginx</name> </application> </applications> <items> <item> <name>nginx status connections active</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>nginx.connections.active</key> <delay>60</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>0</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description>active</description> <inventory_link>0</inventory_link> <applications> <application> <name>nginx</name> </application> </applications> <valuemap/> <logtimefmt/> </item> <item> <name>nginx status connections reading</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>nginx.connections.reading</key> <delay>60</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>0</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description>reading</description> <inventory_link>0</inventory_link> <applications> <application> <name>nginx</name> </application> </applications> <valuemap/> <logtimefmt/> </item> <item> <name>nginx status connections waiting</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>nginx.connections.waiting</key> <delay>60</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>0</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description>waiting</description> <inventory_link>0</inventory_link> <applications> <application> <name>nginx</name> </application> </applications> <valuemap/> <logtimefmt/> </item> <item> <name>nginx status connections writing</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>nginx.connections.writing</key> <delay>60</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>0</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description>writing</description> <inventory_link>0</inventory_link> <applications> <application> <name>nginx</name> </application> </applications> <valuemap/> <logtimefmt/> </item> <item> <name>nginx status server accepts</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>nginx.accepts</key> <delay>60</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>1</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description>accepts</description> <inventory_link>0</inventory_link> <applications> <application> <name>nginx</name> </application> </applications> <valuemap/> <logtimefmt/> </item> <item> <name>nginx status server handled</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>nginx.handled</key> <delay>60</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>1</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description>handled</description> <inventory_link>0</inventory_link> <applications> <application> <name>nginx</name> </application> </applications> <valuemap/> <logtimefmt/> </item> <item> <name>nginx status server requests</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>nginx.requests</key> <delay>60</delay> <history>90</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>1</delta> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <formula>1</formula> <delay_flex/> <params/> <ipmi_sensor/> <data_type>0</data_type> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description>requests</description> <inventory_link>0</inventory_link> <applications> <application> <name>nginx</name> </application> </applications> <valuemap/> <logtimefmt/> </item> </items> <discovery_rules/> <macros/> <templates/> <screens/> </template> </templates> <graphs> <graph> <name>nginx status connections</name> <width>900</width> <height>200</height> <yaxismin>0.0000</yaxismin> <yaxismax>100.0000</yaxismax> <show_work_period>1</show_work_period> <show_triggers>1</show_triggers> <type>0</type> <show_legend>1</show_legend> <show_3d>0</show_3d> <percent_left>0.0000</percent_left> <percent_right>0.0000</percent_right> <ymin_type_1>0</ymin_type_1> <ymax_type_1>0</ymax_type_1> <ymin_item_1>0</ymin_item_1> <ymax_item_1>0</ymax_item_1> <graph_items> <graph_item> <sortorder>0</sortorder> <drawtype>0</drawtype> <color>00C800</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>Template App NGINX</host> <key>nginx.connections.active</key> </item> </graph_item> <graph_item> <sortorder>1</sortorder> <drawtype>0</drawtype> <color>C80000</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>Template App NGINX</host> <key>nginx.connections.reading</key> </item> </graph_item> <graph_item> <sortorder>2</sortorder> <drawtype>0</drawtype> <color>0000C8</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>Template App NGINX</host> <key>nginx.connections.waiting</key> </item> </graph_item> <graph_item> <sortorder>3</sortorder> <drawtype>0</drawtype> <color>C800C8</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>Template App NGINX</host> <key>nginx.connections.writing</key> </item> </graph_item> </graph_items> </graph> <graph> <name>nginx status server</name> <width>900</width> <height>200</height> <yaxismin>0.0000</yaxismin> <yaxismax>100.0000</yaxismax> <show_work_period>1</show_work_period> <show_triggers>1</show_triggers> <type>0</type> <show_legend>1</show_legend> <show_3d>0</show_3d> <percent_left>0.0000</percent_left> <percent_right>0.0000</percent_right> <ymin_type_1>0</ymin_type_1> <ymax_type_1>0</ymax_type_1> <ymin_item_1>0</ymin_item_1> <ymax_item_1>0</ymax_item_1> <graph_items> <graph_item> <sortorder>0</sortorder> <drawtype>0</drawtype> <color>00C800</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>Template App NGINX</host> <key>nginx.accepts</key> </item> </graph_item> <graph_item> <sortorder>1</sortorder> <drawtype>0</drawtype> <color>C80000</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>Template App NGINX</host> <key>nginx.handled</key> </item> </graph_item> <graph_item> <sortorder>2</sortorder> <drawtype>0</drawtype> <color>0000C8</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>Template App NGINX</host> <key>nginx.requests</key> </item> </graph_item> </graph_items> </graph> </graphs> </zabbix_export>