Apacheの説明は今回は省きます。~
準備:ユーザー作成とグループ作成。
# useradd nagios
# passwd nagios
# groupadd nagcmd
# usermod -G nagcmd nagios
# usermod -G nagcmd apache
まず、Nagios3.0.3のインストール
#nagios-3.0.3-ja-utf8.patch
日本語パッチあて。
CDでNagiosのディレクトリへ
パッチをNagiosの展開ディレクトリに置いておく。
gzip -dc nagios-3.0.3-ja-utf8.patch.gz | patch -p0
参考:http://nagios.x-trans.jp
#Nagios3.0.3
CDでNagiosのディレクトリで
./configure --prefix=/usr/local/nagios --with-cgiurl=/nagios/cgi-bin
--with-htmurl=/nagios/ --with-nagios-user=nagios
--with-nagios-roup=nagios --with-command-group=nagcmd
↑スペースでオプションの間をあけ続けて入力する。~
Configureで設定した内容が下記のように最後の方に表示されます。
*** Configuration summary for nagios 3.0.3 06-25-2008 ***:
General Options:
-------------------------
Nagios executable: nagios
Nagios user/group: nagios,nagios
Command user/group: nagios,nagcmd
Embedded Perl: no
Event Broker: yes
Install ${prefix}: /usr/local/nagios
Lock file: ${prefix}/var/nagios.lock
Check result directory: ${prefix}/var/spool/checkresults
Init directory: /etc/rc.d/init.d
Apache conf.d directory: /etc/httpd/conf.d
Mail program: /bin/mail
Host OS: linux-gnu
Web Interface Options:
------------------------
HTML URL: http://localhost/nagios//
CGI URL: http://localhost/nagios/cgi-bin/
Traceroute (used by WAP): /bin/traceroute
make all
make install
make install-init
make install-commandmode
make install-config
# nagios-plugins-1.4.12
つづけて、pluginsインストール。
CDでnagios-plugins-1.4.12のディレクトリへ
./configure
make
make install
#Apacheの設定の追記
下記設定を、httpd.confに追記する。
ちなみに今回の私の環境では、/etc/httpd/conf.d/nagios.confに
なっていた。おそらくこれはOSやApacheのインストールの仕方に
よって違うと思います。
ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin
<Directory "/usr/local/nagios/sbin">
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
</Directory>
Alias /nagios /usr/local/nagios/share
<Directory "/usr/local/nagios/share">
Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
</Directory>
で、上記に書いているように/usr/local/nagios/etc/htpasswd.users
にユーザー認証の設定をしているので。。。
# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
を実行する。パスワードを任意のものにする。
設定は以上であるが以下の項目で私はハマりました。
AppcheでURL表示すると、Internal Server Errorが表示される場合~
例:http://localhost[サーバーのIP or 名前]/nagios
chcon -R -h -t httpd_sys_content_t /usr/local/nagios/sbin
URL:http://www.stackasterisk.jp/tech/systemConstruction/seLinux05_03.jsp
#上記Configureでインストールすると下記インストール配置になる。
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
nagiosの動作チェックを上記のように行う。
最後に、Init.dに登録して完了。
# chkconfig --add httpd
# chkconfig --list httpd
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
# chkconfig --add nagios
# chkconfig --list nagios
nagios 0:off 1:off 2:off 3:on 4:on 5:on 6:off
のようになるが、基本起動時に実行してほしいので、
# chkconfig --level 2 nagios on
# chkconfig --list nagios
nagios 0:off 1:off 2:on 3:on 4:on 5:on 6:off
サーバーを再起動して、URLが表示されているか確認してみよう! 次回:cfg編集をやってみようっと。 ちなみに、上記設定だと。。。。悩むよねきっと。。。 この続きが見たい人→作成中> アクセス数| - |