Muninは、デフォルトの監視項目以外に「プラグイン」で監視したい項目を増やすことができます。代表的なモジュール「unbound」を監視項目に追加してみます。(2015/05/24作成)
caro_oe92 / Pixabay
1.ダウンロード&展開
unbound の「munin plugin」は、unbound のソースパッケージの中に含まれています。unbound のソースをダウンロードして、プラグラインを取り出します。
http://unbound.net/download.html
$ wget http://unbound.net/downloads/unbound-1.5.3.tar.gz $ tar zxvf unbound-1.5.3.tar.gz unbound-1.5.3/contrib/unbound_munin_ $ cd unbound-1.5.3/contrib $ sudo cp unbound_munin_ /usr/share/munin/plugins/ $ sudo chown root:root /usr/share/munin/plugins/unbound_munin_ $ sudo chmod 755 /usr/share/munin/plugins/unbound_munin_
2.unbound.conf ファイルを修正
$ sudo v /etc/unbound/unbound.conf server: statistics-interval: 0 extended-statistics: yes statistics-cumulative: no remote-control: control-enable: yes control-interface: 127.0.0.1
3.unbound-control で通信用に利用する鍵の作成
$ sudo /usr/sbin/unbound-control-setup setup in directory /etc/unbound unbound_server.key exists unbound_control.key exists create unbound_server.pem (self signed certificate) create unbound_control.pem (signed client certificate) Signature ok subject=/CN=unbound-control Getting CA Private Key Setup success. Certificates created. Enable in unbound.conf file to use
4.unbound plugin 設定の追加
$ sudo vi /etc/munin/plugin-conf.d/munin-node [unbound*] user root env.statefile /var/lib/munin-node/plugin-state/munin/unbound-state env.unbound_conf /etc/unbound/unbound.conf env.unbound_control /usr/sbin/unbound-control env.spoof_warn 1000 env.spoof_crit 100000
5.munin-node へ unbound plugin を登録
(下記の対策) /etc/munin/plugins/unbound_munin_queue: line 153: /var/lib/munin-node/plugin-state/munin/unbound-state.lock: No such file or directory $ sudo mkdir /var/lib/munin-node/plugin-state/munin $ sudo ln -s /usr/share/munin/plugins/unbound_munin_ /etc/munin/plugins/unbound_munin_by_class $ sudo ln -s /usr/share/munin/plugins/unbound_munin_ /etc/munin/plugins/unbound_munin_by_flags $ sudo ln -s /usr/share/munin/plugins/unbound_munin_ /etc/munin/plugins/unbound_munin_by_opcode $ sudo ln -s /usr/share/munin/plugins/unbound_munin_ /etc/munin/plugins/unbound_munin_by_rcode $ sudo ln -s /usr/share/munin/plugins/unbound_munin_ /etc/munin/plugins/unbound_munin_by_type $ sudo ln -s /usr/share/munin/plugins/unbound_munin_ /etc/munin/plugins/unbound_munin_histogram $ sudo ln -s /usr/share/munin/plugins/unbound_munin_ /etc/munin/plugins/unbound_munin_hits $ sudo ln -s /usr/share/munin/plugins/unbound_munin_ /etc/munin/plugins/unbound_munin_memory $ sudo ln -s /usr/share/munin/plugins/unbound_munin_ /etc/munin/plugins/unbound_munin_queue
6.動作確認
$ sudo /usr/sbin/munin-run --debug unbound_munin_queue # Processing plugin configuration from /etc/munin/plugin-conf.d/amavis # Processing plugin configuration from /etc/munin/plugin-conf.d/df # Processing plugin configuration from /etc/munin/plugin-conf.d/fw_ # Processing plugin configuration from /etc/munin/plugin-conf.d/hddtemp_smartctl # Processing plugin configuration from /etc/munin/plugin-conf.d/munin-node # Processing plugin configuration from /etc/munin/plugin-conf.d/postfix # Processing plugin configuration from /etc/munin/plugin-conf.d/sendmail # Setting /rgid/ruid/ to /99/0/ # Setting /egid/euid/ to /99 99/0/ # Setting up environment # Environment unbound_conf = /etc/unbound/unbound.conf # Environment unbound_control = /usr/sbin/unbound-control # Environment spoof_warn = 1000 # Environment spoof_crit = 100000 # Environment statefile = /var/lib/munin-node/plugin-state/munin/unbound-state # About to run '/etc/munin/plugins/unbound_munin_queue' t_ql_avg.value 0 t_ql_max.value 0 t_ql_overwritten.value 0 t_ql_exceeded.value 0
7.設定反映
$ sudo /etc/init.d/unbound restart $ sudo /etc/init.d/munin-node restart
以上