Google Bookmarksに追加 Twitterに投稿 はてなブックマークに追加 Yahoo!ブックマークに追加

目次 >> Ganglia

Gangliaによる計算機クラスターの状態監視

Ganglia(ガングリア)は複数の計算機の状態をウェブ上で簡単に確認できるソフトウェアである。Gangliaのインストール方法について述べる。

必要となるのは、rrdtool、ganglia-monitor、gmetad、ganglia-webfrontendである。そのうち、rrdtool、ganglia-monitorはクラスタの全ノードにインストールする必要がある。

注:もし、1台のみしか状態を監視しないのであれば、MRTGの方が簡単かもしれない。

Gangliaのインストール ubuntu 10.04編

rrdtool

各種データを集めるrrdtoolをインストールする。これは各ノードすべてのインストールする。

$ sudo apt-get install rrdtool
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-2.6.32-21-generic linux-headers-2.6.32-21
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
librrd4 ttf-dejavu ttf-dejavu-extra
Suggested packages:
librrds-perl
The following NEW packages will be installed:
librrd4 rrdtool ttf-dejavu ttf-dejavu-extra
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 3683kB of archives.
After this operation, 7401kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ lucid/main librrd4 1.3.8-1ubuntu1 [220kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ lucid/main ttf-dejavu-extra 2.30-2 [3107kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ lucid/main ttf-dejavu 2.30-2 [3164B]
Get:4 http://us.archive.ubuntu.com/ubuntu/ lucid/main rrdtool 1.3.8-1ubuntu1 [353kB]
Fetched 3683kB in 2s (1291kB/s)
Selecting previously deselected package librrd4.
(Reading database ... 144722 files and directories currently installed.)
Unpacking librrd4 (from .../librrd4_1.3.8-1ubuntu1_amd64.deb) ...
Selecting previously deselected package ttf-dejavu-extra.
Unpacking ttf-dejavu-extra (from .../ttf-dejavu-extra_2.30-2_all.deb) ...
Selecting previously deselected package ttf-dejavu.
Unpacking ttf-dejavu (from .../ttf-dejavu_2.30-2_all.deb) ...
Selecting previously deselected package rrdtool.
Unpacking rrdtool (from .../rrdtool_1.3.8-1ubuntu1_amd64.deb) ...
Processing triggers for fontconfig ...
Processing triggers for man-db ...
Setting up librrd4 (1.3.8-1ubuntu1) ...

Setting up ttf-dejavu-extra (2.30-2) ...
Setting up ttf-dejavu (2.30-2) ...
Setting up rrdtool (1.3.8-1ubuntu1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

ganglia-monitor

これはgmetadから要求があった際にXMLデータを送る役割をする。すべてのノードにインストールする。

$ sudo apt-get install ganglia-monitor
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-2.6.32-21-generic linux-headers-2.6.32-21
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
libapr1 libconfuse0 libganglia1
The following NEW packages will be installed:
ganglia-monitor libapr1 libconfuse0 libganglia1
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 346kB of archives.
After this operation, 1634kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ lucid/main libapr1 1.3.8-1build1 [123kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ lucid/universe libconfuse0 2.6-2 [27.4kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ lucid/universe libganglia1 3.1.2-2.1 [139kB]
Get:4 http://us.archive.ubuntu.com/ubuntu/ lucid/universe ganglia-monitor 3.1.2-2.1 [56.4kB]
Fetched 346kB in 1s (197kB/s)
Selecting previously deselected package libapr1.
(Reading database ... 144843 files and directories currently installed.)
Unpacking libapr1 (from .../libapr1_1.3.8-1build1_amd64.deb) ...
Selecting previously deselected package libconfuse0.
Unpacking libconfuse0 (from .../libconfuse0_2.6-2_amd64.deb) ...
Selecting previously deselected package libganglia1.
Unpacking libganglia1 (from .../libganglia1_3.1.2-2.1_amd64.deb) ...
Selecting previously deselected package ganglia-monitor.
Unpacking ganglia-monitor (from .../ganglia-monitor_3.1.2-2.1_amd64.deb) ...
Processing triggers for ureadahead ...
ureadahead will be reprofiled on next reboot
Processing triggers for man-db ...
Setting up libapr1 (1.3.8-1build1) ...

Setting up libconfuse0 (2.6-2) ...

Setting up libganglia1 (3.1.2-2.1) ...

Setting up ganglia-monitor (3.1.2-2.1) ...
Adding group: ganglia.
Adding group `ganglia' (GID 123) ...
Done.
Adding system user: ganglia.
Adding system user `ganglia' (UID 116) ...
Adding new user `ganglia' (UID 116) with group `ganglia' ...
Creating home directory `/var/lib/ganglia' ...
usermod: no changes
usermod: no changes
usermod: no changes
Starting Ganglia Monitor Daemon: gmond.

Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

起動するには、

$ sudo /etc/init.d/ganglia-monitor start

sysv-rc-confで見ると、ganglia-monitorが自動的に起動するようになっている。

gmond.confも/etc/に自動的に作成されている。

gmetad

さらにgmetad。これはapacheの動いている、データを表示するコンピュータにのみインストールすればよい。

$ sudo apt-get install gmetad
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
ganglia-webfrontend
The following NEW packages will be installed:
gmetad
0 upgraded, 1 newly installed, 0 to remove and 12 not upgraded.
Need to get 109kB of archives.
After this operation, 348kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com jaunty/universe gmetad 2.5.7-5 [109kB]
Fetched 109kB in 1s (103kB/s)
Selecting previously deselected package gmetad.
(Reading database ... 107781 files and directories currently installed.)
Unpacking gmetad (from .../gmetad_2.5.7-5_amd64.deb) ...
Processing triggers for man-db ...
Setting up gmetad (2.5.7-5) ...
Starting Ganglia Monitor Meta-Daemon: gmetad.

起動するには、

$ sudo /etc/init.d/gmetad start

sysv-rc-confで見ると、gmetadが自動的に起動するようになっている。

次のコマンドで、xmlデータが表示されるはずである。

$ telnet localhost 8649

なお、複数のコンピュータのデータを収集するには、/etc/ganglia/gmetad.conf(/etc/gmetad.confの場合もある)の中の、data_sourceの項にIPアドレスもしくはホスト名で追加していく。

data_source "my cluster" localhost node1.example.com 192.167.2.1

(php5-gd)

それから、php5のGDモジュールがインストールされていなければ、それもインストールする。

$ sudo apt-get install php5-gd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
apache2-mpm-prefork apache2-utils apache2.2-common libapache2-mod-php5
libapr1 libaprutil1 libgd2-xpm libmysqlclient15off libpq5 libt1-5
mysql-common php5-common
Suggested packages:
apache2-doc apache2-suexec apache2-suexec-custom php-pear libgd-tools
The following packages will be REMOVED:
libgd2-noxpm
The following NEW packages will be installed:
apache2-mpm-prefork apache2-utils apache2.2-common libapache2-mod-php5
libapr1 libaprutil1 libgd2-xpm libmysqlclient15off libpq5 libt1-5
mysql-common php5-common php5-gd
0 upgraded, 13 newly installed, 1 to remove and 12 not upgraded.
Need to get 7092kB of archives.
After this operation, 18.4MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://archive.ubuntu.com jaunty-updates/main libapr1 1.2.12-5ubuntu0.1 [114kB]
Get:2 http://archive.ubuntu.com jaunty-updates/main mysql-common 5.1.30really5.0.75-0ubuntu10.3 [63.4kB]
Get:3 http://archive.ubuntu.com jaunty-updates/main libmysqlclient15off 5.1.30really5.0.75-0ubuntu10.3 [1879kB]
Get:4 http://archive.ubuntu.com jaunty-updates/main libpq5 8.3.9-0ubuntu9.04 [314kB]
Get:5 http://archive.ubuntu.com jaunty-updates/main libaprutil1 1.2.12+dfsg-8ubuntu0.3 [79.1kB]
Get:6 http://archive.ubuntu.com jaunty-updates/main apache2-utils 2.2.11-2ubuntu2.5 [151kB]
Get:7 http://archive.ubuntu.com jaunty-updates/main apache2.2-common 2.2.11-2ubuntu2.5 [827kB]
Get:8 http://archive.ubuntu.com jaunty-updates/main apache2-mpm-prefork 2.2.11-2ubuntu2.5 [253kB]
Get:9 http://archive.ubuntu.com jaunty-updates/main php5-common 5.2.6.dfsg.1-3ubuntu4.5 [373kB]
Get:10 http://archive.ubuntu.com jaunty-updates/main libapache2-mod-php5 5.2.6.dfsg.1-3ubuntu4.5 [2616kB]
Get:11 http://archive.ubuntu.com jaunty-updates/main libgd2-xpm 2.0.36~rc1~dfsg-3ubuntu1.9.04.1 [215kB]
Get:12 http://archive.ubuntu.com jaunty/main libt1-5 5.1.2-3 [170kB]
Get:13 http://archive.ubuntu.com jaunty-updates/main php5-gd 5.2.6.dfsg.1-3ubuntu4.5 [37.2kB]
Fetched 7092kB in 6s (1133kB/s)
dpkg: libgd2-noxpm: dependency problems, but removing anyway as you request:
libgraphviz4 depends on libgd2-noxpm (>= 2.0.36~rc1~dfsg) | libgd2-xpm (>= 2.0.36~rc1~dfsg); however:
Package libgd2-noxpm is to be removed.
Package libgd2-xpm is not installed.
mrtg depends on libgd2-noxpm (>= 2.0.36~rc1~dfsg) | libgd2-xpm (>= 2.0.36~rc1~dfsg); however:
Package libgd2-noxpm is to be removed.
Package libgd2-xpm is not installed.
(Reading database ... 107789 files and directories currently installed.)
Removing libgd2-noxpm ...
Processing triggers for libc6 ...
ldconfig deferred processing now taking place
Selecting previously deselected package libapr1.
(Reading database ... 107781 files and directories currently installed.)
Unpacking libapr1 (from .../libapr1_1.2.12-5ubuntu0.1_amd64.deb) ...
Selecting previously deselected package mysql-common.
Unpacking mysql-common (from .../mysql-common_5.1.30really5.0.75-0ubuntu10.3_all.deb) ...
Selecting previously deselected package libmysqlclient15off.
Unpacking libmysqlclient15off (from .../libmysqlclient15off_5.1.30really5.0.75-0ubuntu10.3_amd64.deb) ...
Selecting previously deselected package libpq5.
Unpacking libpq5 (from .../libpq5_8.3.9-0ubuntu9.04_amd64.deb) ...
Selecting previously deselected package libaprutil1.
Unpacking libaprutil1 (from .../libaprutil1_1.2.12+dfsg-8ubuntu0.3_amd64.deb) ...
Selecting previously deselected package apache2-utils.
Unpacking apache2-utils (from .../apache2-utils_2.2.11-2ubuntu2.5_amd64.deb) ...
Selecting previously deselected package apache2.2-common.
Unpacking apache2.2-common (from .../apache2.2-common_2.2.11-2ubuntu2.5_amd64.deb) ...
Selecting previously deselected package apache2-mpm-prefork.
Unpacking apache2-mpm-prefork (from .../apache2-mpm-prefork_2.2.11-2ubuntu2.5_amd64.deb) ...
Selecting previously deselected package php5-common.
Unpacking php5-common (from .../php5-common_5.2.6.dfsg.1-3ubuntu4.5_amd64.deb) ...
Selecting previously deselected package libapache2-mod-php5.
Unpacking libapache2-mod-php5 (from .../libapache2-mod-php5_5.2.6.dfsg.1-3ubuntu4.5_amd64.deb) ...
Selecting previously deselected package libgd2-xpm.
Unpacking libgd2-xpm (from .../libgd2-xpm_2.0.36~rc1~dfsg-3ubuntu1.9.04.1_amd64.deb) ...
Selecting previously deselected package libt1-5.
Unpacking libt1-5 (from .../libt1-5_5.1.2-3_amd64.deb) ...
Selecting previously deselected package php5-gd.
Unpacking php5-gd (from .../php5-gd_5.2.6.dfsg.1-3ubuntu4.5_amd64.deb) ...
Processing triggers for man-db ...
Processing triggers for ufw ...
Setting up libapr1 (1.2.12-5ubuntu0.1) ...

Setting up mysql-common (5.1.30really5.0.75-0ubuntu10.3) ...
Setting up libmysqlclient15off (5.1.30really5.0.75-0ubuntu10.3) ...

Setting up libpq5 (8.3.9-0ubuntu9.04) ...

Setting up libaprutil1 (1.2.12+dfsg-8ubuntu0.3) ...

Setting up apache2-utils (2.2.11-2ubuntu2.5) ...
Setting up apache2.2-common (2.2.11-2ubuntu2.5) ...
Enabling site default.
Enabling module alias.
Enabling module autoindex.
Enabling module dir.
Enabling module env.
Enabling module mime.
Enabling module negotiation.
Enabling module setenvif.
Enabling module status.
Enabling module auth_basic.
Enabling module deflate.
Enabling module authz_default.
Enabling module authz_user.
Enabling module authz_groupfile.
Enabling module authn_file.
Enabling module authz_host.

Setting up apache2-mpm-prefork (2.2.11-2ubuntu2.5) ...
* Starting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
...done.

Setting up php5-common (5.2.6.dfsg.1-3ubuntu4.5) ...
Setting up libapache2-mod-php5 (5.2.6.dfsg.1-3ubuntu4.5) ...

Creating config file /etc/php5/apache2/php.ini with new version
* Reloading web server config apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
...done.

Setting up libgd2-xpm (2.0.36~rc1~dfsg-3ubuntu1.9.04.1) ...

Setting up libt1-5 (5.1.2-3) ...

Setting up php5-gd (5.2.6.dfsg.1-3ubuntu4.5) ...

Processing triggers for libc6 ...
ldconfig deferred processing now taking place

ganglia-webfrontend

$ sudo apt-get install ganglia-webfrontend

でインストールする。
/etc/ganglia-webfrontendの中にapacheの設定ファイルがあるので、それを/etc/apache2/conf.d/内にコピーする。

$ sudo cp -p /etc/ganglia-webfrontend/apache.conf /etc/apache2/conf.d/ganglia.conf

そしてapacheを再起動する。

$ sudo /etc/init.d/apache2 restart

/etc/ganglia-webfrontend/apache.confのデフォルトの設定のままだと、http://example.com/gangliaにアクセスすると、見られるはずである。

古いubuntuの場合は

ganglia-webfrontendをインストールする際、このページによると、ubuntu 8.04とganglia 3.0.7の組み合わせだと、そのパッケージが存在しないらしいので、その場合は、古い3.03のganglia-webfrontendをインストールする。ubuntu 9.04でも事情は同じである。ganglia-web-3.0.3-1.noarch.rpmをhttp://ganglia.info/よりダウンロードして、

$ sudo rpm --install ganglia-web-3.0.3-1.noarch.rpm

とする。

そうすると、/var/www/html/ganglia以下のディレクトリにindex.phpをはじめとしたファイルが作成されるはずである。

(Apacheの設定)

これで、あとはhttp://www.example.com/html/ganglia/にアクセスしてやればよいのだが、もしApacheでphpを適切に設定されていないと、きちんと表示されずに、例えばファイルがダウンロードされたりする。Apacheでphpを使えるようにするには、こちらを参照。

CPUの温度を記録する

GPUの温度を記録する

ハードディスクの温度を記録する

まず、hddtempをインストールする。ubuntuであれば、

$ sudo apt-get install hddtemp

でインストールできる。インストール中に、次のような設問がある。

lqqqqqqqqqqqqqqqqqqqqqqqqqqu Configuring hddtemp tqqqqqqqqqqqqqqqqqqqqqqqqqqk
x x
x The hddtemp program can be run as a daemon, listening on port 7634 for x
x incoming connections. It is used by some software such as gkrellm to get x
x the temperature of hard drives. x
x x
x You have the option of starting the hddtemp daemon automatically on x
x system boot. If in doubt, it is suggested to not start it automatically x
x on boot. x
x x
x This setting can be modified later by running 'dpkg-reconfigure x
x hddtemp'. x
x x
x Should the hddtemp daemon be started at boot? x
x x
x <Yes> <No> x
x x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

lqqqqqqqqqqqqqqqqqqqqqqqqqu Configuring hddtemp tqqqqqqqqqqqqqqqqqqqqqqqqqk
x The hddtemp program can listen for incoming connections on a specific x
x interface, or on all interfaces. x
x x
x To listen on a specific interface, enter the IP address of that x
x interface (choosing 127.0.0.1 will accept local connections only). To x
x listen on all interfaces, enter 0.0.0.0. x
x x
x Interface to listen on: x
x x
x 127.0.0.1______________________________________________________________ x
x x
x <Ok> x
x x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

lqqqqqqqqqqqqqqqqqqqqqqqqqqu Configuring hddtemp tqqqqqqqqqqqqqqqqqqqqqqqqqqk
x By default, hddtemp listens for incoming connections on port 7634. This x
x can be changed for another port number. x
x x
x Port to listen on: x
x x
x 7634_____________________________________________________________________ x
x x
x <Ok> x
x x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

これで、下記のように打つと、ハードディスクの温度を調べることができる。

$ sudo hddtemp /dev/sda
/dev/sda: Hitachi HDT721025SLA380: 34 C

次に、この情報をgangliaに送る。

Gangliaのインストール Fedora10編

Fedora10ではyumを使ってすべてインストールできる。

rrdtoolのインストール

これは各ノードすべてにインストールする。

# yum install rrdtool
Loaded plugins: refresh-packagekit
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package rrdtool.x86_64 0:1.3.4-2.fc10 set to be updated
--> Processing Dependency: dejavu-lgc-fonts for package: rrdtool
--> Running transaction check
---> Package dejavu-lgc-fonts.noarch 0:2.26-2.fc10 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
rrdtool x86_64 1.3.4-2.fc10 fedora 392 k
Installing for dependencies:
dejavu-lgc-fonts noarch 2.26-2.fc10 fedora 3.5 M

Transaction Summary
================================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 3.9 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): rrdtool-1.3.4-2.fc10.x86_64.rpm | 392 kB 00:06
(2/2): dejavu-lgc-fonts-2.26-2.fc10.noarch.rpm | 3.5 MB 00:49
--------------------------------------------------------------------------------
Total 71 kB/s | 3.9 MB 00:55
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : dejavu-lgc-fonts 1/2
Installing : rrdtool 2/2

Installed:
rrdtool.x86_64 0:1.3.4-2.fc10

Dependency Installed:
dejavu-lgc-fonts.noarch 0:2.26-2.fc10

Complete!

Gangliaのインストール

これも各ノードすべてにインストールする。

# yum install ganglia
Loaded plugins: refresh-packagekit
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package ganglia.x86_64 0:3.1.1-1.fc10 set to be updated
--> Processing Dependency: libconfuse.so.0()(64bit) for package: ganglia
--> Running transaction check
---> Package libconfuse.x86_64 0:2.6-1.fc9 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
ganglia x86_64 3.1.1-1.fc10 fedora 189 k
Installing for dependencies:
libconfuse x86_64 2.6-1.fc9 fedora 86 k

Transaction Summary
================================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 275 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): libconfuse-2.6-1.fc9.x86_64.rpm | 86 kB 00:01
(2/2): ganglia-3.1.1-1.fc10.x86_64.rpm | 189 kB 00:02
--------------------------------------------------------------------------------
Total 79 kB/s | 275 kB 00:03
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : libconfuse 1/2
Installing : ganglia 2/2

Installed:
ganglia.x86_64 0:3.1.1-1.fc10

Dependency Installed:
libconfuse.x86_64 0:2.6-1.fc9

Complete!

gmond

これも各ノードすべてにインストールする。

# yum install ganglia-gmond
Loaded plugins: refresh-packagekit
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package ganglia-gmond.x86_64 0:3.1.1-1.fc10 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
ganglia-gmond x86_64 3.1.1-1.fc10 fedora 55 k

Transaction Summary
================================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 55 k
Is this ok [y/N]: y
Downloading Packages:
ganglia-gmond-3.1.1-1.fc10.x86_64.rpm | 55 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : ganglia-gmond 1/1

Installed:
ganglia-gmond.x86_64 0:3.1.1-1.fc10

Complete!

自動起動するように、

# chkconfig gmond on

gmetad

これは、データを表示するコンピュータにインストールする。

# yum install ganglia-gmetad
Loaded plugins: refresh-packagekit
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package ganglia-gmetad.x86_64 0:3.1.1-1.fc10 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
ganglia-gmetad x86_64 3.1.1-1.fc10 fedora 33 k

Transaction Summary
================================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 33 k
Is this ok [y/N]: y
Downloading Packages:
ganglia-gmetad-3.1.1-1.fc10.x86_64.rpm | 33 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : ganglia-gmetad 1/1

Installed:
ganglia-gmetad.x86_64 0:3.1.1-1.fc10

Complete!

自動起動するように、

# chkconfig gmetad on

ここまで来れば次のコマンドで、xmlデータが表示されるはずである。

$ telnet localhost 8649

ganglia-webのインストール

これも、データを表示するコンピュータにインストールする。

# yum install ganglia-web
Loaded plugins: refresh-packagekit
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package ganglia-web.x86_64 0:3.1.1-1.fc10 set to be updated
--> Processing Dependency: php-gd for package: ganglia-web
--> Running transaction check
---> Package php-gd.x86_64 0:5.2.6-5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
ganglia-web x86_64 3.1.1-1.fc10 fedora 113 k
Installing for dependencies:
php-gd x86_64 5.2.6-5 fedora 119 k

Transaction Summary
================================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 231 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): ganglia-web-3.1.1-1.fc10.x86_64.rpm | 113 kB 00:01
(2/2): php-gd-5.2.6-5.x86_64.rpm | 119 kB 00:01
--------------------------------------------------------------------------------
Total 84 kB/s | 231 kB 00:02
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : php-gd 1/2
Installing : ganglia-web 2/2

Installed:
ganglia-web.x86_64 0:3.1.1-1.fc10

Dependency Installed:
php-gd.x86_64 0:5.2.6-5

Complete!

ここで、/etc/httpd/conf.d/ganglia.confというファイルができる。内容は、

  #
  # Ganglia monitoring system php web frontend
  #
  
  Alias /ganglia /usr/share/ganglia

  <Location /ganglia>
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1
    Allow from ::1
    # Allow from .example.com
  </Location>

となっているが、これだと、localhostからしか、グラフを見ることができない。他のコンピュータからも見えるように次のようにコメントアウトする。

  #
  # Ganglia monitoring system php web frontend
  #
  
  Alias /ganglia /usr/share/ganglia

#  <Location /ganglia>
#    Order deny,allow
#    Deny from all
#    Allow from 127.0.0.1
#    Allow from ::1
#    # Allow from .example.com
#  </Location>

これでhttpdを再起動する。

# /etc/ini.d/httpd restart

http://localhost/gangliaにアクセスする。

もし、ここでグラフが表示されずに、

There was an error collecting ganglia data (127.0.0.1:8652): fsockopen error: Permission denied

のようなエラーメッセージが出た場合は、SELinuxが有効になっている可能性がある。
手っ取り早い方法は、次のように打ってSELinuxをdisableにすることである。

# setenforce 0

もしくは、/etc/selinux/configファイル内で、

SELINUX=enforcing

となっているところを、

SELINUX=disabled

と書き換えて、OSを再起動する。

Gangliaのインストール Fedora Core 5編

yumではインストールできないので、ソースファイルをここ(http://ganglia.sourceforge.net/)からダウンロードしてきて、手動でコンパイルしてインストールする必要がある。

ダウンロードサイトは、ここ(http://sourceforge.net/project/showfiles.php?group_id=43021&package_id=35280)。ダウンロードすべきファイルは、次の2つである。

ganglia-3.0.2.tar.gz
ganglia-web-3.0.2-1.noarch.rpm

Gangliaを使用するには、Ganglia(gmond、gmetad、ganglia-web)の他に、rrdtool、php、apacheが必要である。ここでは、すでにapacheが稼働していて、かつ、apache上でphpが使用可能なものと仮定する。

rrdtoolのインストール

まずあらかじめrrdtoolをインストールしておく。

# yum install rrdtool
Loading "installonlyn" plugin
Setting up Install Process
Setting up repositories
core [1/3]
updates [2/3]
extras [3/3]
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package rrdtool.x86_64 0:1.0.49-5.fc4 set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
rrdtool x86_64 1.0.49-5.fc4 extras 435 k

Transaction Summary
=============================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 435 k
Is this ok [y/N]: y
Downloading Packages:
(1/1): rrdtool-1.0.49-5.f 100% |=========================| 435 kB 00:00
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: rrdtool ######################### [1/1]

Installed: rrdtool.x86_64 0:1.0.49-5.fc4
Complete!
# yum install rrdtool-devel
Loading "installonlyn" plugin
Setting up Install Process
Setting up repositories
core [1/3]
updates [2/3]
extras [3/3]
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for rrdtool-devel to pack into transaction set.
rrdtool-devel-1.0.49-5.fc 100% |=========================| 16 kB 00:00
---> Package rrdtool-devel.x86_64 0:1.0.49-5.fc4 set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
rrdtool-devel x86_64 1.0.49-5.fc4 extras 168 k

Transaction Summary
=============================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 168 k
Is this ok [y/N]: y
Downloading Packages:
(1/1): rrdtool-devel-1.0. 100% |=========================| 168 kB 00:00
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: rrdtool-devel ######################### [1/1]

Installed: rrdtool-devel.x86_64 0:1.0.49-5.fc4
Complete!

これでgangliaをコンパイルしても、次のようなエラーメッセージが出てうまくいかない。

The Ganglia Meta Daemon uses the Round-Robin Database Tool (rrdtool)
for storing historical information. You have chosen to compile the
monitoring core with gmetad but librrd.a could not be found. Please
visit http://www.rrdtool.org/, download rrdtool and then try again

NOTE: the rrdtool library (librrd) will NOT need to be installed on
every machine running gmetad only the machine you are compiling gmetad
on since librrd is statically linked.


しかたがないので、ここ(http://oss.oetiker.ch/rrdtool/)からrrdtoolのソースを取ってきてコンパイル

./configure
make
make install

これで/usr/local/rrdtool-1.2.12/にインストールされた。

Gangliaのインストール

つぎにGangliaを解凍し、そのディレクトリに行き

# ./configure LDFLAGS="-L/usr/local/rrdtool-1.2.12/lib" --with-gmetad
# make
# make install

gmond

gmondのデフォルト設定ファイルを作成し/etcにコピー

# cd gmond
# ./gmond --default_config > gmond.conf
# cp gmond.conf /etc/

起動スクリプトもコピー

# cp gmond.init /etc/rc.d/init.d/gmond
# /etc/init.d/gmond start
# chkconfig gmond on

gmetad

次にgmetad。gmetadディレクトリに行き、設定ファイルと起動スクリプトをコピー。

# cp gmetad.conf /etc/
# cp gmetad.init /etc/rc.d/init.d/gmetad

gmetad.confの方を変更してもよいがここではデフォルト値を使うとして、/var/lib/ganglia/rrdsというフォルダを作り、所有者をnobody:nobodyに変更する。

# cd /var/lib
# mkdir ganglia
# cd ganglia
# mkdir rrds
# chown nobody:nobody rrds

そしてgmetadを起動する。

# /etc/init.d/gmetad start
# chkconfig gmetad on

ここまでくれば、次のコマンドで、xmlデータが表示されるはずである。

$ telnet localhost 8649

ganglia-web

最後にwebからアクセスしてグラフを見られるようにするために、つぎのものをインストールする。

# rpm -Uvh ganglia-web-3.0.2-1.noarch.rpm
Preparing... ########################################### [100%]
1:ganglia-web ########################################### [100%]

今回は、/usr/local/rrdtool-1.2.12/にインストールしたので、conf.php内の

define("RRDTOOL", "/usr/bin/rrdtool");

define("RRDTOOL", "/usr/local/rrdtool-1.2.12/bin/rrdtool");

に変更する。

http://www.example.com/ganglia/でアクセスすると、グラフが表示される。

apacheも変更する必要があるかも

AddType application/x-httpd-php-source .phps必要?

リンク


Google Bookmarksに追加 Twitterに投稿 はてなブックマークに追加 Yahoo!ブックマークに追加
本文中のFC4はFedora ProjectのFedora Core 4を、FC5はFedora Core 5を、FC6はFedora Core 6をopenSUSEはNovellのSUSE Linux OSSを表します。Fedora7以降は、単にFedora7、Fedora8、Fedora9、Fedora10、Fedora11と表示しています。Ubuntuは、必要に応じて9.04、10.04のようにバージョン番号をつけて区別しています。MandrivaはMandriva Linuxを表します。

ここに登場するドメイン名やIPアドレスなどはフィクションです。実在の人物・団体等とは一切関係がありません。
実際に使用する際は、各自の環境に合わせて書き換えてください。
もし何か間違いなどありましたらこちらからご連絡ください
リンクに許可は不要です。
Copyright (C) 2010 Chikuma Engineering Co., Ltd. All Rights Reserved.