LoginSignup
1
0

More than 3 years have passed since last update.

GangliaでxCATクラスターを監視する

Last updated at Posted at 2020-06-25

xCAT導入シリーズ

  1. xCATでスパコンを作ろう
  2. GangliaでxCATクラスターを監視する
  3. xCATクラスターにGridEngineを導入する(準備中)

GangliaでxCATクラスターを監視する

xCATでスパコンを作ろうの記事では、Ubuntu18.04LTS上に、xCATを載せて、HPCクラスターの基礎を作った。

引き続いてHPCクラスターで広くつかわれているオープンソースの監視システムGangliaを導入してみよう。

Gangliaのインストール

参照URI

Management Nodeへのインストール

Gangliaの構成要素

  • gmetad データ収集デーモン
  • gmond (ganglia-monitor) データ報告デーモン。gmetadからの要求に応じて、rrdtoolで収集したデータをXMLで返す。compute node群上やmanagement node自身の上で作動。
  • Ganglia webfrontend(GUIツール。Apache2, PHP7.2, RRDtoolなどに依存)

インストールの実際

パッケージganglia-webfrontendganglia-monitorに加え、suggested packageであるphp-pearlibrrds-perlをインストールする。

# apt install ganglia-webfrontend ganglia-monitor php-pear librrds-perl
The following additional packages will be installed:
  fonts-dejavu-core gmetad libapache2-mod-php7.2 libconfuse-common libconfuse2 libdbi1 libganglia1 librrd8 php php-cli
  php-common php-gd php-xml php7.2 php7.2-cli php7.2-common php7.2-gd php7.2-json php7.2-opcache php7.2-readline
  php7.2-xml rrdtool
The following NEW packages will be installed:
  fonts-dejavu-core ganglia-monitor ganglia-webfrontend gmetad libapache2-mod-php7.2 libconfuse-common libconfuse2 libdbi1
  libganglia1 librrd8 librrds-perl php php-cli php-common php-gd php-pear php-xml php7.2 php7.2-cli php7.2-common
  php7.2-gd php7.2-json php7.2-opcache php7.2-readline php7.2-xml rrdtool
0 upgraded, 26 newly installed, 0 to remove and 0 not upgraded.
Need to get 7,744 kB of archives.
After this operation, 38.1 MB of additional disk space will be used.

青いバックグラウンドのconfigure画面に切り替わり、2回restart apache2?と聞かれるのでYesと答えておく。

設定

/etc/ganglia/gmetad.conf/etc/ganglia/gmond.confを(念のためコピー後)を編集する

/etc/ganglia/gmetad.conf
# data_source "my cluster" 10 localhost  my.machine.edu:8649  1.2.3.5:8655                                                  
# data_source "my grid" 50 1.3.4.7:8655 grid.org:8651 grid-backup.org:8651 # ポーリング間隔50秒。デフォルトは15秒。                                                 
# data_source "another source" 1.3.4.7:8655  1.3.4.8  
#data_source "my cluster" localhost                                                                                         
data_source "compute2" localhost  10.34.2.1 10.34.2.2 10.34.2.3 10.34.2.4 10.34.2.5 10.34.2.6 10.34.2.7 10.34.2.8 10.34.2.9 10.34.2.10                                                                      
/etc/ganglia/gmond.conf
udp_send_channel {
  #mcast_join = 239.2.11.71 # <<<< ユニキャスト使用のためコメントアウト
  host = 10.54.0.1 <<< 追加
  port = 8649
  ttl = 1
}

/* You can specify as many udp_recv_channels as you like as well. */
udp_recv_channel {
  #mcast_join = 239.2.11.71 # <<<<< ユニキャスト使用のためコメントアウト
  port = 8649
  #bind = 239.2.11.71 # <<<<< ユニキャスト使用のためコメントアウト
}

また、PHP2.7でエラーがでるようで、本家GitHubレポジトリでは修正済みだがパッケージでは未修正のようである。ここは手動修正。

/usr/share/ganglia-webfrontend/cluster_view.php
// $context_metrics = ""; 26行目
$context_metrics = array();

と修正。

最後にApache2の設定をコピー

# cp -p /etc/ganglia-webfrontend/apache.conf /etc/apache2/sites-enabled/ganglia.conf

起動

# service ganglia-monitor restart
# service gmetad restart
# service apache2 restart

$ firefox --new-instance http://localhost/ganglia/

上手く表示されただろうか?firefoxはsudoしていると環境変数設定の問題でエラーが出るかもしれないので、その際は一般ユーザーで実行してほしい。

postscriptメカニズムを使ったCompute Node群へのインストール

xCATのpostscript の仕組みをつかってGanglia-monitor (gmond)パッケージのインストールと設定を行う。

postscriptのデフォルト設定は以下の通り

# tabdump postscripts
#node,postscripts,postbootscripts,comments,disable
"xcatdefaults","syslog,remoteshell,syncfiles","otherpkgs",,
"service","servicenode",,,

ここでpostscriptsはブート後のinit.d実行時に実行され、postbootscripotはさらにその後に実行される。postscrptの実体は、/install/postscrips/以下におかれたシェルスクリプとや実行ファイルである。

xCATのカスタマイズには多様な流儀があり、著者には全体を把握するのが難しい。そこで、compute nodeのbootまでは極力xCATのデフォルトですすめて、最後にサイト独自の設定を、ひとつのpostbootscriptに集中して記述して実行することにする。スクリプトの名前は何でも良いのだが、lsで最初に出るように頭に0をつけて0customizeとしよう。

/install/postscript/otherpkgs/0customize
#!/bin/bash

log_label="0customize"
logger="logger -s -t ${log_label} -p local4.debug"

: "setup apt sources" && {
    ${logger} "Start: setup apt sources."
    cat - <<EOF > /etc/apt/sources.list
deb http://192.168.0.21:80/install/ubuntu18.04.2/x86_64 bionic main
deb http://jp.archive.ubuntu.com/ubuntu/ bionic main restricted
deb http://jp.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
deb http://jp.archive.ubuntu.com/ubuntu/ bionic universe
deb http://jp.archive.ubuntu.com/ubuntu/ bionic-updates universe
deb http://jp.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://jp.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
deb http://jp.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse
EOF
    apt update
    ${logger} "Done: setup apt sources"
}

: "ganglia-monitor configuration" && {
    ${logger} "Start: setup ganglia-monitor."
    gmondconf=/etc/ganglia/gmond.conf
    DEBIAN_FRONTEND=noninteractive apt install -y ganglia-monitor
    cp ${gmondconf} ${gmondconf}.orig
    sed -e 's/mcast_join/\#mcast_join/g' \
    -e 's/bind/\#bind/g' \
    -e 's/udp_send_channel {/udp_send_channel {\n  host = 10.54.0.1/' \
    ${gmondconf}.orig > ${gmondconf}
    service ganglia-monitor start
    ${logger} "Done: setup ganglia-monitor."
}

ここには、aptの設定、ganglia-monitorのインストールと設定の書き換え、そして起動まで一気に行っている。ファイルシステムのマウントなどもすべてここに記述して良いだろう。

なお、デバッグは、

# scp /install/postscript/0customize cn01:~
# ssh cn01
(中略)
# . 0customize

というような具合でやるのがお手軽だろう。最後にcumpute2全体に、0customizeをpostbootscriptsとして指定して、クラスター全体を再起動する。

# chmod a+x 0customize`
# chdef compute2 -p postbootscripts=0customize
# rpower comoute2 boot

Management node上でうごくウェブフロントエンド上で、各ノードが表示されただろうか?いよいろHPCクラスターが動いている実感が出てきたのではないだろうか?

1
0
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
1
0