Configuring multiple services

Marc Powell marc at ena.com
Sun Feb 10 19:35:02 CET 2008



> -----Original Message-----
> From: nagios-users-bounces at lists.sourceforge.net [mailto:nagios-users-
> bounces at lists.sourceforge.net] On Behalf Of Kaushal Shriyan
> Sent: Sunday, February 10, 2008 9:57 AM
> To: nagios-users at lists.sourceforge.net
> Subject: [Nagios-users] Configuring multiple services
> 
> Hi
> 
> I am a newbie to Nagios, If i have to monitor SMTP and HTTP services
using
> Nagios
> 


> If i have to check_http check_smtp so will the directive check_command
> look like
> 
> check_command check_http check_smtp
> 
> 
> define service{
> 	host_name		linux-server
> 	service_description	check-disk-sda1
> 	check_command check_http check_smtp
> 	max_check_attempts	5
> 	check_interval	5
> 
> 	retry_interval	3
> 	check_period		24x7
> 	notification_interval	30
> 	notification_period	24x7
> 	notification_options	w,c,r
> 	contact_groups		linux-admins
> 	}

You'll need to create a new service{} definition for each unique service
you wish to check for each host you want to check*. Using your example
above, it looks like you'll need 3 service{} definitions --
	1 checking disk on sda1 (based on your example
service_description)
	1 checking HTTP using check_http
	1 checking SMTP using check_smtp

Templates can help you a lot. You can place all the common directives
like check_interval, retry_interval, etc in a template then reference
that template in each service definition. Your resulting service{}
definitions would only contain those directives that changed and likely
only be something like --

define service{
	name		my-service-template
	max_check_attempts	5
	check_interval	5
	retry_interval	3
	check_period		24x7
	notification_interval	30
	notification_period	24x7
	notification_options	w,c,r
	contact_groups		linux-admins
	register 	0
	}

define service{
	use my-service-template
	host_name linux-server
	service description My HTTP Check
	check_command check_http
}
define service{
	use my-service-template	
	host_name linux-server
	service description My SMTP Check
	check_command check_smtp
}
define service{
	use my-service-template
	host_name linux-server
	service description My Disk Check
	check_command check_disk_sda1 (or whatever it is)
}

The documentation and sample config files can be used as a reference for
templating, etc. The examples above are from memory so any syntax errors
are my own. The documentation should be your definitive reference.

--
Marc

* Note that there are some advanced template tricks that can help in
this regard but for your first start you might want to experiment with
simple definitions to understand the concepts.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list