- 追加された行はこのように表示されます。
- 削除された行は
このように表示されます。
!!!サーバ監視ソフトGangliaとRRDToolのインストールメモ
!!今回の目標
*サーバ管理業務において,クラスタリングを行ったPCの個別,集約したパフォーマンスを測定する為の監視ツール,Gangliaのインストールメモをアップさせて頂きます。
*利用ソフト:RRDTool,Ganglia
*RRDToolとは,時間による値の変化を記録するためのデータベースです。
**簡単に言えば,MRTGと呼ばれるネットワーク帯域のグラフ化ツール(MRTG)からSNMPを除いたものです。
**詳しい説明は,次のURLをご覧ください。
**http://oss.oetiker.ch/rrdtool/
*Gangliaとは,複数のPCの状態をWebを介して確認できるソフトです。
**http://ganglia.sourceforge.net/
!!作業内容
*RRDToolとGnagliaのインストール
*動作環境:ScientificLinux4.1,多くをパッケージで対応。
!!RRDToolのインストール(cactiのイントールメモを流用しました。)
*ここでは,rrdtool-1.2.23.tar.gzを利用。
**入手先(http://oss.oetiker.ch/rrdtool/pub/)
*上記rrdtool-1.2.23.tar.gzをインストールする前に,各種依存関係のあるライブラリを登録してから最後にインストールします。
*手順は,次のとおり
**(詳細記述は,http//oss.oetiker.ch/rrdtool/doc/rrdbuild.en.htmlにあります。)
*(1)まず最初に作業ディレクトとインストール先を指定します。
BUILD_DIR=/tmp/rrdbuild
INSTALL_DIR=/usr/local/rrdtool-1.2.19
例:
BUILD_DIR=/usr/local/src/rrdtool-1.2.23
INSTALL_DIR=/usr/local/rrdtool
*(2)zlibのインストール
cd $BUILD_DIR
wget http://oss.oetiker.ch/rrdtool/pub/libs/zlib-1.2.3.tar.gz
tar zxf zlib-1.2.3.tar.gz
cd zlib-1.2.3
env CFLAGS="-O3 -fPIC" ./configure --prefix=$BUILD_DIR/lb
make
make install
*(3)libpngのインストール
cd $BUILD_DIR
wget http://oss.oetiker.ch/rrdtool/pub/libs/libpng-1.2.10.tar.gz
tar zxvf libpng-1.2.10.tar.gz
cd libpng-1.2.10
env CPPFLAGS="-I$BUILD_DIR/lb/include" LDFLAGS="-L$BUILD_DIR/lb/lib" CFLAGS="-O3 -fPIC" \
./configure --disable-shared --prefix=$BUILD_DIR/lb
make
make install
*(4)freetypeのインストール
cd $BUILD_DIR
wget http://oss.oetiker.ch/rrdtool/pub/libs/freetype-2.1.10.tar.bz2
tar jxvf freetype-2.1.10.tar.bz2
cd freetype-2.1.10
env CPPFLAGS="-I$BUILD_DIR/lb/include" LDFLAGS="-L$BUILD_DIR/lb/lib" CFLAGS="-O3 -fPIC" \
./configure --disable-shared --prefix=$BUILD_DIR/lb
make
make install
*(5)libart_lgplのインストール
cd $BUILD_DIR
wget http://oss.oetiker.ch/rrdtool/pub/libs/libart_lgpl-2.3.17.tar.gz
tar zxvf libart_lgpl-2.3.17.tar.gz
cd libart_lgpl-2.3.17
env CFLAGS="-O3 -fPIC" ./configure --disable-shared --prefix=$BUILD_DIR/lb
make
make install
*(6)その他
ranlib $BUILD_DIR/lb/lib/*.a
IR=-I$BUILD_DIR/lb/include
CPPFLAGS="$IR $IR/libart-2.0 $IR/freetype2 $IR/libpng"
LDFLAGS="-L$BUILD_DIR/lb/lib"
CFLAGS=-O3
export CPPFLAGS LDFLAGS CFLAGS
*(7)最後に出来上がったRRDTOOLのインストール
cd $BUILD_DIR/rrdtool-1.2.23
./configure --prefix=$INSTALL_DIR --disable-python --disable-tcl
make clean
make
make install
例:
cd $BUILD_DIR/rrdtool-1.2.23
./configure --prefix=/usr/local/rrdtool --disable-python --disable-tcl
make clean
make
make install
*以上でrrdtoolのインストールは,完了。
*参考URL:http://oss.oetiker.ch/rrdtool/doc/rrdbuild.en.html
*途中,エラーが出たので,以下の作業を行いました。
エラー内容:
configure: error: C++ preprocessor "/lib/cpp" fails sanity checkとエラーが出たので,
# yum install gcc-c++ gcc
インストールしておきます。
!!Gangliaのインストール
Gangliaはwebサーバ側にgmetadをクラスタ側には,最低,ganglia-monitor(gmond)をインストールする必要があります。
!Webサーバ側
*ここでは,ganglia-3.0.5.tar.gzを利用しました。
**入手先(http://downloads.sourceforge.net/ganglia/ganglia-3.0.5.tar.gz?modtime=1191364402&big_mirror=0)
*(1)まず最初に作業ディレクトに移動とプログラムの展開を行います。
# mv ganglia-3.0.5.tar.gz /usr/local/src
# cd /usr/local/src
# tar zxf ganglia-3.0.5
# cd ganglia-3.0.5
*(2)./configureを行います。
# ./configure --help でまずオプションを確認して下さい。
--with-gmetad をつけることにより,Webサーバ側(クラスタ側を監視することができる)になります。
デフォルトでは,インストールされませんので,監視対象となるのみです。(注意)
# ./configure LDFLAGS="-L/usr/local/rrdtool/lib" --with-gmetad --enable-gexec
*(3)make,make installを行います。
# make
# make install
*(4)/usr(初期値)以下に次のものがインストールされているか確認して下さい。
/usr/bin/gstat
/usr/bin/gmetric
/usr/sbin/gmond
/usr/sbin/gmetad
*(5)テストを行います。
# ./gmond
これにより,gangliaの監視デーモンが起動しますので,次のコマンドを入力して下さい。
# telnet localhost 8649
正常に起動しておりましたら,localhostの情報がXMLデータで画面に表示されます。
*(6)ソースインストールした場合には,次のスクリプトをコピーします(gmondとgmetad)。
まず,ソース先にディレクトリを移動させます。
# cd /usr/local/src/ganglia-3.0.5
*(7)gmond
gmondのデフォルト設定ファイルを作成し/etcにコピー
# cd gmond
# ./gmond --default_config > gmond.conf
# cp gmond.conf /etc/
起動スクリプトもコピー
# cp ./gmond/gmond.init /etc/rc.d/init.d/gmond
# chkconfig --add gmond
# chkconfig --list gmond
gmond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
# /etc/rc.d/init.d/gmond start
Starting GANGLIA gmond: [OK]
*(8)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
起動スクリプトをコピー
# cp ./gmetad/gmetad.init /etc/rc.d/init.d/gmetad
# chkconfig --add gmetad
# chkconfig --list gmetad
gmetad 0:off 1:off 2:on 3:on 4:on 5:on 6:off
# /etc/rc.d/init.d/gmetad start
Starting GANGLIA gmetad: [OK]
*(9)PHPプログラムで書かれたWebフロントエンドプログラムをソースからWebディレクトリへコピー
# cp /usr/local/src/ganglia-3.0.5/web/* /var/www/html/ganglia
ScientificLinux4.1では,Web公開ディレクトリは,/var/www/htmlでしたが,利用されるOSにより相違しますので,注意。
*(10)/var/www/html/ganglia/conf.phpの記載内容を変更する。
# vi /var/www/html/ganglia/conf.php
22行目あたりにある
define("RRDTOOL","/usr/local/rrdtool/bin/rrdtool");と変更する。
rrdtoolのディレクトリを示す。ここでは,/usr/local/rrdtool/bin/rrdtoolとなります。
*(11)Webブラウザを開きテストを行う。
http://localhost/ganglia
ここで,Gangliaの監視項目が表示されたらOK
!クラスタ側(監視される側)
*上記のうち,最低,gmondを監視されるPCにインストールする必要があります。
**上記Webサーバ側設定(2)で./configureオプションのうち,--with-gmetadを追加せずに行いますと,gmondのみとなります。
!!最後に
*これでRRDToolとGangliaは,インストールが完了しました。
**もう少し活用し,情報がたまりましたら,追記させて頂きます。
!!設定資料
*テスト環境のgmetad.conf(/etc/gmetad.conf)
# This is an example of a Ganglia Meta Daemon configuration file
# http://ganglia.sourceforge.net/
#
# $Id: gmetad.conf 667 2006-07-20 08:49:41Z knobi1 $
#
#-------------------------------------------------------------------------------
# Setting the debug_level to 1 will keep daemon in the forground and
# show only error messages. Setting this value higher than 1 will make
# gmetad output debugging information and stay in the foreground.
# default: 0
# debug_level 10
#
#-------------------------------------------------------------------------------
# What to monitor. The most important section of this file.
#
# The data_source tag specifies either a cluster or a grid to
# monitor. If we detect the source is a cluster, we will maintain a complete
# set of RRD databases for it, which can be used to create historical
# graphs of the metrics. If the source is a grid (it comes from another gmetad),
# we will only maintain summary RRDs for it.
#
# Format:
# data_source "my cluster" [polling interval] address1:port addreses2:port ...
#
# The keyword 'data_source' must immediately be followed by a unique
# string which identifies the source, then an optional polling interval in
# seconds. The source will be polled at this interval on average.
# If the polling interval is omitted, 15sec is asssumed.
#
# A list of machines which service the data source follows, in the
# format ip:port, or name:port. If a port is not specified then 8649
# (the default gmond port) is assumed.
# default: There is no default value
#
# 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
# data_source "another source" 1.3.4.7:8655 1.3.4.8
data_source "my cluster" localhost
#
# Round-Robin Archives
# You can specify custom Round-Robin archives here (defaults are listed below)
#
# RRAs "RRA:AVERAGE:0.5:1:244" "RRA:AVERAGE:0.5:24:244" "RRA:AVERAGE:0.5:168:244" "RRA:AVERAGE:0.5:672:244" \
# "RRA:AVERAGE:0.5:5760:374"
#
#
#-------------------------------------------------------------------------------
# Scalability mode. If on, we summarize over downstream grids, and respect
# authority tags. If off, we take on 2.5.0-era behavior: we do not wrap our output
# in <GRID></GRID> tags, we ignore all <GRID> tags we see, and always assume
# we are the "authority" on data source feeds. This approach does not scale to
# large groups of clusters, but is provided for backwards compatibility.
# default: on
# scalable off
#
#-------------------------------------------------------------------------------
# The name of this Grid. All the data sources above will be wrapped in a GRID
# tag with this name.
# default: Unspecified
# gridname "MyGrid"
#
#-------------------------------------------------------------------------------
# The authority URL for this grid. Used by other gmetads to locate graphs
# for our data sources. Generally points to a ganglia/
# website on this machine.
# default: "http://hostname/ganglia/",
# where hostname is the name of this machine, as defined by gethostname().
# authority "http://mycluster.org/newprefix/"
#
#-------------------------------------------------------------------------------
# List of machines this gmetad will share XML with. Localhost
# is always trusted.
# default: There is no default value
# trusted_hosts 127.0.0.1 169.229.50.165 my.gmetad.org
#
#-------------------------------------------------------------------------------
# If you want any host which connects to the gmetad XML to receive
# data, then set this value to "on"
# default: off
# all_trusted on
#
#-------------------------------------------------------------------------------
# If you don't want gmetad to setuid then set this to off
# default: on
# setuid off
#
#-------------------------------------------------------------------------------
# User gmetad will setuid to (defaults to "nobody")
# default: "nobody"
# setuid_username "nobody"
#
#-------------------------------------------------------------------------------
# The port gmetad will answer requests for XML
# default: 8651
# xml_port 8651
#
#-------------------------------------------------------------------------------
# The port gmetad will answer queries for XML. This facility allows
# simple subtree and summation views of the XML tree.
# default: 8652
# interactive_port 8652
#
#-------------------------------------------------------------------------------
# The number of threads answering XML requests
# default: 4
# server_threads 10
#
#-------------------------------------------------------------------------------
# Where gmetad stores its round-robin databases
# default: "/var/lib/ganglia/rrds"
# rrd_rootdir "/some/other/place"
by 有限会社ケイアイエム(http://www.keiaiemu.com/)