Zabbix系列之五——监控TCP端口
Posted dev0ps
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Zabbix系列之五——监控TCP端口相关的知识,希望对你有一定的参考价值。
模板如下,可根据需求修改端口及触发器名称:
<?xml version="1.0" encoding="UTF-8"?> <zabbix_export> <version>3.4</version> <date>2018-06-19T06:10:48Z</date> <groups> <group> <name>Tcp Port</name> </group> </groups> <templates> <template> <template>Template Tcp Port 4234</template> <name>Template Tcp Port 4234</name> <description/> <groups> <group> <name>Tcp Port</name> </group> </groups> <applications> <application> <name>Tcp Port Monitor</name> </application> </applications> <items> <item> <name>tcp port 4234 is listen</name> <type>0</type> <snmp_community/> <snmp_oid/> <key>net.tcp.listen[4234]</key> <delay>30s</delay> <history>90d</history> <trends>365d</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <params/> <ipmi_sensor/> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description/> <inventory_link>0</inventory_link> <applications> <application> <name>Tcp Port Monitor</name> </application> </applications> <valuemap/> <logtimefmt/> <preprocessing/> <jmx_endpoint/> <master_item/> </item> <item> <name>tcp port 4234 is connection</name> <type>0</type> <snmp_community/> <snmp_oid/> <key>net.tcp.port[,4234]</key> <delay>30s</delay> <history>90d</history> <trends>365d</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <params/> <ipmi_sensor/> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description/> <inventory_link>0</inventory_link> <applications> <application> <name>Tcp Port Monitor</name> </application> </applications> <valuemap/> <logtimefmt/> <preprocessing/> <jmx_endpoint/> <master_item/> </item> <item> <name>tcp port 4234 performance</name> <type>0</type> <snmp_community/> <snmp_oid/> <key>net.tcp.service.perf[http,,4234]</key> <delay>30s</delay> <history>90d</history> <trends>365d</trends> <status>0</status> <value_type>0</value_type> <allowed_hosts/> <units/> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <params/> <ipmi_sensor/> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description/> <inventory_link>0</inventory_link> <applications> <application> <name>Tcp Port Monitor</name> </application> </applications> <valuemap/> <logtimefmt/> <preprocessing/> <jmx_endpoint/> <master_item/> </item> <item> <name>tcp port 4234 is running</name> <type>0</type> <snmp_community/> <snmp_oid/> <key>net.tcp.service[http,,4234]</key> <delay>30s</delay> <history>90d</history> <trends>365d</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <snmpv3_contextname/> <snmpv3_securityname/> <snmpv3_securitylevel>0</snmpv3_securitylevel> <snmpv3_authprotocol>0</snmpv3_authprotocol> <snmpv3_authpassphrase/> <snmpv3_privprotocol>0</snmpv3_privprotocol> <snmpv3_privpassphrase/> <params/> <ipmi_sensor/> <authtype>0</authtype> <username/> <password/> <publickey/> <privatekey/> <port/> <description/> <inventory_link>0</inventory_link> <applications> <application> <name>Tcp Port Monitor</name> </application> </applications> <valuemap/> <logtimefmt/> <preprocessing/> <jmx_endpoint/> <master_item/> </item> </items> <discovery_rules/> <httptests/> <macros/> <templates/> <screens/> </template> </templates> <triggers> <trigger> <expression>{Template Tcp Port 4234:net.tcp.listen[4234].last()}=0</expression> <recovery_mode>0</recovery_mode> <recovery_expression/> <name>tcp port 4234(Paypre) is down</name> <correlation_mode>0</correlation_mode> <correlation_tag/> <url/> <status>0</status> <priority>5</priority> <description/> <type>0</type> <manual_close>0</manual_close> <dependencies/> <tags/> </trigger> </triggers> <graphs> <graph> <name>tcp port 4234</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>1A7C11</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>Template Tcp Port 4234</host> <key>net.tcp.port[,4234]</key> </item> </graph_item> <graph_item> <sortorder>1</sortorder> <drawtype>0</drawtype> <color>F63100</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>Template Tcp Port 4234</host> <key>net.tcp.listen[4234]</key> </item> </graph_item> <graph_item> <sortorder>2</sortorder> <drawtype>0</drawtype> <color>2774A4</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>Template Tcp Port 4234</host> <key>net.tcp.service[http,,4234]</key> </item> </graph_item> <graph_item> <sortorder>3</sortorder> <drawtype>0</drawtype> <color>A54F10</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>Template Tcp Port 4234</host> <key>net.tcp.service.perf[http,,4234]</key> </item> </graph_item> </graph_items> </graph> </graphs> </zabbix_export>
导入模板:
【配置】——【模板】——【导入】
进入模板添加主机:
设置被监控主机:
查看效果:
以上是关于Zabbix系列之五——监控TCP端口的主要内容,如果未能解决你的问题,请参考以下文章