# --------------------------------------------------------------------------
# This is an example Nagios configuration for the ARC-CE probes meant for
# documenation purposes.  It cannot be used as-is.
# --------------------------------------------------------------------------


# Contacts and Contact Groups
# ===========================

# You probably already have contacts defined in your Nagios configuration, so
# you can skip these and substitute your own below.
define contactgroup {
	contactgroup_name	nagios-operators
	members			jdoe
}
define contact {
	use			generic-contact
	contact_name		jdoe
	email			jdoe@example.org
}

# Commands Definitions
# ====================

# This is a dummy command for passive services.  You may already have something
# like it in your Nagios configuration.
define command {
	command_name		check_passive
	command_line		/bin/true
}

# This command monitors running jobs and collects those which have teminated,
# reporting passive results.
define command {
	command_name check_arcce_monitor
	command_line $USER1$/check_arcce_monitor -H $HOSTNAME$
}

# A job submission check including sub-tests which are defined in the plugin
# configuration in separate sections.  The results of the sub-tests will be
# passively reported to the service names defined in the same configuration.
define command {
	command_name check_arcce_submit
	command_line $USER1$/check_arcce_submit -H $HOSTNAME$ \
		--test python --test perl --test csh --test gcc
}

# A job submission check with staging.  The arguments to --stage-input options
# must exist.  The arguments to --stage-output options will be overwritten, and
# deleted on termination.  This command is not used below.  To use it, add an
# active service and a passive service named "ARCCE SRM Job Termination".
define command {
	command_name check_arcce_submit_staging
# Passed explicitly:
#	command_line $USER1$/check_arcce_submit \
#		-H $HOSTNAME$ --job-tag srm \
#		--termination-service 'ARCCE SRM Job Termination' \
#		--stage-input srm.txt=srm://srm.example.org/nagios/readable.txt \
#		--stage-output srm://srm.example.org/nagios/srm-$HOSTNAME$-$TIMET$.txt \
# Using a predefined job-test:
#	command_line $USER1$/check_arcce_submit \
#		-H $HOSTNAME$ --job-tag srm \
#		--termination-service 'ARCCE SRM Job Termination' \
#		--test stage_srm
}

# Host Groups and Host Templates
# ==============================

# You need to have one host definitions to which the monitoring service is
# assigned to.  This is typically the Nagios host itself, for which you
# probably already have a definition.
define host {
	name			nagios-host
	use			generic-host
	max_check_attempts	10
	contact_groups		nagios-operators
	register		0
}

# The following host group and template will be used for all CEs.
define hostgroup {
	hostgroup_name		arcce-hosts
	alias			ARCCE Hosts
}
define host {
	name			arcce-host
	use			generic-host
	max_check_attempts	10
	contact_groups		nagios-operators
	hostgroups		arcce-hosts
	register		0
}

# Service Groups and Service Templates
# ====================================

define servicegroup {
	servicegroup_name	arcce-services
	alias			ARCCE Services
}
define service {
	name			arcce-service
	use			generic-service
	servicegroups		arcce-services
	check_period		24x7
	max_check_attempts	3
	flap_detection_enabled	0
	contact_groups		nagios-operators
	notifications_enabled	0
	register		0
}
define service {
	name			arcce-monitoring-service
	use			arcce-service
	normal_check_interval	5
	retry_check_interval	5
	register		0
}
define service {
	name			arcce-submission-service
	use			arcce-service
	normal_check_interval	30
	retry_check_interval	30
	register		0
}
define service {
	name			arcce-passive-service
	use			arcce-service
	active_checks_enabled	0
	passive_checks_enabled	1
	check_command		check_passive
	register		0
}

define service {
	use			arcce-monitoring-service
	host_name		localhost
	service_description	ARCCE Monitoring
	check_command		check_arcce_monitor
}

# For each ARC CE, we need one active service for submission and a number of
# passive services to collect the results.  In the following we associate the
# per-CE services to the "arcce-hosts" group, which will add them to all
# members of the group.
define service {
	use			arcce-submission-service
	service_description	ARCCE Job Submission
	hostgroup_name		arcce-hosts
	check_command		check_arcce_submit
}
define service {
	use			arcce-passive-service
	service_description	ARCCE Job Termination
	hostgroup_name		arcce-hosts
}
define service {
	use			arcce-passive-service
	service_description	ARCCE Python version
	hostgroup_name		arcce-hosts
}
define service {
	use			arcce-passive-service
	service_description	ARCCE Perl version
	hostgroup_name		arcce-hosts
}
define service {
	use			arcce-passive-service
	service_description	ARCCE GCC version
	hostgroup_name		arcce-hosts
}
define service {
	use			arcce-passive-service
	service_description	ARCCE csh usability
	hostgroup_name		arcce-hosts
}

# Hosts
# =====

# This provides the monitoring service.
define host {
	use			nagios-host
	host_name		localhost
}
# Any host which use the arcce-host template will get an active submission
# service, and all the related passive services.
#define host {
#	use			arcce-host
#	host_name		ce-00.example.org
#}
