CentOS5でNagios3.04構築【インストール編】

以前Nagios2シリーズを入れていたのだがDAGリポジトリでNagios3シリーズが追加されていたので
早速、インストールして監視出来るところまで構築しましたので自分用メモの意味合いが強いですが
ひとまず記事に・・・


Apache構築済みである事が前提条件です。


1:DAG設定用ファイル作成
# vi /etc/yum.repos.d/dag.repo


2:上記ファイルに下記内容を記載。

[dag]
name=Dag RPM Repository for CentOS5
baseurl=http://ftp.riken.jp/Linux/dag/redhat/el5/en/$basearch/dag/
enabled=1
gpgcheck=1


3:GPGキーのインポート
# rpm --import http://ftp.riken.jp/Linux/dag/RPM-GPG-KEY.dag.txt


4:nagiosインストール
# yum -y install nagios nagios-plugins


5:nagios.cfgにて一点修正
俺だけの環境かと思ったのだけど、何回やっても同じ風にconfigファイルが出来上がるので
もしかしたら、今回リポジトリにあがってるバージョンがそうなのかも・・・


# vi /etc/nagios/nagios.cfg
550行目付近の下記項目をコメントアウト

time_change_threshold=


6:ログインパスワード作成
# htpasswd -c /etc/nagios/htpasswd.users nagiosadmin
にてパスワード作成。


この場合、ユーザー名がnagiosadminだがユーザー名を変更したかったらcgi.cfg内の
【authorized】からはじまる行の最後に記載してある「nagiosadmin」を変更していく。


7:取り敢えず起動
configチェック(これからもconfig弄る度に使用するので要チェック)
# /usr/bin/nagios -v /etc/nagios/nagios.cfg

Total Warnings: 0
Total Errors: 0

Things look okay - No serious problems were detected during the pre-flight check

となれば問題なし。

Nagios 3.0.4
Copyright (c) 1999-2008 Ethan Galstad (http://www.nagios.org)
Last Modified: 10-15-2008
License: GPL

Reading configuration data...

Error: Invalid host object directive 'nost_name'.
Error: Could not add object property in file '/etc/nagios/objects/server.cfg' on line 41.

> One or more problems was encountered while processing the config files...

Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.

この場合はconfigがおかしいよ!って事なので上記場合には
【/etc/nagios/objects/server.cfg】の41行目を確認しろって事です。
また、その一つ上の行で【Error: Invalid host object directive 'nost_name'.】と出てますので
「nost_name」ってのが駄目って事ですね。(当然ながら「host_name」が正解です。


一通り問題なくなったらいよいよ起動します。


# /etc/rc.d/init.d/nagios start
Running configuration check...done.
Starting nagios: done.


これで起動完了♪
http://サーバー名/nagios/ へアクセス。
ベーシック認証のダイアログが表示されたらユーザー名、パスワードを入力して下さい。


無事に下記画面が表示されれば成功です♪


監視対象の追加からは次回・・・