Avoiding repetition of service definition in Nagios Core

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
yashgt
Posts: 6
Joined: Sat Sep 01, 2012 12:37 am

Avoiding repetition of service definition in Nagios Core

Post by yashgt »

Hi,

A service definition for a host looks like:
service{
name host_1_svc
....
check_command check_xyz!abc
}

A similar check needs to be performed on host2, except that the parameter to the check_command is lmn.
So I have to define:
service{
name host_2_svc
....
check_command check_xyz!lmn
}

What is the general convenient practice to avoid having to define the service over and over again with only a minor change?

Thanks,
Yash
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Avoiding repetition of service definition in Nagios Core

Post by tmcdonald »

I am almost certain this link will help you out:

http://nagios.sourceforge.net/docs/3_0/ ... tance.html

EDIT: I posted the wrong link before. It is now fixed.

Basically you can save some typing and reduce the size of your configs by using inheritance.

Unfortunately there is no way around the issue of having to type out the small changes to each service, since Nagios has no way of reading your mind. Yet.
Former Nagios employee
Locked