5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Munin を Docker コンテナにインストール

Last updated at Posted at 2016-11-10

Munin を Docker コンテナにインストール

目的

  • munin の評価(個人的)
    • MRTG, Zabbix つかったことある
    • sensu も興味あるがそれほど大規模なものは今は想定していないので後日

対象

  • 監視ツールに興味がある
  • 監視ツールが好き
  • グラフ見るのが好き

システム

リファレンス

構築

1. コンテナ建造

root# docker pull ubuntu:latest

root# docker run \
-itd --name munin-server01 \
-p 0.0.0.0:8080:80 \
-p 0.0.0.0:4948:4948 \
--network=isolated_nw \
-t ubuntu:latest /bin/bash

root# docker attach munin-server01

[root@5e4d20afb75f /]# dpkg-reconfigure tzdata
[root@5e4d20afb75f /]# apt-get -y update ; apt-get -y upgrade

[root@5e4d20afb75f /]# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.1 LTS"

2. munin インストール(監視サーバ on コンテナ)

[root@5e4d20afb75f /]# apt-get -y install apache2
[root@5e4d20afb75f /]# apt-get -y install munin vim

[root@5e4d20afb75f /]# vi /etc/munin/munin.conf

add lines

### docker host
[fs1]
    address 192.168.100.5
    use_node_name yes

[root@5e4d20afb75f /]# vi /etc/apache2/conf-enabled/security.conf

ServerTokens Prod

[root@5e4d20afb75f /]# vi /etc/apache2/apache2.conf

ServerName www.munin-server.com

[root@5e4d20afb75f /]# vi /etc/apache2/conf-enabled/munin.conf

### add LAN Segments
Require ip 192.168.100.0/24

[root@5e4d20afb75f /]# service cron start
[root@5e4d20afb75f /]# /etc/init.d/munin start 
[root@5e4d20afb75f /]# service apache2 start

3. munin-node インストール(Docker Host on ubuntu)

# apt-get install munin-node
  • munin サーバのIP確認
# docker network inspect isolated_nw | jq .[].Containers
(snip)
    "IPv4Address": "172.19.0.3/16",
# vi /etc/munin/munin-node.conf

(edit)

host_name fs1
allow ^172\.19\.0\.3$
# service munin-node restart

4. Web ブラウザからのアクセス

  • 5分以上待ちましょう(/etc/cron.d/munin)

  • LAN 側の 8080 にマップしたので Docker ホストIP の 8080 にブラウザでアクセス

  • 以下の表示が出ていたら成功

Screenshot 2016-11-11 03.11.21.png

5. おわり

additional memo

  • add snmp plugin
# munin-node-configure --shell --snmp 192.168.100.203 \
--snmpversion 2c --snmpcommunity public

ln -s '/usr/share/munin/plugins/snmp__if_' '/etc/munin/plugins/snmp_192.168.100.203_if_1'
ln -s '/usr/share/munin/plugins/snmp__if_' '/etc/munin/plugins/snmp_192.168.100.203_if_10119'
ln -s '/usr/share/munin/plugins/snmp__if_' '/etc/munin/plugins/snmp_192.168.100.203_if_10124'
ln -s '/usr/share/munin/plugins/snmp__if_err_' '/etc/munin/plugins/snmp_192.168.100.203_if_err_1'
ln -s '/usr/share/munin/plugins/snmp__if_err_' '/etc/munin/plugins/snmp_192.168.100.203_if_err_10119'
ln -s '/usr/share/munin/plugins/snmp__if_err_' '/etc/munin/plugins/snmp_192.168.100.203_if_err_10124'
ln -s '/usr/share/munin/plugins/snmp__if_multi' '/etc/munin/plugins/snmp_192.168.100.203_if_multi'
ln -s '/usr/share/munin/plugins/snmp__uptime' '/etc/munin/plugins/snmp_192.168.100.203_uptime'
# munin-node-configure --shell --snmp 192.168.100.203 \
--snmpversion 2c --snmpcommunity public | sh
5
3
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
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?