- 追加された行はこの色です。
- 削除された行はこの色です。
#author("2017-01-11T01:29:37+09:00","Group2","Group2")
#author("2020-05-18T03:23:11+00:00","","")
[[hidekiwiki]]
#html{{
<meta name="description" content="http://fukumoto-tech.serveblog.net/wiki/" />
<meta name="description" content="https://fukumoto.tokyo/wiki/" />
<meta name="keywords" content="普通人間製作所,world fukumoto-tech ,fukumototech,普通人間,KVM,kvm,ゲスト,仮想,バーチャル,仮想化,完全,munin,リソース監視,Munin,インストール,設定,まとめ,centos,red-hat,Red-Hat,監視ツール,windows,plugin,追加,設定,Centos,RedHat,apache,CPU,グラフ,4949,windows,plugin,インストール,設定,インストール,plugin追加,サーバ,RPMForge,yum,接続数,apache,メモリ" /
<link rel="canonical" href="http://fukumoto-tech.serveblog.net/wiki/" />
<link rel="canonical" href="https://fukumoto.tokyo/wiki/" />
<br>
<!-- admax -->
<script src="http://adm.shinobi.jp/s/1a0429ab1f292195e9a461469817a0ca"></script>
<!-- admax -->
</html>
}}
*muninを利用し、複数台のサーバを監視する方法 [#z6e0f776]
□munin-server側の環境
OS :CentOS release 5.7
IPアドレス :192.168.3.99
ホスト名 :namesever.com
■node(監視対象サーバ)の環境下
OS : CentOS release 6.2 (Final)
IPアドレス : 192.168.3.100
ホスト名 :namesever.com
**前提条件 [#u883b339]
※muninを動作させるには、収集サーバ側にはapacheがインストールされていることが条件となります。
エージェントのみ動作させる場合は、apacheはいりません
MRTGよりも比較的に簡単にインストールや設定ができて、 ネットワークトラヒックやシステムの状態などを監視することができるアプリケーションです。
**■まず、munin-node側の設定。 [#r86942bf]
Fedoraプロジェクトが提供するRHEL用にビルドされたスペシャルパッケージを 配布するEPELも追加します。
◇yum レポジトリ追加
wget http://ftp.riken.jp/Linux/fedora/epel/RPM-GPG-KEY-EPEL-6
rpm --import RPM-GPG-KEY-EPEL-6
rm -f RPM-GPG-KEY-EPEL-6
vi /etc/yum.repos.d/epel.repo
# 以下の内容で新規作成
[epel]
name=EPEL RPM Repository for Red Hat Enterprise Linux
baseurl=http://ftp.riken.jp/Linux/fedora/epel/6/$basearch/
gpgcheck=1
enabled=0
# 他リポジトリとのパッケージの競合をさけるため、enabled=0 として普段は読まないようにしておく
# 上記リポジトリを使用してインストールする場合は、以下のようにコマンド入力
インストール前に、念のためパッケージを確認。
yum list --enablerepo=epel | grep "munin-node"
以下でインストール。
yum --enablerepo=epel -y install munin-node
依存関係で以下パッケージが、インストールされます。
======================================================================================================================= ======================================
Package Arch Version Repository Size
======================================================================================================================= ======================================
Installing:
munin-node noarch 1.4.6-4.el6.2 epel 372 k
Installing for dependencies:
munin-common noarch 1.4.6-4.el6.2 epel 68 k
perl-Crypt-DES x86_64 2.05-9.el6 epel 19 k
perl-Digest-HMAC noarch 1.01-22.el6 base 22 k
perl-Digest-SHA1 x86_64 2.12-2.el6 base 49 k
perl-IO-Multiplex noarch 1.13-1.el6 epel 24 k
perl-Net-SNMP noarch 5.2.0-4.el6 epel 100 k
perl-Net-Server noarch 0.97-7.el6 epel 142 k
sysstat x86_64 9.0.4-18.el6 base 224 k
自動起動の設定がされていないため、以下自動起動を設定
chkconfig --list | grep munin
munin-node 0:off 1:off 2:off 3:off 4:off 5:off 6:off
自動起動設定
chkconfig munin-node on
自動起動設定を確認
chkconfig --list | grep munin
munin-node 0:off 1:off 2:on 3:on 4:on 5:on 6:off
■node(監視対象サーバ)側サーバ側
/etc/munin/munin-node.conf
host_name namesever.com
allow ^192\.168\.3\.100$
保存後、以下で起動
/etc/init.d/munin-node start
□munin-server側サーバ側(muninのパッケージ)が必要になります。
パッケージのインストール。
yum -y install munin
インストール後、/etc/munin/munin.confファイルに以下内容を追記。
[namesever.com] ####適宜変更してください#######
address 192.168.3.100 #### node(監視対象サーバ)側のIPアドレス※環境に合わせて変更してください####
use_node_name yes
/etc/munin/munin-node.conf
allow ^192\.168\.3\.99$
保存後、以下で起動。
/etc/init.d/munin-node start
自動起動の設定がされていないため、以下自動起動を設定
chkconfig --list | grep munin
munin-node 0:off 1:off 2:off 3:off 4:off 5:off 6:off
自動起動設定
chkconfig munin-node on
自動起動設定を確認
chkconfig --list | grep munin
munin-node 0:off 1:off 2:on 3:on 4:on 5:on 6:off
**yumでインストールすると、Apache用の設定ファイルである 「/etc/httpd/conf.d/munin.conf」 が自動的に作成されます。 [#af85a2c6]
**アクセス制限をしたい場合は、変更してください。(httpのアクセスの場合) [#a910e8f8]
#ScriptAlias /munin/ /var/www/munin/
<Directory /var/www/munin/>
order deny,allow
allow from 192.168.3.100
allow from 192.168.3.99
deny from all
</Directory>
アクセス制限を設定した場合は、以下にてWebサーバの再起動が必要です。
/etc/rc.d/init.d/httpd restart
また、私の環境下では、/etc/cron.d/muninにCronのファイルがあり、
#
# cron-jobs for munin
#
#MAILTO=root
*/5 * * * * munin test -x /usr/bin/munin-cron && /usr/bin/munin-cron
のように記載があります。root宛のメールがいらないので、以下のようにしました。
*/5 * * * * munin test -x /usr/bin/munin-cron && /usr/bin/munin-cron > /dev/null
**動作確認
ブラウザに以下URLを入力し、アクセスし動作確認。標準だと5分に一回グラフが取得できます。
http://[サーバのIP]/munin/
正常に取得できた場合は、以下のようになります。
http://fukumoto-tech.serveblog.net/gazou/Munin.JPG
https://fukumoto.tokyo/gazou/Munin.JPG