trends.cgiが見つからない [nagios]
OS:VineLinux 4.1
version:nagios-2.9
nagiosのメニューから、Reportingのtrendsを選択しても、trends.cgiが見つからないというエラーが発生。
The requested URL /nagios/cgi-bin/trends.cgi was not found on this server.
どうも、gd関係のライブラリがないとだめらしい。
よくよくみると、configureのメッセージが警告を出していた。
VineLinux 4.1 ではデフォルトではインストールされないらしい。
ライブラリ関係は、aptで入れてしまうのが楽ちん。
# apt-get install gd
# apt-get install gd-devel
# apt-get install libpng-devel
nagiosをもう一回ビルドし直してインストールすればOK。
nagiosのインストール [nagios]
nagios(http://nagios.org/)をソースからインストール
OS:VineLinux 4.1
nagios:nagios-2.9
webserver:apache-2.2.4
nagios用のユーザとインストール先のディレクトリを作成する。
# groupadd nagios
# useradd -d /usr/local/nagios -g nagios -m nagios
# usermod -G nagios daemon
※ユーザとグループおよびインストール先のディレクトリは、nagiosインストール時のデフォルトとする。
※webサーバからもnagiosのディレクトリにアクセスできる必要があるので、httpdのユーザであるdaemonをnagiosグループに追加する。
ソースを解凍してビルドする。
# tar xzf nagios-2.9.tar.gz
# cd nagios-2.9
# ./configure
※デフォルトで以下のオプションが設定されるのでとりあえずそのまま何も指定しない
--prefix=/usr/local/nagios ・・・ インストールディレクトリ
--with-cgiurl=/nagios/cgi ・・・ CGIのRUL
--with-htmurl=/nagios ・・・ nagiosにアクセスする時のURL
--with-nagios-user=nagios ・・・ nagiosを動かすユーザ
--with-nagios-group=nagios ・・・ nagiosのディレクトリにアクセスを許可するグループ
# make all
# make install ・・・ nagios本体とHTMLドキュメントのインストール
# make install-init ・・・ 起動スクリプトインストール
# make install-commandmode ・・・ 外部コマンド?のインストールとパーミッションの設定
# make install-config・・・ 設定ファイルのサンプルインストール
プラグインをインストールする。
# tar xzf nagios-plugins-1.4.8.tar.gz
# cd nagios-plugins-1.4.8
# ./configure
# make all
# make install
設定ファイルを作成する。
まずは、とりあえず動かすために、サンプルをそのまま使ってみる。
nagiosの認証関係もすっ飛ばす。
# cd /usr/local/nagios/etc/
# cp -p cgi.cfg-sample cgi.cfg
# cp -p commands.cfg-sample commands.cfg
# cp -p localhost.cfg-sample localhost.cfg
# cp -p nagios.cfg-sample nagios.cfg
# cp -p resource.cfg-sample resource.cfg
# vi /usr/local/nagios/etc/cgi.cfg
use_authentication=10
httpdの設定を変更する。
nagios用の設定ファイル作成。
# vi /usr/local/apache2/conf/extra/httpd-nagios.conf
ScriptAlias /nagios/cgi-bin/ /usr/local/nagios/sbin/
<Directory "/usr/local/nagios/sbin/">
AllowOverride AuthConfig
Options ExecCGI
Order allow,deny
Allow from all
</Directory>
Alias /nagios/ /usr/local/nagios/share/
<Directory "/usr/local/nagios/share">
AllowOverride AuthConfig
Options None
Order allow,deny
Allow from all
</Directory>
httpd.confにhttpd-nagios.confを取り込む。
以下の行を追加する。
# vi /usr/local/apache2/conf/httpd.conf
Include conf/extra/httpd-nagios.conf
一通り設定完了なので、nagios起動して、httpdを再起動かける。
# /etc/rc.d/init.d/nagios start
# /etc/rc.d/init.d/httpd2 restart
http://localhost/nagios でアクセスできればOK.