mkdir -p /var/cache/bind touch /var/cache/bind/stats chown -R named:named /var/cache/bind vi /etc/named.conf
: options { ... statistics-file "/var/cache/bind/stats"; zone-statistics yes; ... }; :
重新啟動 named
systemctl restart named
rndc stats && cat /var/cache/bind/stats
如果正確, 應該會出現類似以下訊息
+++ Statistics Dump +++ (1594029813) ++ Incoming Requests ++ 392 QUERY ++ Incoming Queries ++ 122 A 4 MX 99 TXT 167 AAAA ++ Outgoing Rcodes ++ 392 NOERROR ++ Outgoing Queries ++ [View: internal] 531 A : : [8.B.D.0.1.0.0.2.IP6.ARPA (view: external)] [EMPTY.AS112.ARPA (view: external)] [HOME.ARPA (view: external)] [version.bind (view: _bind)] [hostname.bind (view: _bind)] [authors.bind (view: _bind)] [id.server (view: _bind)] --- Statistics Dump --- (1594029813)
yum install epel-release yum install perl-File-ReadBackwards wget https://github.com/librenms/librenms-agent/raw/master/snmp/bind -O /etc/snmp/bind chmod +x /etc/snmp/bind /etc/snmp/bind
執行後如果正確, 會出現類似以下訊息:
1062,1492,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23,0,7,0,0,0,15,0,0,0,0,0,0,0,0,0,0,111,0,0,0,0,0,0,3 1148,799,0,0,0,0,0,0,0,0,0,60,177,0,0,0,0,7,0,12,0,0,0,4,0,0,0,0,0,0,0,0,0,0,171,0,0,0,0,0,0,3 2713,0,97,23,0,0,2713,24,97,1204,2215,498,1431,0,78,380,0,0,2690,23,0,0 610,1771,596,1748,59,3,0,1,278,0,390,38,322,328,1,113,388,1114,796,45,0,0,1569,0 14523,52,1399,1214,0,53,1787,1167,1928867,1068675,1068971,1032192,248832,248832 1259,749,0,0,0,0,0,0,56,0,0,32,51,0,0,0,0,5,0,305,8,0,0,1,218,0,0,0,0,0,0,0,0,0,76,0,0,26,0,0,0,0,0,0,115,0,0,0,0,0,0,0,0,0,0,120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3 3063,1895,3063,1323 529,1577,86,196,1,527,1577,107,195,0,0,1,0,0,0,0,0,527,78,1576,193,25,0,0,0,0,0,1,0,0,0,2,0,4,1,1
vi /etc/snmp/snmpd.conf
: extend bind /etc/snmp/bind
重新啟動 snmpd
systemctl restart snmpd