Derive service settings from hosts definition

David Fulton booleanenator at gmail.com
Mon Aug 13 18:39:58 CEST 2012


I was setting up multiple distributed Nagios servers with one acting
as the "master" server and getting the sheer volume of hosts and
service checks would have been a monumental task without this and some
of the other features. I use hostgroups heavily too. I hardly ever
create a service that is tied directly to a host, I usually create a
host group, even if it just contains that one host because you never
know when that specific service check will work perfectly for more
than one host, That way all you have to do to add the service check is
use the "+" operator on the hostgroups section of the host definition.
Also I try to avoid modifying the hostgroups directly in a host. I
will go and create an intermediate template in case I make another
host that is just like the one I am defining now. Indeed, I have a
template structure that goes from generic_host all the way down to
freebsd_host (including a intermediate unix_host) redhat_host
(including that same unix_host chained through a linux_host). It is
extremely powerful once you get the hang of it. It can be confusing at
first though. Best thing I ever did for it was to get a big whiteboard
and chart it out. My actual commands are pretty much one per plugin
and I keep the parameters as $ARG1$ $ARG2$ and so on. Even ones that
you would think the $HOSTADDRESS$ would be appropriate, I put that in
as the first parameter and then use $ARG1$ in the actual command
because you never know when you might need to use a different IP (like
a service IP bound to the same server). Best to be flexible.

On Wed, Aug 1, 2012 at 5:13 PM, Vladislav Staroselskiy
<vstaroselskiy at dataraker.com> wrote:
> This helped a lot - thank you both for explanations! I saw this link earlier, but somehow missed "implied inheritance" part of it.
>
> Vlad.
>
> -----Original Message-----
> From: David Fulton
> Sent: Tuesday, July 31, 2012 11:24 AM
> To: Nagios Users List
> Subject: Re: [Nagios-users] Derive service settings from hosts definition
>
> On Tue, Jul 31, 2012 at 11:03 AM, Chris Beattie <cbeattie at geninfo.com> wrote:
>> On 7/30/2012 2:31 PM, Vladislav Staroselskiy wrote:
>>> Is there any way to derive certain service options from the host definition? Is there any default inheritance behavior for it?
>> ...
>>> I really wish, service notification/contact options could be derived from hosts definitions to avoid this mess. If anyone has a
>>> suggestion on how to better organize it, I would also appreciate your feedback.
>>
>> Nagios does almost exactly that, except for the enabling or disabling of
>> notifications.
>>
>> Services will inherit their contact_groups, notification_interval, and
>> notification_period from their associated host if those three directives
>> are not set in the service's definition.
>>
>> Search for "implied inheritance" down the page here:
>> http://nagios.sourceforge.net/docs/3_0/objectinheritance.html
>>
>> Also, you can use a + sign to signal additive inheritance, which comes
>> in handy if you want to modify an implied inheritance without replacing
>> it.  It's explained directly above implied inheritance on that page.
>>
>> --
>> -Chris
>>
>> Nothing in this message is intended to make or accept an offer or to form a contract, except that an attachment that is an image
>> of a contract bearing the signature of an officer of our company may be or become a contract. This message (including any
>> attachments) is intended only for the use of the individual or entity to whom it is addressed. It may contain information that is
>> non-public, proprietary, privileged, confidential, and exempt from disclosure under applicable law or may constitute as attorney
>> work product. If you are not the intended recipient, we hereby notify you that any use, dissemination, distribution, or copying of
>> this message is strictly prohibited. If you have received this message in error, please notify us immediately by telephone and
>> delete this message immediately.
>>
>> Thank you.
>>
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> 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
>
> Also keep in mind you can use user defined host based macros that can
> be defined in the templates to make parameters to the service checks
> inherited from the host as well. I used this feature to create classes
> of hosts while at the same time giving me the option to tweak the
> thresholds on a class-by-class or host-by-host basis. Very flexible.
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> 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
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> 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

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
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