サーバ監視を行うためHobbitサーバをインストールしてみます。
はじめに必要なパッケージをインストールします。
| # yum install openldap-devel openssl-devel pcre-devel |
その他のパッケージをインストールする為、レポジトリの追加を行います。
GPG-KEYのインポートを行います。
| # rpm --import http://ftp.riken.go.jp/pub/Linux/dag/RPM-GPG-KEY.dag.txt |
次にレポジトリ・ファイルを作成します。
# vi /etc/yum.repos.d/dag.repo
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://ftp.riken.jp/Linux/dag/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
gpgkey=http://ftp.riken.go.jp/pub/Linux/dag/RPM-GPG-KEY.dag.txt
enabled=0 |
設定したレポジトリを有効にするようにしてインストールします。
| # yum --enablerepo=dag install fping rrdtool-devel |
インストールが終わったら、Hobbitを実行するユーザーを作成作成します。
# useradd -c 'Hobbit Admini' hobbit
# passwd hobbit |
fpingのグループとパーミッションを変更します。
# chgrp hobbit /usr/sbin/fping
# chmod g+x /usr/sbin/fping |
次にhobbitをダウンロードします。
# cd /usr/local/src
# wget http://downloads.sourceforge.net/hobbitmon/hobbit-4.2.0.tar.gz?modtime=1155195064&big_mirror=0 |
ダウンロードしたTAR.GZファイルを解凍し、解凍先のディレクトリに移動します。
# tar zxf hobbit-4.2.0.tar.gz
# cd hobbit-4.2.0 |
さてインストールしてみます。ホスト名とIPアドレスは環境に合わせてください。
# ./configure
Configuration script for Hobbit
This script asks a few questions and builds a Makefile to compile Hobbit
Checking your make-utility
Checking pre-requisites for building Hobbit
Checking for fping ...
Hobbit has a built-in ping utility (hobbitping)
However, it is not yet fully stable and therefore it
may be best to use the external fping utility instead.
I found fping in /usr/sbin/fping
Do you want to use it [Y/n] ?
y
Checking to see if '/usr/sbin/fping 127.0.0.1' works ...
127.0.0.1 is alive
OK, will use '/usr/sbin/fping' for ping tests
NOTE: If you are using an suid-root wrapper, make sure the 'hobbit'
user is also allowed to run fping without having to enter passwords.
For 'sudo', add something like this to your 'sudoers' file:
hobbit: ALL=(ALL) NOPASSWD: /usr/local/sbin/fping
Checking for RRDtool ...
test-rrd.c: In function ‘main’:
test-rrd.c:30: error: too few arguments to function ‘rrd_graph’
make: *** [test-compile] エラー 1
Not RRDtool 1.0.x, checking for 1.2.x
Found RRDtool include files in /usr/include
Found RRDtool libraries in /usr/lib
Linking RRD with PNG library: -L/usr/lib -lpng
Checking for PCRE ...
Found PCRE include files in /usr/include
Found PCRE libraries in /usr/lib
Checking for OpenSSL ...
Found OpenSSL include files in /usr/include
Found OpenSSL libraries in /usr/lib
Hobbit can use the OpenSSL library to test SSL-enabled services
like POP3S, IMAPS, NNTPS and TELNETS. If you have the OpenSSL
library installed, I recommend that you enable this.
Do you want to be able to test SSL-enabled services (y) ?
y
Checking for LDAP ...
test-ldap.c: In function ‘main’:
test-ldap.c:16: 警告: implicit declaration of function ‘ldap_init’
test-ldap.c:16: 警告: assignment makes pointer from integer without a cast
Found LDAP include files in /usr/include
Found LDAP libraries in /usr/lib
Hobbit can use your OpenLDAP LDAP client library to test LDAP servers.
Do you want to be able to test LDAP servers (y) ?
y
Enable experimental support for LDAP/SSL (OpenLDAP 2.x only) (y) ?
y
Checking for Large File Support ...
Large File Support OK
Setting up for a Hobbit server
What userid will be running Hobbit [hobbit] ?
Found passwd entry for user hobbit:x:501:501:Hobbit
Admin:/home/hobbit:/bin/bash
Where do you want the Hobbit installation [/home/hobbit] ?
OK, will configure to use /home/hobbit as the Hobbit toplevel directory
What URL will you use for the Hobbit webpages [/hobbit] ?
Where to put the Hobbit CGI scripts [/home/hobbit/cgi-bin] ?
(Note: This is the filesystem directory - we will get to the URL shortly)
What is the URL for the Hobbit CGI directory [/hobbit-cgi] ?
(Note: This is the URL - NOT the filesystem directory)
********************** SECURITY NOTICE ****************************
If your Hobbit server is accessible by outsiders, then you should
restrict access to the CGI scripts that handle enable/disable of
hosts, and acknowledging of alerts. The easiest way to do this is
to put these in a separate CGI directory and require a password to
access them.
Even if your Hobbit server is on a secured, internal network, you
may want to have some operations (like disabling a host) be password-
protected - that lets you see who disabled or acknowledged an alert.
Where to put the Hobbit Administration CGI scripts [/home/hobbit/cgi-secure] ?
(Note: This is the filesystem directory - we will get to the URL shortly)
What is the URL for the Hobbit Administration CGI directory [/hobbit-seccgi] ?
(Note: This is the URL - NOT the filesystem directory)
** Note that you may need to modify your webserver configuration.
** After installing, see /home/hobbit/server/etc/hobbit-apache.conf for
an example configuration.
To generate Hobbit availability reports, your webserver
must have write-access to a directory below the Hobbit
top-level directory. I can set this up if you tell me
what group-ID your webserver runs with. This is typically
'nobody' or 'apache' or 'www-data'
If you dont know, just hit ENTER and we will handle it later.
What group-ID does your webserver use ?
apache
Where to put the Hobbit logfiles [/var/log/hobbit] ?
What is the name of this host [cent52sv.fujitoko.com] ?
cent52sv
What is the IP-address of this host [127.0.0.1] ?
192.168.0.15
** NOTE: Using 127.0.0.1 (loopback), but it is probably not what you want **
Where should I install the Hobbit man-pages (/usr/local/man) ?
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 |
つづいて、いくつかの細かい設定も行います。
まずはアクセスしやすいようにHobbitの構成ファイルへのシンボリック・リンクを /etc に作ります。
| # ln -s /home/hobbit/server/etc /etc/hobbit |
apache構成ファイルをコピーし、apacheのreloadを行います。
# cp /etc/hobbit/hobbit-apache.conf /etc/httpd/conf.d/hobbit.conf
# /etc/init.d/httpd reload |
管理用CGIにはBASIC認証が行われるため、パスワードを設定します。
#htpasswd -c /home/hobbit/server/etc/hobbitpasswd hoge
New password:
Re-type new password:
Adding password for user hoge |
マシン起動時にHobbitも自動起動させる起動スクリプトを編集し、Hobbitのログをローテーションさせる
Logrotateの設定ファイルをそれぞれコピーしておきます。
# chown root:root rpm/*
# chmod 644 rpm/*
# cp rpm/hobbit-init.d /etc/init.d/hobbit
# chmod 755 /etc/init.d/hobbit
# cp rpm/hobbit.logrotate /etc/logrotate.d/hobbit
# chgrp hobbit /var/log/messages
# chown 640 /var/log/messages |
hobbitoを起動します。
自動起動設定をします。
ブラウザで
http://サーバ名/hobbit/
にアクセスして確認してみます。
|