Tips

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

servicegroupの設定

サービスグループに追加する前に、サービスグループ専用の設定ファイルを作成します。

(1)「/usr/local/nagios/etc/nagios.cfg」ファイルを編集します。

# vi /usr/local/nagios/etc/nagios.cfg


・「nagios.cfg」ファイル変更前の内容

 # You can specify individual object config files as shown below:
 cfg_file=/usr/local/nagios/etc/objects/commands.cfg
 cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
 cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
 cfg_file=/usr/local/nagios/etc/objects/templates.cfg
 cfg_file=/usr/local/nagios/etc/objects/hostgroup.cfg

 # Definitions for monitoring the local (Linux) host
 cfg_file=/usr/local/nagios/etc/objects/localhost.cfg


・「nagios.cfg」ファイル変更後の内容

 # You can specify individual object config files as shown below:
 cfg_file=/usr/local/nagios/etc/objects/commands.cfg
 cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
 cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
 cfg_file=/usr/local/nagios/etc/objects/templates.cfg
 cfg_file=/usr/local/nagios/etc/objects/hostgroup.cfg
 cfg_file=/usr/local/nagios/etc/objects/servicegroup.cfg

 # Definitions for monitoring the local (Linux) host
 cfg_file=/usr/local/nagios/etc/objects/localhost.cfg


(2)「/usr/local/nagios/etc/objects/servicegroup.cfg」ファイルを作成します。

# vi /usr/local/nagios/etc/objects/servicegroup.cfg


・「hostgroup.cfg」ファイルの内容

 define servicegroup{
     servicegroup_name   [CHECK] PING
     alias               Ping Services
     members             localhost,PING
     members             nagios2,PING
 }


(3)「service nagios checkconfig」コマンドで設定を確認します。

# service nagios checkconfig


(4)問題なければ、nagiosのリロードを行います。

# service nagios reload

動作確認


「http://(サーバのIP)/nagios/」を開いて、左側の「現在の状態(Current Status)」-「サービスグループ(servicegroup)」をクリックし、「nagios2」が表示されていることを確認してください。


次回は、nrpeのインストールについて説明していきたいと思います。


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

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

Recent News

Recent Tips

Tag Search