跳到主內容

BIND(Named) Agent 服務

  記錄 BIND(Named) 設定方式

  • 在 Bind 主機上新增一個目錄
mkdir -p /var/cache/bind
  • 給予這個新建置的目錄權限
touch /var/cache/bind/stats
chown bind:bind /var/cache/bind/stats
  • 在進到 Bind 設定檔 vim /etc/named.conf 在這裡指向剛剛建立的目錄及全域進行統計
options {
    ...
    statistics-file "/var/cache/bind/stats";
    zone-statistics yes;
    ...
};
  • 重啟 Bind 服務
systemctl restart named
  • 測試是否可以查檢狀態
rndc stats && cat /var/cache/bind/stats

執行成功會看到下面的數值

+++ Statistics Dump +++ (163)
++ Incoming Requests ++
                  49 QUERY
++ Incoming Queries ++
                  26 A
                   1 PTR
                  16 AAAA
                   6 TYPE65
++ Outgoing Rcodes ++
                  48 NOERROR
                   1 SERVFAIL
++ Outgoing Queries ++
[View: default]
                   2 NS
                   4 DNSKEY
:
:
[8.B.D.0.1.0.0.2.IP6.ARPA]
[EMPTY.AS112.ARPA]
[HOME.ARPA]
[version.bind (view: _bind)]
[hostname.bind (view: _bind)]
[authors.bind (view: _bind)]
[id.server (view: _bind)]
--- Statistics Dump --- (163)
  • 安裝 Bind agent CentOS
yum install perl-File-ReadBackwards
wget https://github.com/librenms/librenms-agent/raw/master/snmp/bind -O /etc/snmp/bind
  • 給予剛下載好的 Agent 有執行權限
chmod +x /etc/snmp/bind
  • 測試是否可以正常執行 /etc/snmp/bind ,執行結果如下:
204,158,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
24,17,0,0,0,0,0,0,0,0,0,13,29,0,0,0,0,0,0,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
380,0,316,0,0,0,380,0,316,228,338,41,144,1,7,35,0,0,379,0,0,0
96,0,96,0,0,0,0,0,4,0,4,0,0,0,0,0,51,37,8,0,0,0,1046,0
1151,27,8,405,0,0,55,128,574816,113912,114408,655360,133120,133120
21,3,0,0,0,0,0,0,4,0,0,10,9,0,0,0,0,0,0,1,3,0,0,0,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2042,32,2042,16
103,3,8,2,1,94,0,5,0,0,0,0,0,0,0,0,0,92,4,0,0,2,0,0,0,0,0,0,0,0,0,9,3,5,2,1
  • 修改 snmp 設定 vim /etc/snmp/snmpd.conf
# 新增加這一條
extend bind /etc/snmp/bind
  • 重啟 snmp 服務
systemctl restart snmpd

參考相關網站