Service dependencies

Thomas Guyot-Sionnest Thomas at zango.com
Fri Oct 20 07:03:26 CEST 2006


Alright! I found out I'm not that bad in C and made my own patch. :)

What it does:

When Nagios duplicate servicedependency definitions, it checks for any
missing required variables. When it checks for empty host_name entry,
instead of returning an error I set a flag and fill-up the master_hostslist
using the dependent_host_name entry instead.

Later in the "duplication" loop, if the flag is present I don't duplicate
any definition that doesn't have the same hostname for master and dependent
host.

How to use it:

Just omit the "host_name" entry in a servicedependency definition ex:.

define servicedependency {
 service_description           Master service
 dependent_hostgroup_name      pool1,pool2
 dependent_service_description Slave 1,Slave 2,Slave 3
 notification_failure_criteria c,u
}

WARNING: This patch is EXPERIMENTAL. It was only tested with the expected
configuration. I DID NOT TEST ANY NORMAL CONFIGURATION; NEITHER DID I TEST
CONFIGURATION ERROR HANDLING. I'll review and test this patch thoughtfully
as soon as I get some spare time.

Please send me any bugs/comments you have on this patch...

Thomas

> -----Original Message-----
> From: william(at)elan.net [mailto:william at elan.net]
> Sent: Thursday, October 19, 2006 22:42
> To: Thomas Guyot-Sionnest
> Cc: Tobias Mucke; Nagios-Devel
> Subject: Re: [Nagios-devel] Service dependencies
> 
> 
> On Thu, 19 Oct 2006, Thomas Guyot-Sionnest wrote:
> 
> > I guess you mean setting it up in the service definition? But you'll
> have to
> > define which host here as well. So is't excatly the same as the
> > servicedependency  definition.
> >
> > Actually I'm just thinking there could be another way. What if by
> omiting
> > one of the host_name / hostgroup_name variable, instead of failling
> check it
> > would turn the "same host" mode.
> >
> > define servicedependency {
> >  service_description           Master service
> >  dependent_hostgroup_name      pool1,pool2
> >  dependent_service_description Slave 1,Slave 2,Slave 3
> >  same_host_dependency          1
> >  notification_failure_criteria c,u
> > }
> 
> Interestingly enough I made a patch (for 2.2 & 2.3) that does almost
> exactly that. But I did not do it cleanly as I did not add new option
> and changed the behavior so that:
> 
> define servicedependency {
>    hostgroup_name      		group1
>    servicegroup_name		master_servicegroup
>    dependent_servicegroup_name   slavegroup1,slavegroup2
>    notification_failure_criteria c,u
>    execution_failure_critieria	n
> }
> 
> would add dependency for each host in hostgroup from services in master
> group to all services in slave groups.
> 
> > There is no host_name defined for "Master service", so for each host in
> > "dependent_hostgroup_name" it creates a dependency to "Master service"
> on
> > the same host.
> >
> > Does it makes sense?
> >
> > Thomas
> >
> >> -----Original Message-----
> >> From: nagios-devel-bounces at lists.sourceforge.net
> >> [mailto:nagios-devel-bounces at lists.sourceforge.net] On Behalf
> >> Of Tobias Mucke
> >> Sent: October 19, 2006 11:31
> >> To: Nagios-Devel
> >> Subject: Re: [Nagios-devel] Service dependencies
> >>
> >> Hi,
> >>
> >> since we are using Nagios in a large environment here, we
> >> also have to fight with service dependencies and the approach
> >> how to configure it. What I would like to see in Nagios is
> >> the possibility to define that a service always depends on
> >> another service without even mentioning a host or hostgroup.
> >> Look at the example.
> >>
> >> I have a service called disk_os which checks all filesystems
> >> of a system or even a large group of systems. I do this by
> >> using nrpe. To check if nrpe is running I have a service
> >> called nrpe. Today I have to configure for every host with
> >> disk_os a single servicedependency to nrpe.
> >>
> >> What I want to do is, to define that disk_os will always
> >> depend on nrpe, so I don't have to mention that for each host
> >> again and again.
> >>
> >> Thanks.
> >>
> >> Tobias
> >>
> >>
> >> -----Original Message-----
> >> From: "Thomas Guyot-Sionnest" <Thomas at zango.com>
> >> To: "Thomas Sluyter" <nagios at kilala.nl>,"Nagios-Devel"
> >> <nagios-devel at lists.sourceforge.net>
> >> Date: Wed, 18 Oct 2006 23:51:25 -0700
> >> Subject: Re: [Nagios-devel] Service dependencies
> >>
> >>>
> >>> Sorry to bring up an old thread, but there were no follow
> >> up on this. I
> >>> just find myself in the same situation (need one-to one mapping for
> >>> every hosts) and remembered this old thread.
> >>>
> >>> How hard would if be to add a flag in servicedependency
> >> definitions that
> >>> force every service dependency to reside on the same host,
> >> and ignore
> >>> missing services.
> >>>
> >>> So I could write something like this:
> >>>
> >>> define servicedependency {
> >>>   hostgroup_name                pool1,pool2
> >>>   service_description           Master service
> >>>   dependent_hostgroup_name      pool1,pool2
> >>>   dependent_service_description Slave 1,Slave 2,Slave 3
> >>>   same_host_dependency          1
> >>>   notification_failure_criteria c,u
> >>> }
> >>>
> >>> And I'd get:
> >>> 1: dependencies across services on the same host for every
> >> hosts defined
> >>> in pool1 and pool2
> >>> 2: missing dependent services would be silently dropped.
> >>>
> >>> Or to be more flexible different values for
> >> same_host_dependency could
> >>> determine if Nagios does #1 or #1 & #2.
> >>>
> >>> If you don't like #2, doing #1 would already reduce
> >> significantly the
> >>> config required.
> >>>
> >>> I never checked the pre-flight code, but I'd assume it
> >> shouldn't be that
> >>> hard. I guess all you have to do is skip dependency creation on
> >>> conditional statements.
> >>>
> >>> Thanks,
> >>>
> >>> Thomas
> >>>
> >>>> -----Original Message-----
> >>>> From: nagios-devel-bounces at lists.sourceforge.net
> >> [mailto:nagios-devel-
> >>>> bounces at lists.sourceforge.net] On Behalf Of Thomas Sluyter
> >>>> Sent: Monday, June 12, 2006 5:58
> >>>> To: Nagios-Devel
> >>>> Subject: Re: [Nagios-devel] Service dependencies
> >>>>
> >>>> I'm sorry if this is the second time this message gets sent to the
> >>>> list. I had a hunch that it didn't make it the first time
> >> I sent it...
> >>>>
> >>>> ============
> >>>>
> >>>> Hi all.
> >>>>
> >>>> I was actually wondering about the exact same thing Dirk
> >> was thinking
> >>>> about! Such a shortcut would really help out in easing the use of
> >>>> dependencies.
> >>>>
> >>>>> Try this...
> >>>>>
> >>>>> define servicedependency{
> >>>>> hostgroup_name windows-servers
> >>>>> service_description NRPE_NT
> >>>>> dependent_hostgroup_name windows-servers
> >>>>> dependent_service_description Drive_C
> >>>>> }
> >>>>
> >>>> Ethan's solution wouldn't work if you look at it logically. Why?
> >>>> Because you're telling Nagios that:
> >>>> * All instances of service A in hostgroup X
> >>>> * Depend on all instances of service B in hostgroup X.
> >>>>
> >>>> Meaning that all instances of A will "fail" if -any- instance of B
> >>>> goes down. That's not what we want to happen, is it? :p
> >>>>
> >>>> Or am I completely off on this? Might be that I'm not reading this
> >>>> correctly.
> >>>>
> >>>> As Dirk said: it would be great if there was some shortcut for
> >>>> telling Nagios that you want all instances of service A
> >> in hostgroup
> >>>> X to be dependant of service B on -their-own- host. That way you
> >>>> could take care of all dependencies for a whole hostgroup
> >> in a matter
> >>>> of a few dozen lines of code.
> >>>>
> >>>>
> >>>> - Thomas Sluyter (Cailin)
> >>>>
> >>>> -----------------------
> >>>> This thread is located in the archive at this URL:
> >>>> http://www.nagiosexchange.org/nagios-devel.33.0.html?
> >>>> &tx_maillisttofaq_pi1[showUid]=18830
> >>>>
> >>>>
> >>>>
> >>>> _______________________________________________
> >>>> Nagios-devel mailing list
> >>>> Nagios-devel at lists.sourceforge.net
> >>>> https://lists.sourceforge.net/lists/listinfo/nagios-devel
> >>>
> >>>
> >> --------------------------------------------------------------
> >> -----------
> >>> Using Tomcat but need to do more? Need to support web
> >> services, security?
> >>> Get stuff done quickly with pre-integrated technology to
> >> make your job easier
> >>> Download IBM WebSphere Application Server v.1.0.1 based on
> >> Apache Geronimo
> >>>
> >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&
> >> dat=121642
> >>> _______________________________________________
> >>> Nagios-devel mailing list
> >>> Nagios-devel at lists.sourceforge.net
> >>> https://lists.sourceforge.net/lists/listinfo/nagios-devel
> >>>
> >>
> >> --------------------------------------------------------------
> >> -----------
> >> Using Tomcat but need to do more? Need to support web
> >> services, security?
> >> Get stuff done quickly with pre-integrated technology to make
> >> your job easier
> >> Download IBM WebSphere Application Server v.1.0.1 based on
> >> Apache Geronimo
> >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&
> >> dat=121642
> >> _______________________________________________
> >> Nagios-devel mailing list
> >> Nagios-devel at lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/nagios-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nagios-2.5_same-host-servicedependency.patch
Type: application/octet-stream
Size: 1877 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20061019/7b80dd54/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3076 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20061019/7b80dd54/attachment.bin>
-------------- next part --------------
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel


More information about the Developers mailing list