Tips

nagiosでフリーな監視をしてみよう!~nagiosの設定(3)~

nagiosでフリーな監視をしてみよう!~nagiosの設定(3)~

nconfの設定とnagiosの設定


以前にも記述しましたが、nconfは、MySQLに設定を保存し、それをNagiosの設定ファイルとして出力後、Nagiosを再起動して設定を反映させことができます。そのための追加設定をこれから紹介していきます。

(1)nconfのメイン設定ファイル(/usr/local/apache2/htdocs/nconf/config/nconf.php)を変更します。

# vi /usr/local/apache2/htdocs/nconf/config/nconf.php


・「nconf.php」ファイル変更前の内容

●Nagios本体のパスを指定します。

 # This is the path to the Nagios binary. The binary is needed in order to run tests on the generated config.
 # This path should either point to the original binary (if Nagios is installed on the same host), to a copy of the binary
 # (copy it to the bin/ folder), or to a symbolic link. Make sure the binary is executable to the webserver user.
 define('NAGIOS_BIN', '/usr/local/nagios/sbin');

 # Check for updates


●Nagios構文チェックを無効化します。

 #
 # Syntax checking for static config folders
 # Static config will be treated as "global" config. Syntax checking will be run for each Collector / Monitor server.
 # In a distributed monitoring setup, you might have to disable syntax checking, if you are getting errors that items don't exist on certain servers.
 #
 define('CHECK_STATIC_SYNTAX', 1);

 #


●ユーザが、通知先などに自動で追加されてしまう処理を無効化します。

 #
 # These groups will always be added to any host or service, regardless of what is linked in the GUI.
 #
 $SUPERADMIN_GROUPS = array ("+admins");

 #


・「nconf.php」ファイル変更後の内容

 # This is the path to the Nagios binary. The binary is needed in order to run tests on the generated config.
 # This path should either point to the original binary (if Nagios is installed on the same host), to a copy of the binary
 # (copy it to the bin/ folder), or to a symbolic link. Make sure the binary is executable to the webserver user.
 define('NAGIOS_BIN', '/usr/local/nagios/bin/nagios');

 # Check for updates

 #
 # Syntax checking for static config folders
 # Static config will be treated as "global" config. Syntax checking will be run for each Collector / Monitor server.
 # In a distributed monitoring setup, you might have to disable syntax checking, if you are getting errors that items don't exist on certain servers.
 #
 define('CHECK_STATIC_SYNTAX', 0);

 #

 #
 # These groups will always be added to any host or service, regardless of what is linked in the GUI.
 #
 $SUPERADMIN_GROUPS = array ("");

 #


(2)自動デプロイ設定ファイル(/usr/local/apache2/htdocs/nconf/config/deployment.ini)を変更します。

# vi /usr/local/apache2/htdocs/nconf/config/deployment.ini


・「deployment.ini」ファイル変更前の内容

 ;; LOCAL deployment ;;

 ;[extract config]
 ;type        = local
 ;source_file = "/var/www/nconf/output/NagiosConfig.tgz"
 ;target_file = "/tmp/"
 ;action      = extract

 ;[copy collector config]
 ;type        = local
 ;source_file = "/tmp/Default_collector/"
 ;target_file = "/etc/nagios/Default_collector/"
 ;action      = copy

 ;[copy global config]
 ;type        = local
 ;source_file = "/tmp/global/"
 ;target_file = "/etc/nagios/global/"
 ;action      = copy

 ;[copy nagios.cfg]
 ;type        = local
 ;source_file = "/tmp/static_cfg/nagios.cfg"
 ;target_file = "/etc/nagios/nagios.cfg"
 ;action      = copy
 ;reload_command = "sudo /etc/rc.d/init.d/nagios reload"


・「deployment.ini」ファイル変更後の内容

 ;; LOCAL deployment ;;

 [extract config]
 type        = local
 source_file = "/usr/local/apache2/htdocs/nconf/output/NagiosConfig.tgz"
 target_file = "/tmp/"
 action      = extract

 [copy collector config]
 type        = local
 source_file = "/tmp/Default_collector/"
 target_file = "/usr/local/nagios/etc/Default_collector/"
 action      = copy

 [copy global config]
 type        = local
 source_file = "/tmp/global/"
 target_file = "/usr/local/nagios/etc/global/"
 action      = copy

 [copy nagios.cfg]
 type        = local
 source_file = "/tmp/static_cfg/nagios.cfg"
 target_file = "/usr/local/nagios/etc/nagios.cfg"
 action      = copy
 reload_command = "sudo /etc/rc.d/init.d/nagios reload"

Linux認定資格 LPICを取るなら・・

Linux資格 「LPIC Lv1」徹底解説 連載目次

Recent News

Recent Tips

Tag Search