LoginSignup
5
9

More than 5 years have passed since last update.

muninでMIB値監視

Last updated at Posted at 2016-01-19

munin
* ubuntu 16.04で実施

参考

インストール

apt-get install -y \
  munin munin-node munin-plugins-extra
  • munin : Webインターフェース
  • munin-node : モニタリングデーモン
  • munin-plugins-extra : 拡張プラグイン
/etc/munin/munin.conf
- #htmldir /var/cache/munin/www
+ htmldir /var/cache/munin/www

- [localhost.localdomain]
+ [myserver.home]
  • muninに登録されるサーバ名を指定。
/etc/munin/apache24.conf
 <Location /munin-cgi/munin-cgi-graph>
-        Require local
+        Require ip local 192.168.0
  • 自分自身と192.168.0.0/24からのアクセスを許可

リスタート

sudo service munin-node restart
sudo service apache2 restart

アクセス

munin1.jpg


SNMPから監視

root権限で実行
munin-node-configure \
  --snmp 192.168.0.19 \
  --snmpversion 2 \
  --snmpcommunity \
  public
設定可能なシンボリックリンク一覧を表示
munin-node-configure \
  --snmp 192.168.0.19 \
  --snmpversion 2 \
  --snmpcommunity \
  public \
  --shell sh

ln -s '/usr/share/munin/plugins/snmp__cpuload' '/etc/munin/plugins/snmp_192.168.0.19_cpuload'

のようにシンボリックリンクを貼るコマンド一覧が表示される。
使うもののみ手でリンクを貼る。

ノード追加

/etc/munin/plugin-conf.d/munin-node
[snmp_192.168.0.19_*]
env.version 2
env.community public
/etc/munin/munin-conf.d
[192.168.0.19]
    address 127.0.0.1
  • address 127.0.0.1決め打ち。(対象のIPを記述するのではないことに注意)
今すぐ更新
sudo -u munin /usr/bin/munin-cron
nodes確認
  $ telnet localhost 4949
  nodes
  localhost.localdomain
+ 192.168.0.19
  • ブラウザで確認

カスタムproc値取得

cd /usr/share/munin/plugins
cp -a snmp__processes snmp__processes_apache2
/usr/share/munin/plugins/snmp__processes_apache2
-         print "require 1.3.6.1.2.1.25.1.6.0 [0-9]\n";
+         print "require 1.3.6.1.4.1.2021.2.1.5.4 [0-9]\n";
...
- graph_category system
+ graph_category proc_apache2
...
- print "processes.value ", $session->get_single('1.3.6.1.2.1.25.1.6.0'), "\n";
+ print "processes.value ", $session->get_single('1.3.6.1.4.1.2021.2.1.5.4'), "\n";
有効化
$ sudo munin-node-configure --snmp 192.168.0.19 \
  --snmpversion 1 --snmpcommunity public --suggest | grep proc
snmp__processes            | yes  | yes (192.168.0.19)
snmp__processes_apache2    | no   | yes (+192.168.0.19)
$ sudo ln -s '/usr/share/munin/plugins/snmp__processes_apache2' \
  '/etc/munin/plugins/snmp_192.168.0.19_processes_apache2'
$ sudo service munin-nodes restart
$ sudo -u munin /usr/bin/munin-cron

トラブルシューティング

手動でsnmp取得
sudo munin-run snmp_192.168.0.19_uptime
5
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
9