Nagios グループ化
Nagios グループ化
設定変更
コメントを外して「cfg_file=/etc/nagios/hostgroups.cfg」を有効にします。
[root@L2 nagios]# pwd
/etc/nagios
[root@L2 nagios]# vi ./nagios.cfg44 #cfg_file=/etc/nagios/contactgroups.cfg
45 #cfg_file=/etc/nagios/contacts.cfg
46 #cfg_file=/etc/nagios/dependencies.cfg
47 #cfg_file=/etc/nagios/escalations.cfg
48 #cfg_file=/etc/nagios/hostgroups.cfg
49 cfg_file=/etc/nagios/hostgroups.cfg
50 #cfg_file=/etc/nagios/hosts.cfg
hostgroups.cfgの作成
[root@L2 nagios]# vi ./hostgroups.cfgdefine hostgroup {
hostgroup_name L-servers
alias Lustre Servers
}define hostgroup
hostgroup_name network
alias Network Infrastructure
}define hostgroup
hostgroup_name INET-servers
alias Internet Servers
}define host {
name INET-servers
use linux-server
hostgroups INET-servers
# TEMPLATE!
register 0
}
define host {
name L-servers
use linux-server
hostgroups L-servers
# TEMPLATE!
register 0
}define host {
name network
use linux-server
hostgroups network
# TEMPLATE!
register 0
}
監視ノードの設定(例)
作成したグループを define host に定義します。
[root@L2 nagios]# vi ./servers/L1.cfgdefine host{
use L-servers <---グループを設定
host_name L1
alias L1
address 10.83.62.201
}
define service{
use local-service
host_name L1
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}# nrpe - check crond
define service{
use local-service
normal_check_interval 10
notification_interval 30
設定ファイルのチェック
[root@L2 nagios]# /usr/sbin/nagios -v /etc/nagios/nagios.cfg
〜
Checking misc settings...Total Warnings: 1
Total Errors: 0Things look okay - No serious problems were detected during the pre-flight check
サービス再起動
[root@L2 nagios]# service nagios restart
Running configuration check...done
Stopping nagios: done.
Starting nagios: done.
[root@L2 nagios]#