Service Dependencies & Wildcards

Jason Martin jhmartin at toger.us
Tue Oct 14 22:04:07 CEST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Just for fun, I mirrored the 'multiple services' section of the 
documentation 
(http://nagios.sourceforge.net/docs/1_0/templatetricks.html#servicedependency) 
and set all services on hostB to be dependent on hostA (which they're not, 
but I was just testing)

define servicedependency{
        execution_failure_criteria      c,w,u
        notification_failure_criteria   c,w,u
        dependent_host                  HostB
        host_name                       HostA
        service_description             ContainerServer
        dependent_service_description   *
}

When I try to preflight I get:
Error: Dependent service specified in service dependency for service '*' 
on host 'hostB' is not defined anywhere!

I found this error text in the sourcecode and see that it appears after a
find_service function call. Find_service appears to iterate through a list
of services and execute strcmp on it and the supplied value; I don't see
how this could handle any sort of wildcard.

In config.c, there is               
temp_service=find_service(temp_sd->dependent_host_name,temp_sd->dependent_service_description,NULL);
                if(temp_service==NULL){
                        snprintf(temp_buffer,sizeof(temp_buffer),"Error: 
Dependent service specified in service dependency for
 service '%s' on host '%s' is not defined 
anywhere!",temp_sd->dependent_service_description,temp_sd->dependent_host_name);
 
The definition of find_service is (in objects.c):
                /* we found a matching host name and service description 
*/
                if(result==0 && 
!strcmp(temp_service->description,svc_desc))
                       return temp_service;


I don't see how that would work with any sort of wildcard. Am I missing 
something?

Thanks,
- -Jason Martin

 

n HostOn Tue, 14 
Oct 2003, Jason Martin wrote:

> I used the cfg_Dir directive in the nagios.cfg and have all my service
> files in that directory. The file containing the service dependency and
> the file containing the services are in the same directory. I also tried
> putting this dependency in the same file as the services themselves with
> no luck.
> 
> Thanks,
> - -Jason Martin
>  On Tue, 14 Oct 2003, Vlad 
> Didenko wrote:
> 
> > Did you include your services file in the main config file?
> > 
> > Vlad.
> > 
> > -----Original Message-----
> > From: Jason Martin [mailto:jhmartin at toger.us]
> > Sent: Tuesday, October 14, 2003 10:27 AM
> > To: nagios-users at lists.sourceforge.net
> > Subject: [Nagios-users] Service Dependencies & Wildcards
> > 
> > 
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> > 
> > Hello, I am trying to set up some bulk service dependencies and am 
> > having some trouble. I have a server with 50 services on it and a 
> > container server that runs them all. I want to make all 50 of the services 
> > dependent on the container server to avoid a flood of messages if the 
> > container goes down.  I'm trying to use a wildcard but am getting an 
> > error.
> > 
> > Here's my slightly-munged config:
> > 
> > define servicedependency{
> >         execution_failure_criteria      c,w,u
> >         notification_failure_criteria   c,w,u
> >         dependent_host                  hostA
> >         host_name                       hostA
> >         service_description             ContainerServer
> >         dependent_service_description   *,!ContainerServer
> > }
> > 
> > I've copied the label ContainerServer out of my services file so I am sure 
> > that the service ContainerServer exists. Here's the prefligh error I get:
> > 
> > Checking service dependencies...
> > Error: Dependent service specified in service dependency for service 
> > '*,!ContainerServer' on host 'hostA' is not defined anywhere!
> > Error: Dependent service specified in service dependency for service 
> > '*,!ContainerServer' on host 'hostA' is not defined anywhere!
> >         Checked 174 service dependencies.
> > Checking host escalations...
> > 
> > I don't get any errors from the services portion of the preflight check, 
> > and if I remove the dependency it monitors the services and 
> > ContainerServer just fine. 
> > 
> > The alternative is to write a quick script to create entries for each of
> > the services within the ContainerServer I suppose, but that doesn't seem
> > the right way to do it.  I tried looking at the source code to see where
> > it interpreted the wildcard but couldn't locate it.
> > 
> > If I put just * instead of *,!ContainerServer then the preflight 
> > coredumps.
> > 
> > Any idea what I am doing wrong? This is running Nagios 1.1 on a 
> > Debian-Woody machine, compiled from source.
> > 
> > Thanks,
> > - -Jason Martin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.3.3 (GNU/Linux)
Comment: pgpenvelope 2.10.2 - http://pgpenvelope.sourceforge.net/

iD8DBQE/jFa/l2ODWuqVSBMRAvZYAJ9l6AOITGFk2tKHCWkjWsZLRIzHGgCgmmBz
+nVbDQ/HL5Da2S5IPkLbSDw=
=eI8p
-----END PGP SIGNATURE-----


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
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