当方のバージョンは 3.2.3 です。
統合監視システム構築(Nagios) – CentOSで自宅サーバー構築
上記にしたがって構築して Nagios 起動しようとしたらエラーになった。
Starting nagios:CONFIG ERROR! Start aborted. Check your Nagios configuration.
これだけじゃわかんないよ、Nagios ちゃん!
以下の記事を発見。
№720 Nagios起動時にconfig error – Web Patio – CentOSで自宅サーバー構築
詳細表示モードにしてみる。
# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg Nagios Core 3.2.3 Copyright (c) 2009-2010 Nagios Core Development Team and Community Contributors Copyright (c) 1999-2009 Ethan Galstad Last Modified: 10-03-2010 License: GPL Website: http://www.nagios.org Reading configuration data... Read main config file okay... Processing object config file '/usr/local/nagios/etc/objects/commands.cfg'... Processing object config file '/usr/local/nagios/etc/objects/contacts.cfg'... Processing object config file '/usr/local/nagios/etc/objects/timeperiods.cfg'... Processing object config file '/usr/local/nagios/etc/objects/templates.cfg'... Processing object config file '/usr/local/nagios/etc/objects/localhost.cfg'... Processing object config directory '/usr/local/nagios/etc/servers'... Error: Could not open config directory '/usr/local/nagios/etc/servers' for reading. Error processing object config files! ***> 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.
/usr/local/nagios/etc/servers
というディレクトリを作成していなかったのが原因でした。見事にそのあたり読み飛ばしてた。
# mkdir /usr/local/nagios/etc/servers
これで OK のはず。
# service nagios start Starting nagios: done.
無事に Nagios 起動。
Internal Server Error とか出るんだけど?
【コラム】Yet Another 仕事のツール (76) Nagiosにプラグインを導入する | エンタープライズ | マイコミジャーナル
とするか
で disabled にしましょう。
一応動いたけどパーミッション関係のエラーが出るとき
It appears as though you do not have permission to view information for any of the services you requested... If you believe this is an error, check the HTTP server authentication requirements for accessing this CGI and check the authorization options in your CGI configuration file.
/usr/local/nagios/etc/cgi.cfg
を開いて以下に該当する部分をベーシック認証に割り当てたユーザー名に変更する。
authorized_for_system_information=nagiosadmin authorized_for_configuration_information=nagiosadmin authorized_for_system_commands=nagiosadmin authorized_for_all_services=nagiosadmin authorized_for_all_hosts=nagiosadmin authorized_for_all_service_commands=nagiosadmin authorized_for_all_host_commands=nagiosadmin
1件のコメント