muninを使って、お名前.com VPSからRTXの監視をする

 お名前.com VPS(KVM)に入っているMuninを使って自宅のRTX1000の監視をしてみる。

1,RTX側のSNMP設定を行う
 基本

snmp host VPSのIPアドレス
snmp community read-only public
snmp yrifppdiplayatmib2 on

 更に、NATの外から来るのでスタティックを追加

nat descriptor masquerade static NATデスクリプタ番号 テーブル番号 RTXの内側アドレス udp snmp

 snmpポートのフィルタリングを追加

ip filter フィルタ番号 pass VPSのIPアドレス RTXの内側アドレス udp * snmp
ip filter フィルタ番号 restrict * RTXの内側アドレス udp * snmp

※VPSからのSNMP要求は通して、それ以外から来た物を捨てる。

2,VPS側でmunin設定を行う
 まずはmunin-nodeを設定

ln -s ‘/usr/share/munin/plugins/snmp__if_’ ‘/etc/munin/plugins/snmp_hoge.piyo.tld_if_1’
ln -s ‘/usr/share/munin/plugins/snmp__if_’ ‘/etc/munin/plugins/snmp_hoge.piyo.tld_if_3’
ln -s ‘/usr/share/munin/plugins/snmp__if_’ ‘/etc/munin/plugins/snmp_hoge.piyo.tld_if_5’
ln -s ‘/usr/share/munin/plugins/snmp__if_’ ‘/etc/munin/plugins/snmp_hoge.piyo.tld_if_6’
ln -s ‘/usr/share/munin/plugins/snmp__if_’ ‘/etc/munin/plugins/snmp_hoge.piyo.tld_if_35’
ln -s ‘/usr/share/munin/plugins/snmp__if_’ ‘/etc/munin/plugins/snmp_hoge.piyo.tld_if_91’
ln -s ‘/usr/share/munin/plugins/snmp__if_’ ‘/etc/munin/plugins/snmp_hoge.piyo.tld_if_92’
ln -s ‘/usr/share/munin/plugins/snmp__if_’ ‘/etc/munin/plugins/snmp_hoge.piyo.tld_if_93’

※hoge.piyo.tldはRTXのグローバルIPorホスト名
 ifはインターフェースの通信量表示、1~3番はLAN1~3でLAN2を使っていないので1と3、4番はBRIで未使用、5番からがPPで今回はPP01と02を監視、35番はRAS用のPP Anonymous、91番からがTUNNELで今回は01~03の対地を監視。
 後は、CPUとMEMを取得するプラグインをこちらのサイトから拝借して入れる ※念のためコピーを置いておく CPU MEM

cat > /etc/munin/plugins/snmp_hoge.piyo.tld_cpu
chmod 777 /etc/munin/plugins/snmp_hoge.piyo.tld_cpu
cat > /etc/munin/plugins/snmp_hoge.piyo.tld_mem
chmod 777 /etc/munin/plugins/snmp_hoge.piyo.tld_mem

 そして、SNMP設定を設定ファイルに記述

vim /etc/munin/plugin-conf.d/munin-node

[snmp_hoge.piyo.tld*]
env.version 1
env.community public
env.host hoge.piyo.tld

 出来たらmunin-nodeを再起動

/etc/init.d/munin-node restart

 このままではmunin-nodeが値を取ってきているけど表画面には出てこないので、表側の設定も追加

vim /etc/munin/munin.conf

[hoge.piyo.tld]
address 127.0.0.1
use_node_name no

※addressはmunin-nodeのアドレスなので、ローカル動作なら127.0.0.1。

 直ちに更新してみる場合は

sudo -u munin /usr/bin/munin-cron

 これで、muninのトップにhoge.piyo.tldのページが追加されていて、各インターフェースの通信量とCPU・メモリ状況が出るようになる。

(474)


カテゴリー: サーバ設定   パーマリンク

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です