nagios

/etc/nagios3/nagios.cfg

まず

/etc/nagios3/nagios.cfg

cfg_dir=/etc/nagios3/conf.d
↓
cfg_dir=/etc/nagios3/objects

に変更

/etc/nagios3/objects/contacts.cfg

define contact{
      contact_name                     aya
      alias                            Aya
      host_notifications_enabled           1
      service_notifications_enabled        1
      service_notification_period     24x7
      host_notification_period        24x7
      service_notification_options    w,u,c,r
      host_notification_options       d,u,r
      service_notification_commands   notify-service-by-email
      host_notification_commands      notify-host-by-email
      email                           aya@example.jp
      pager                           aya@example-mobile.jp
      address1                         aya2@example-other.jp
      address2                         000-0000-0000
      can_submit_commands              1
}

/etc/nagios3/objects/contactgroups.cfg

define contactgroup{
      contactgroup_name        system-admin
      alias                    System Administrators
      members                  aya #複数の場合は[,]で区切る
}

/etc/nagios3/objects/hosts.cfg

define host{
      host_name                        chocolate
	#	display_name	display_name
      alias                            file server :: chocolate
      address                          192.168.12.19
	#	parents	router1 #主にrouters, switches, firewallsなどのhost名を記述する
	# 	hostgroups	hostgroup_names
      check_command                    check-host-alive
      check_interval                   5
      retry_interval                   1
      max_check_attempts               5

	# 	initial_state	[o,d,u] 
	#    ↑Nagios3はディフォルトで対象ホストはUpしていると思っているので、その設定を変えるオプション
	#    ↑[ o = UP(起動している), d = DOWN (落ちている), and u = UNREACHABLE (接続不可) ] 

	# 	active_checks_enabled	[0/1]
	#	passive_checks_enabled	[0/1]
      check_period                     24x7 #timeperiods.cfgに記述してある名前
	#	obsess_over_host	[0/1]
	#	check_freshness	[0/1]
	#	freshness_threshold	#
	#	event_handler	command_name
	#	event_handler_enabled	[0/1]
	# 	low_flap_threshold	#
	#	high_flap_threshold	#
	#	flap_detection_enabled	[0/1]
	#	flap_detection_options	[o,d,u]
      process_perf_data                0
	#   retain_status_information [0/1]
      retain_nonstatus_information     0
	#  contacts	#個々の個人名
      contact_groups                   system-admin
	#	first_notification_delay	#
	#	notifications_enabled	[0/1]
      notification_interval            30
      notification_period              24x7 #timeperiods.cfgに記述してある名前
      notification_options             d,u,r #[d,u,r,f,s]
	#	stalking_options	[o,d,u]
	#	notes	note_string
	#	notes_url	url
	#	action_url	url
	#	icon_image	image_file
	#	icon_image_alt	alt_string
	#	vrml_image	image_file
	#	statusmap_image	image_file
	#	2d_coords	x_coord,y_coord
	#	3d_coords	x_coord,y_coord,z_coord             
}

/etc/nagios3/objects/hostgroups.cfg

define hostgroup{
      hostgroup_name   sweet-servers
      alias            Toothache Servers
      members          chocolate
}

/etc/nagios3/objects/services.cfg

define service{
       name                            sweet-service        ; テンプレート名
       notifications_enabled           1       ; 通知有
       event_handler_enabled           1       ; イベントハンドラの有
       process_perf_data               1       ; パフォーマンス情報を保存
       retain_status_information       1       ; ステータス情報を保存
       retain_nonstatus_information    1       ; ステータス情報以外を保存
       is_volatile                     0       ; 通常サービスチェック
       max_check_attempts              3       ; リトライ回数
       normal_check_interval           5       ; 5分間隔でチェック
       retry_check_interval            1       ; リトライ間隔
       check_period                    24x7    ; 24x7でチェック
       notification_interval           240     ; 障害発生から240分したら再通知
       notification_period             24x7    ; 24x7で通知
       notification_options            w,c,r   ; Warning, Critical, Recover時に通知
       contact_groups                  system-admin    
       register                        0       ;
}
define service{
      use                      sweet-service
      host_name                chocolate
      service_description      PING to chocolate
      check_command            check_ping!100.0,20%!500.0,60%
}
define service {
      use                      sweet-service
      host_name                chocolate
      service_description      HTTP for chocolate
      check_command            check_http
}

/etc/nagios3/objects/servicegroups.cfg

これは何に使うかよく分からず…

define servicegroup{
      servicegroup_name        sweet-serivce
      alias                    Sweet Services alias
}

Last-modified: 2012-03-12 (月) 17:05:51 (166d)