ウェブサイト検索

RHEL、CentOS、Fedora に Munin (ネットワーク監視) をインストールする


Munin (ネットワーク監視ツール) は、Perl で書かれたオープンソースの Web ベースのネットワーク監視アプリケーションで、サーバーとサービスのネットワーク使用状況をグラフ形式で表示します。 RRD ツールを使用します。 Munin を利用すると、システム、ネットワーク、SANS、アプリケーションのパフォーマンスを監視できます。

マスターが各ノードに定期的に接続し、そこからデータを取得するマスター/ ノード アーキテクチャを採用しています。次に、RRDtool を使用してログを記録し、更新されたグラフを生成します。

推奨読書: Linux のパフォーマンスを監視するための 20 のコマンド ライン ツール

この記事では、RHEL< の Munin ノードを使用して Munin ( ネットワーク監視ツール) をセットアップする手順を説明します。CentOSFedora システムでは、次の環境を使用します。


Munin Server - hostname: munin.linux-console.net and IP Address: 192.168.103
Munin Client - hostname: munin-node.linux-console.net and IP Address: 192.168.15

RHEL、CentOS、Fedora への Munin のインストール

Munin のインストールは非常に簡単です。以下のステップバイステップのコマンドに従ってサーバーにインストールするだけです。

ステップ 1: EPEL リポジトリをインストールする

Munin は、RHEL 7.x/ の FedoraEPEL リポジトリを使用してインストールできます。 6.x/5.x およびCentOS 7.x/6.x/5.x

root ユーザーとして次のコマンドを実行して、wget を使用してEpel リポジトリをインストールし、有効にするだけです。

RHEL/CentOS 7
------------------ RHEL/CentOS 7 - 64-Bit ------------------
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm
rpm -ivh epel-release-7-9.noarch.rpm
RHEL/CentOS 6
------------------ RHEL/CentOS 6 - 32-Bit ------------------
wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm

------------------ RHEL/CentOS 6 - 64-Bit ------------------
http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
RHEL/CentOS 5
------------------ RHEL/CentOS 5 - 32-Bit ------------------
wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -ivh epel-release-5-4.noarch.rpm

------------------ RHEL/CentOS 5 - 64-Bit ------------------
wget http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
rpm -ivh epel-release-5-4.noarch.rpm

: Fedora ユーザーは EPEL リポジトリをインストールする必要はありません。munin は Fedora に含まれており、 yum または dnf パッケージ マネージャーを使用してインストールできます。

推奨読書: Linux パッケージ管理を管理するための 20 の Yum コマンド

推奨読書: Fedora パッケージ管理を管理するための 27 の Dnf コマンド

次に、Munin をインストールする前に、システム アップデートを実行してEPEL パッケージ データベースがロードされていることを確認します。

------------------ On RHEL and CentOS Only ------------------
yum -y update

ステップ 2: Apache Web サーバーをインストールする

Munin は統計ファイルを表示するために、ApacheNginx などの動作する Web サーバーを必要とします。ここでは Munin グラフを提供するためにApache Web サーバーをインストールします。

------------------ On RHEL, CentOS and Fedora ------------------
yum install httpd

------------------ On Fedora 22+ Releases ------------------
dnf install httpd    

Apache をインストールしたら、サービスを開始し、システム起動時に自動的に開始されるように有効にします。

------------------ On RHEL, CentOS and Fedora ------------------
service httpd start
chkconfig --level 35 httpd on

------------------ On RHEL/CentOS 7 and Fedora 22+ ------------------
systemctl enable httpd
systemctl start httpd

ステップ 3: Munin と Munin-Node をインストールする

次に、 図に示すようにMuninMunin ノードをインストールします。

------------------ On RHEL, CentOS and Fedora ------------------
yum -y install munin munin-node

------------------ On Fedora 22+ Releases ------------------
dnf -y install munin munin-node

デフォルトでは、上記のインストールにより次のディレクトリが作成されます。

  1. /etc/munin/munin.conf : Munin マスター設定ファイル。
  2. /etc/cron.d/munin : Munin cron ファイル。
  3. /etc/httpd/conf.d/munin.conf : Munin Apache 設定ファイル。
  4. /var/log/munin : Munin のログ ディレクトリ。
  5. /var/www/html/munin : Munin Web ディレクトリ。
  6. /etc/munin/munin-node.conf : Munin ノードのマスター設定ファイル。
  7. /etc/munin/plugins.conf : Munin プラグイン設定ファイル。

ステップ 3: Munin を構成し、Munin をパスワードで保護する

このステップはオプションであり、次に示すように HTML 出力で localhost の代わりに munin.linux-console.net を使用する場合にのみ適用されます。

/etc/munin/munin.conf 構成ファイルを開き、提案に従って変更を加えます。munin.linux-console.net をサーバー名に置き換えることを忘れないでください。

a simple host tree
[munin.linux-console.net]
    address 127.0.0.1
    use_node_name yes
[...]

次に、次に示すように、Apache 基本認証モジュールを使用して、Munin 統計をユーザー名パスワードでパスワード保護します。

htpasswd /etc/munin/munin-htpasswd admin

次に Munin を再起動し、起動時に自動的に起動するようにします。

------------------ On RHEL, CentOS and Fedora ------------------
service munin-node start
chkconfig --level 35 munin-node on

------------------ On RHEL/CentOS 7 and Fedora 22+ ------------------
systemctl enable munin-node
systemctl start munin-node

ステップ 4: Munin Web インターフェイスにアクセスする

Munin がグラフを生成して表示できるようになるまで、30 分間待ちます。グラフの最初の出力を確認するには、ブラウザを開いて http://munin.linux-console.net/munin に移動し、ログイン資格情報を入力します。

ユーザー名パスワードの入力を求められなかった場合は、/etc/httpd/conf.d/munin.conf を開き、ユーザー名を次から変更します。 Muninadmin に変更し、Apache を再起動します。

AuthUserFile /etc/munin/munin-htpasswd
AuthName "admin"
AuthType Basic
require valid-user

ステップ 5: Linux クライアントを Munin サーバーに追加する

Linux クライアント マシンにログインし、次のように munin-node パッケージのみをインストールします。


yum install munin-node
dnf install munin-node      [On Fedora 22+ versions]
apt-get install munin-node  [On Debian based systems]

次に、/etc/munin/munin-node.conf 構成ファイルを開き、munin サーバーの IP アドレスを追加して、クライアントからのデータのフェッチを有効にします。


vi /etc/munin/munin-node.conf

Munin サーバーの IP アドレスを次の形式で追加します。


A list of addresses that are allowed to connect.  

allow ^127\.0\.0\.1$
allow ^::1$
allow ^192\.168\.0\.103$

最後に、munin クライアントを再起動します。

------------------ On RHEL, CentOS and Fedora ------------------
service munin-node start
chkconfig --level 35 munin-node on

------------------ On RHEL/CentOS 7 and Fedora 22+ ------------------
systemctl enable munin-node
systemctl start munin-node

ステップ 6: Munin サーバーを構成してクライアント ノードに接続する

/etc/munin/munin.conf 構成ファイルを開き、次に示すようにサーバー名と IP アドレスを含むリモート Linux クライアント ノードの新しいセクションを追加します。


a simple host tree
[munin.linux-console.net]
    address 127.0.0.1
    use_node_name yes

[munin-node.linux-console.net]
    address 192.168.0.15
    use_node_name yes

次に、munin サーバーを再起動し、http://munin.linux-console.net/munin ページに移動して、新しいクライアント ノード グラフが動作していることを確認します。

詳細と使用方法については、http://munin-monitoring.org/wiki/Documentation を参照してください。