●Xymon(旧Hobbit)クライアント(4.2.3)のインストールについて
Hobbitサーバのインストールに続いてHobbitクライアントのインストール方法を説明しよう。HobbitはUnix系OSならどれでも利用できるます。クラインとの場合、Hobbitサーバとは別マシンにインストールすることになります。
まずはHobbitを実行するユーザーを作成します。
ダウンロードしたファイルを/usr/local/srcディレクトリに保存します。
なお、クライアント側で管理する場合はpcre-develライブラリが必要となります。
アクセスしやすいようにxymonの構成ファイルとログへのシンボリック・リンクを作成します。
●クライアント(4.2.3)用起動スクリプトの設定
上記のApache設定まで行えば、「http://ドメイン名/xymon/」で正常に画面が表示されるはずです。
引き続いて起動スクリプトの設定をします。管理を楽にするために起動スクリプトを「/etc/rc.d/init.d」配下に設置して起動/終了の管理が行えるようにします。
最初に起動スクリプトをコピーします。
【修正後】
xymon-client-4.2.3.txt
chkconfigに追加し、リスト表示がされるかを確認します。同時にきちんと起動するかも確認してみます。
●Xymonクライアント(4.3.x)のインストールについて
まずはXymonを実行するユーザーを作成します。
ダウンロードしたファイルを/usr/local/srcディレクトリに保存します。
「Installation complete.」と表示されればインストール完了です。
アクセスしやすいようにxymonの構成ファイルとログへのシンボリック・リンクを作成します。
起動スクリプトを作成すれば、xymonユーザでinstalldir/client/bin/runclient.shを実行しなくても、serviceから起動できるようになります。
Xymonサーバにこのクライアントを登録します。Xymonサーバのinstalldir/server/etc/hosts.cfgにクライアントの情報を一行追加するだけです。
connはサーバ→クライアントのICMP通信をしていますが、cpuやmemoryはクライアントからサーバに情報を送信していますので、cpuをクリックしてデータが表示されていればクライアント→サーバのTCP通信は確立されています。
もし表示されていない場合は、クライアント側のinstalldir/client/logs/hobbtclient.logを確認します。
下記はサーバに対して接続出来なかった場合のログです。ポートは開放していたのですが、installdir/client/etc/xymonclient.cfgで「XYMSRV="***.***.***.***」が自分自身が設定されていたため、Xymonサーバに設定し直しました。
●make実行時にエラーが表示される
make実行時に下記のように表示されることがあります。
●クライアント(4.3.x)用起動スクリプトの設定
引き続いて起動スクリプトの設定をします。管理を楽にするために起動スクリプトを「/etc/rc.d/init.d」配下に設置して起動/終了の管理が行えるようにします。
xymon-client-4.3.x.txt
chkconfigに追加し、リスト表示がされるかを確認します。同時にきちんと起動するかも確認してみます。
Hobbitサーバのインストールに続いてHobbitクライアントのインストール方法を説明しよう。HobbitはUnix系OSならどれでも利用できるます。クラインとの場合、Hobbitサーバとは別マシンにインストールすることになります。
まずはHobbitを実行するユーザーを作成します。
# useradd -c 'Hobbit Administrator' xymon ← ユーザ「xymon」の作成 # passwd xymon ← 「xymon」のパスワードを設定 ユーザ xymon のパスワードを変更。 新しいパスワード: ← パスワード入力 新しいパスワードを再入力してください: ← パスワード再入力 passwd: 全ての認証トークンが正しく更新できました。http://sourceforge.net/projects/xymon/files/Xymon/4.2.3/xymon-4.2.3.tar.gz/downloadから、xymon-4.2.3.tar.gzをダウンロードします。
ダウンロードしたファイルを/usr/local/srcディレクトリに保存します。
# cd /usr/local/src # tar xvzf xymon-4.2.3.tar.gz # cd xymon-4.2.3 # ./configure --clientクライアント設定ファイルをサーバー側で管理するかクライアント側で管理するかの設定です。今回はサーバー側で管理し、管理者が一括して管理を行えるようにするため、デフォルトのままにします。
なお、クライアント側で管理する場合はpcre-develライブラリが必要となります。
Configuration script for Hobbit client This script asks a few questions and builds a Makefile to compile Hobbit Checking your make-utility Hobbit normally keeps all of the client configuration files on the Hobbit server. If you prefer, it is possible to use a local client configuration file instead - if so, answer 'client' to the next question. NB: Local configuration requires the PCRE libs on each host. Server side client configuration, or client side [server] ? [Enter] Checking for Large File Support ... Large File Support OK What userid will be running Hobbit [hobbit] ? [Enter] Found passwd entry for user hobbit:x:504:504:Hoobit Administrator:/home/xymon:/bin/bash Where do you want the Hobbit installation [/home/xymon] ? [Enter] OK, will configure to use /home/xymon as the Xymon toplevel directory What is the IP-address of your Hobbit server [127.0.0.1] ? 192.168.0.1 ← 管理するサーバのIPアドレスを入力する Using Linux Makefile settings Created Makefile with the necessary information to build Hobbit Some defaults are used, so do look at the Makefile before continuing. Configuration complete - now run make (GNU make) to build the tools # make # make install問題が無ければインストール完了です。
アクセスしやすいようにxymonの構成ファイルとログへのシンボリック・リンクを作成します。
# ln -s /home/xymon/client/etc /etc/xymon-client # ln -s /home/xymon/client/logs /var/log/xymon-client
●クライアント(4.2.3)用起動スクリプトの設定
上記のApache設定まで行えば、「http://ドメイン名/xymon/」で正常に画面が表示されるはずです。
引き続いて起動スクリプトの設定をします。管理を楽にするために起動スクリプトを「/etc/rc.d/init.d」配下に設置して起動/終了の管理が行えるようにします。
最初に起動スクリプトをコピーします。
# cp -p /usr/local/src/xymon-4.2.3/rpm/hobbit-client.init /etc/rc.d/init.d/xymon-client # chown root:root /etc/rc.d/init.d/xymon-client # chmod 755 /etc/rc.d/init.d/xymon-clientここで気を付けなければ行けないことがあります。この起動スクリプトはhobbit時代を踏襲したままのようで、スクリプトに一部不備があります。変数の値や起動用のshellスクリプトまでのパスなどを変更します。
【修正後】
xymon-client-4.2.3.txt
#! /bin/sh # # hobbit-client This shell script takes care of starting and stopping # the hobbit client. # # chkconfig: 2345 80 20 # description: hobbit is a network monitoring tool that allows \ # you to monitor hosts and services. This client reports local \ # system statistics (cpu-, memory-, disk-utilisation etc) \ # to the Hobbit server. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/home/xymon/client/runclient.sh NAME=xymon-client DESC=xymon-client test -x $DAEMON || exit 0 CMD="$1" # Include hobbit-client defaults if available DMNOPTS="" if [ -f /etc/default/xymon-client ] ; then . /etc/default/xymon-client else echo "Installation failure - missing /etc/default/xymon-client" exit 1 fi if [ "$HOBBITSERVERS" = "" ]; then echo "Please configure HOBBITSERVERS in /etc/default/xymon-client" exit 1 fi set $HOBBITSERVERS if [ $# -eq 1 ]; then echo "BBDISP=\"$HOBBITSERVERS\"" >/var/run/hobbitclient-runtime.cfg echo "BBDISPLAYS=\"\"" >>/var/run/hobbitclient-runtime.cfg else echo "BBDISP=\"0.0.0.0\"" >/var/run/hobbitclient-runtime.cfg echo "BBDISPLAYS=\"$HOBBITSERVERS\"" >>/var/run/hobbitclient-runtime.cfg fi if [ "$CLIENTHOSTNAME" != "" ]; then DMNOPTS="${DMNOPTS} --hostname=${CLIENTHOSTNAME}" fi if [ "$CLIENTOS" != "" ]; then DMNOPTS="${DMNOPTS} --os=${CLIENTOS}" fi set -e case "$CMD" in start) echo -n "Starting $DESC: " su -c "$DAEMON $DMNOPTS start" - "$NAME" echo "$NAME." ;; stop) echo -n "Stopping $DESC: " su -c "$DAEMON stop" - "$NAME" echo "$NAME." ;; restart) echo -n "Restarting $DESC: " su -c "$DAEMON stop" - "$NAME" su -c "$DAEMON $DMNOPTS start" - "$NAME" echo "$NAME." ;; *) N=/etc/init.d/$NAME # echo "Usage: $N {start|stop|restart}" >&2 echo "Usage: $N {start|stop|restart}" >&2 exit 1 ;; esac exit 0
chkconfigに追加し、リスト表示がされるかを確認します。同時にきちんと起動するかも確認してみます。
# chkconfig --add xymon-client # chkconfig --list | grep xymon-client xymon 0:off 1:off 2:on 3:on 4:on 5:on 6:off # service xymon-client start Starting xymon-client: Hobbit started xymon-client.問題なく起動すればスクリプトの完成です。
●Xymonクライアント(4.3.x)のインストールについて
まずはXymonを実行するユーザーを作成します。
# useradd -c 'Xymon Administrator' xymon ← ユーザ「xymon」の作成 # passwd xymon ← 「xymon」のパスワードを設定 ユーザ xymon のパスワードを変更。 新しいパスワード: ← パスワード入力 新しいパスワードを再入力してください: ← パスワード再入力 passwd: 全ての認証トークンが正しく更新できました。http://sourceforge.net/projects/xymon/から、xymon-4.3.0.tar.gzをダウンロードします。
ダウンロードしたファイルを/usr/local/srcディレクトリに保存します。
# cd /usr/local/src
# wget http://sourceforge.net/projects/xymon/files/Xymon /4.3.0/xymon-4.3.0.tar.gz/download
# tar xvzf xymon-4.3.0.tar.gz
# cd xymon4.3.0
# ./configure --client
以下のように質問されるが、デフォルトで問題なければ[Enter]でよい。
Configuration script for Xymon client
This script asks a few questions and builds a Makefile to compile Xymon
Checking your make-utility
Xymon normally keeps all of the client configuration files
on the Xymon server. If you prefer, it is possible to use
a local client configuration file instead - if so, answer
'client' to the next question.
NB: Local configuration requires the PCRE libs on each host.
Server side client configuration, or client side [server] ?
[Enter]
Checking for Large File Support ...
Large File Support OK
Checking for clock_gettime() requiring librt ...
clock_gettime() requires librt
What userid will be running Xymon [xymon] ?
[Enter]
Found passwd entry for user xymon:x:501:501:Hobbit Administrator:/home/xymon:/bin/bash
Where do you want the Xymon installation [/home/xymon] ?
[Enter]
OK, will configure to use /home/xymon as the Xymon toplevel directory
What is the IP-address of your Xymon server [127.0.0.1] ?
192.168.0.1 ← Xymonサーバのアドレスを入力
Using Linux Makefile settings
Created Makefile with the necessary information to build Xymon
Some defaults are used, so do look at the Makefile before continuing.
Configuration complete - now run make -s (GNU make) to build the tools
# make
# make install
# wget http://sourceforge.net/projects/xymon/files/Xymon /4.3.0/xymon-4.3.0.tar.gz/download
# tar xvzf xymon-4.3.0.tar.gz
# cd xymon4.3.0
# ./configure --client
以下のように質問されるが、デフォルトで問題なければ[Enter]でよい。
Configuration script for Xymon client
This script asks a few questions and builds a Makefile to compile Xymon
Checking your make-utility
Xymon normally keeps all of the client configuration files
on the Xymon server. If you prefer, it is possible to use
a local client configuration file instead - if so, answer
'client' to the next question.
NB: Local configuration requires the PCRE libs on each host.
Server side client configuration, or client side [server] ?
[Enter]
Checking for Large File Support ...
Large File Support OK
Checking for clock_gettime() requiring librt ...
clock_gettime() requires librt
What userid will be running Xymon [xymon] ?
[Enter]
Found passwd entry for user xymon:x:501:501:Hobbit Administrator:/home/xymon:/bin/bash
Where do you want the Xymon installation [/home/xymon] ?
[Enter]
OK, will configure to use /home/xymon as the Xymon toplevel directory
What is the IP-address of your Xymon server [127.0.0.1] ?
192.168.0.1 ← Xymonサーバのアドレスを入力
Using Linux Makefile settings
Created Makefile with the necessary information to build Xymon
Some defaults are used, so do look at the Makefile before continuing.
Configuration complete - now run make -s (GNU make) to build the tools
# make
# make install
「Installation complete.」と表示されればインストール完了です。
アクセスしやすいようにxymonの構成ファイルとログへのシンボリック・リンクを作成します。
# ln -s /home/xymon/client/etc /etc/xymon-client # ln -s /home/xymon/client/logs /var/log/xymon-clientマシン起動時にxymonを自動起動させる起動スクリプトとそれが使うファイル、xymonのログをローテーションさせるLogrotateの設定ファイルをそれぞれ編集し、コピーします。これらはtar.gzの解凍先のrpmディレクトリ内にあります。
# chown root:root rpm/*
# chmod 644 rpm/*
# sed -i 's!^DAEMON=.*$!DAEMON=/home/xymon/client/runclient.sh!' rpm/xymon-client.init
# cp rpm/xymon-client.init /etc/init.d/xymon-client
# chmod 755 /etc/init.d/xymon-client
# chkconfig xymon-client on
# sed -i 's/^XYMONSERVERS.*$/XYMONSERVERS="192.168.0.100"/' rpm/xymon-client.default
↑ IPアドレスは個人環境のXymonサーバに合わせる
# cp rpm/xymon-client.default /etc/default/xymon-client
# sed -i 's!/var/log/xymon!/var/log/xymon-client/!' rpm/xymon.logrotate
# sed -i 's!^\(.*\)/etc/init\.d/xymon rotate!\1kill -HUP `cat /var/log/xymon-client/clientlaunch.hostname.pid`!' rpm/xymon.logrotate
# cp rpm/xymon.logrotate /etc/logrotate.d/xymon-client
# chmod 644 rpm/*
# sed -i 's!^DAEMON=.*$!DAEMON=/home/xymon/client/runclient.sh!' rpm/xymon-client.init
# cp rpm/xymon-client.init /etc/init.d/xymon-client
# chmod 755 /etc/init.d/xymon-client
# chkconfig xymon-client on
# sed -i 's/^XYMONSERVERS.*$/XYMONSERVERS="192.168.0.100"/' rpm/xymon-client.default
↑ IPアドレスは個人環境のXymonサーバに合わせる
# cp rpm/xymon-client.default /etc/default/xymon-client
# sed -i 's!/var/log/xymon!/var/log/xymon-client/!' rpm/xymon.logrotate
# sed -i 's!^\(.*\)/etc/init\.d/xymon rotate!\1kill -HUP `cat /var/log/xymon-client/clientlaunch.hostname.pid`!' rpm/xymon.logrotate
# cp rpm/xymon.logrotate /etc/logrotate.d/xymon-client
起動スクリプトを作成すれば、xymonユーザでinstalldir/client/bin/runclient.shを実行しなくても、serviceから起動できるようになります。
# service xymon-client start Starting xymon-client: Xymon client for linux started on client.bigbang.dyndns.org xymon-client.XymonクライアントはXymonサーバのTCP/1984ポート宛てにデータを送信します。ファイアウォールを設定している場合はTCP/1984を開放するようにします。
Xymonサーバにこのクライアントを登録します。Xymonサーバのinstalldir/server/etc/hosts.cfgにクライアントの情報を一行追加するだけです。
# echo '192.168.0.1 client.bigbang.dyndns.org' >> /etc/opt/xymon/hosts.cf
# echo '192.168.0.1 client.bigbang.dyndns.org' >> /etc/xymon-server/hosts.cfg
5分もすると監視画面にクライアントの表示が追加されます。
connはサーバ→クライアントのICMP通信をしていますが、cpuやmemoryはクライアントからサーバに情報を送信していますので、cpuをクリックしてデータが表示されていればクライアント→サーバのTCP通信は確立されています。
もし表示されていない場合は、クライアント側のinstalldir/client/logs/hobbtclient.logを確認します。
下記はサーバに対して接続出来なかった場合のログです。ポートは開放していたのですが、installdir/client/etc/xymonclient.cfgで「XYMSRV="***.***.***.***」が自分自身が設定されていたため、Xymonサーバに設定し直しました。
2011-03-28 21:31:11 Whoops ! Failed to send message (Connection failed) 2011-03-28 21:31:11 -> Could not connect to Xymon daemon@192.168.0.23:1984 (Connection refused) 2011-03-28 21:31:11 -> Recipient '192.168.0.23', timeout 15 2011-03-28 21:31:11 -> 1st line: 'client *******,bigbang,dyndns,org.linux linux
●make実行時にエラーが表示される
make実行時に下記のように表示されることがあります。
...lib/timefunc.c:55: undefined reference to `clock_gettime'この場合は下記のように「build/Makefile.rules」を編集します。
ifeq ($(CLIENTONLY),yes) BUILDTARGETS = client CFLAGS += -DCLIENTONLY=1 CFLAGS += -lrt Add the 2nd CFLAGS line.
●クライアント(4.3.x)用起動スクリプトの設定
引き続いて起動スクリプトの設定をします。管理を楽にするために起動スクリプトを「/etc/rc.d/init.d」配下に設置して起動/終了の管理が行えるようにします。
xymon-client-4.3.x.txt
#! /bin/sh # # xymon-client This shell script takes care of starting and stopping # the Xymon client. # # chkconfig: 2345 80 20 # description: Xymon is a network monitoring tool that allows \ # you to monitor hosts and services. This client reports local \ # system statistics (cpu-, memory-, disk-utilisation etc) \ # to the Xymon server. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/home/xymon/client/runclient.sh NAME=xymon-client DESC=xymon-client test -x $DAEMON || exit 0 CMD="$1" # Include xymon-client defaults if available DMNOPTS="" if [ -f /etc/default/xymon-client ] ; then . /etc/default/xymon-client else echo "Installation failure - missing /etc/default/xymon-client" exit 1 fi if [ "$XYMONSERVERS" = "" ]; then echo "Please configure XYMONSERVERS in /etc/default/xymon-client" exit 1 fi set $XYMONSERVERS if [ $# -eq 1 ]; then echo "XYMSRV=\"$XYMONSERVERS\"" >/var/run/xymonclient-runtime.cfg echo "XYMSERVERS=\"\"" >>/var/run/xymonclient-runtime.cfg else echo "XYMSRV=\"0.0.0.0\"" >/var/run/xymonclient-runtime.cfg echo "XYMSERVERS=\"$XYMONSERVERS\"" >>/var/run/xymonclient-runtime.cfg fi if [ "$CLIENTHOSTNAME" != "" ]; then DMNOPTS="${DMNOPTS} --hostname=${CLIENTHOSTNAME}" fi if [ "$CLIENTOS" != "" ]; then DMNOPTS="${DMNOPTS} --os=${CLIENTOS}" fi set -e case "$CMD" in start) echo -n "Starting $DESC: " su -c "$DAEMON $DMNOPTS start" - xymon echo "$NAME." ;; stop) echo -n "Stopping $DESC: " su -c "$DAEMON stop" - xymon echo "$NAME." ;; restart) echo -n "Restarting $DESC: " su -c "$DAEMON stop" - xymon su -c "$DAEMON $DMNOPTS start" - xymon echo "$NAME." ;; *) N=/etc/init.d/$NAME # echo "Usage: $N {start|stop|restart}" >&2 echo "Usage: $N {start|stop|restart}" >&2 exit 1 ;; esac exit 0
# chkconfig --add xymon-client # chkconfig --list | grep xymon-client xymon 0:off 1:off 2:on 3:on 4:on 5:on 6:off # service xymon-client start Starting xymon-client: Hobbit started xymon-client.問題なく起動すればスクリプトの完成です。