Zabbix监控Bind(DNS)解析状态状态
分类:linux日期:2018-12-12 - 22:06:09作者:老谢
通过BIND内置的监控模块提供统计数据,需在named.conf加入以下行打开该功能:
statistics-channels { inet 127.0.0.1 port 8053 allow { 127.0.0.1; }; }; |
编辑/usr/local/zabbix/etc,加入:
UserParameter=bind.queries.in[*],curl http://127.0.0.1:8053/ 2>/dev/null | /usr/bin/xml2 | grep -A1 "/isc/bind/statistics/server/queries-in/rdtype/name=$1$" | tail -1 | cut -d= -f2 UserParameter=bind.queries.out[*],curl http://127.0.0.1:8053/ 2>/dev/null | /usr/bin/xml2 | grep -A1 "/isc/bind/statistics/views/view/rdtype/name=$1$" | tail -1 | cut -d= -f2 #注意,需要安装xml2,可以使用yum install xml2来安装 |
PS:折腾一圈发现,模板里没有包含OUT的监控,而且命令执行后OUT是空的,不太熟悉bind-statistics输出的内容,以后再研究吧……
在Zabbix中导入模板zbx_dns_templates.xml!
<?xml version="1.0" encoding="UTF-8"?> <zabbix_export> <version>2.0</version> <date>2015-06-14T15:27:40Z</date> <groups> <group> <name>App Templates</name> </group> <group> <name>Templates</name> </group> </groups> <templates> <template> <template>Template App DNS Server</template> <name>Template App DNS Server</name> <description/> <groups> <group> <name>App Templates</name> </group> <group> <name>Templates</name> </group> </groups> <applications> <application> <name>DNS</name> </application> </applications> <items> <item> <name>Queries in A</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>bind.queries.in[A]</key> <delay>120</delay> <history>30</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>2</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/> <inventory_link>0</inventory_link> <applications> <application> <name>DNS</name> </application> </applications> <valuemap/> <logtimefmt/> </item> <item> <name>Queries in AAAA</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>bind.queries.in[AAAA]</key> <delay>120</delay> <history>30</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>2</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/> <inventory_link>0</inventory_link> <applications> <application> <name>DNS</name> </application> </applications> <valuemap/> <logtimefmt/> </item> <item> <name>Queries in ANY</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>bind.queries.in[ANY]</key> <delay>120</delay> <history>30</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>2</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/> <inventory_link>0</inventory_link> <applications> <application> <name>DNS</name> </application> </applications> <valuemap/> <logtimefmt/> </item> <item> <name>Queries in CNAME</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>bind.queries.in[CNAME]</key> <delay>120</delay> <history>30</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>2</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/> <inventory_link>0</inventory_link> <applications> <application> <name>DNS</name> </application> </applications> <valuemap/> <logtimefmt/> </item> <item> <name>Queries in MX</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>bind.queries.in[MX]</key> <delay>120</delay> <history>30</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>2</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/> <inventory_link>0</inventory_link> <applications> <application> <name>DNS</name> </application> </applications> <valuemap/> <logtimefmt/> </item> <item> <name>Queries in NS</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>bind.queries.in[NS]</key> <delay>120</delay> <history>30</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>2</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/> <inventory_link>0</inventory_link> <applications> <application> <name>DNS</name> </application> </applications> <valuemap/> <logtimefmt/> </item> <item> <name>Queries in PTR</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>bind.queries.in[PTR]</key> <delay>120</delay> <history>30</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>2</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/> <inventory_link>0</inventory_link> <applications> <application> <name>DNS</name> </application> </applications> <valuemap/> <logtimefmt/> </item> <item> <name>Queries in SOA</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>bind.queries.in[SOA]</key> <delay>120</delay> <history>30</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>2</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/> <inventory_link>0</inventory_link> <applications> <application> <name>DNS</name> </application> </applications> <valuemap/> <logtimefmt/> </item> <item> <name>Queries in TXT</name> <type>0</type> <snmp_community/> <multiplier>0</multiplier> <snmp_oid/> <key>bind.queries.in[TXT]</key> <delay>120</delay> <history>30</history> <trends>365</trends> <status>0</status> <value_type>3</value_type> <allowed_hosts/> <units/> <delta>2</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/> <inventory_link>0</inventory_link> <applications> <application> <name>DNS</name> </application> </applications> <valuemap/> <logtimefmt/> </item> </items> <discovery_rules/> <macros/> <templates/> <screens/> </template> </templates> <graphs> <graph> <name>DNS Server:Queries IN</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 DNS Server</host> <key>bind.queries.in[A]</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 DNS Server</host> <key>bind.queries.in[AAAA]</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 DNS Server</host> <key>bind.queries.in[ANY]</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 DNS Server</host> <key>bind.queries.in[CNAME]</key> </item> </graph_item> <graph_item> <sortorder>4</sortorder> <drawtype>0</drawtype> <color>00C8C8</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>Template App DNS Server</host> <key>bind.queries.in[MX]</key> </item> </graph_item> <graph_item> <sortorder>5</sortorder> <drawtype>0</drawtype> <color>C8C800</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>Template App DNS Server</host> <key>bind.queries.in[NS]</key> </item> </graph_item> <graph_item> <sortorder>6</sortorder> <drawtype>0</drawtype> <color>C8C8C8</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>Template App DNS Server</host> <key>bind.queries.in[PTR]</key> </item> </graph_item> <graph_item> <sortorder>7</sortorder> <drawtype>0</drawtype> <color>009600</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>Template App DNS Server</host> <key>bind.queries.in[SOA]</key> </item> </graph_item> <graph_item> <sortorder>8</sortorder> <drawtype>0</drawtype> <color>960000</color> <yaxisside>0</yaxisside> <calc_fnc>2</calc_fnc> <type>0</type> <item> <host>Template App DNS Server</host> <key>bind.queries.in[TXT]</key> </item> </graph_item> </graph_items> </graph> </graphs> </zabbix_export> |
https://blog.hackroad.com/operations-engineer/operation-engineer-monitor/13148.html
暂时没有评论!