This is a multi-part message in MIME format.
--------------060804050604020003070004
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
On 9/2/09 8:57 AM, Thomas Guyot-Sionnest wrote:
>
> Mathieu Gagné wrote:
>> Hi,
>>
>> Thomas Guyot-Sionnest wrote:
>>> Just add the host_name or hostgroup_name directive (you can put all
>>> hostgroups for instance, or enable wildcards and use *) and you're set.
>>
>> Unfortunately, it doesn't work. This explains why I asked the
>> mailinglist. If I do as you suggested, all NRPE based services will be
>> depending on the NRPE service on ALL hosts. (not only their respective host)
>>
>> Here is my servicedependency definition:
>>
>> define servicedependency {
>> hostgroup_name hosts-with-nrpe
>> service_description NRPE
>> dependent_servicegroup_name nrpe-services
>> execution_failure_criteria n
>> notification_failure_criteria c,u
>> }
>
> And what result you get with that? I have pretty much the same, but with
> a "dependent_service_name" directive, and it should do the same. If it
> don't, it's a bug.
So I guess it's a bug or it wasn't initially planned to work that way.
You will find attached to this message a patch against Nagios 3.0.6 that
should fix this bug.
This servicedependency definition should now work:
define servicedependency {
service_description NRPE
dependent_servicegroup_name nrpe-services
execution_failure_criteria n
notification_failure_criteria c,u
}
You shouldn't get those errors anymore at startup:
Error: NULL master service description/host name in service dependency
definition
Error: Could not register service execution dependency (config file
'/etc/nagios3/XXXXX.cfg', starting on line YY)
For all services found in servicegroup "nrpe-services", a
servicedependency against the NRPE service of their respective host
should now be defined for each of them.
Any opinion about it? Is it the proper way to do it?
--
Mathieu
--------------060804050604020003070004
Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0";
name="nagios-same-host-servicedependencies-with-servicegroups.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename*0="nagios-same-host-servicedependencies-with-servicegroups.patc";
filename*1="h"
diff -Naur nagios-3.0.6-orig/xdata/xodtemplate.c nagios-3.0.6/xdata/xodtemplate.c
--- nagios-3.0.6-orig/xdata/xodtemplate.c 2009-09-02 17:15:52.000000000 -0400
+++ nagios-3.0.6/xdata/xodtemplate.c 2009-09-02 17:21:55.000000000 -0400
@@ -5247,6 +5247,7 @@
char *service_descriptions=NULL;
int first_item=FALSE;
+ int same_host_servicedependency=FALSE;
/*************************************/
@@ -5725,6 +5726,11 @@
my_free(temp_servicedependency->dependent_service_description);
my_free(temp_servicedependency->dependent_hostgroup_name);
}
+
+ /* MG(20090902): Same host servicegroups dependencies */
+ same_host_same_host_servicedependency=FALSE;
+ if(temp_servicedependency->host_name==NULL && temp_servicedependency->hostgroup_name==NULL)
+ same_host_servicedependency=TRUE;
/* duplicate service dependency entries */
first_item=TRUE;
@@ -5742,6 +5748,10 @@
my_free(temp_servicedependency->dependent_service_description);
temp_servicedependency->dependent_service_description=(char *)strdup(temp_dependentservice->name2);
+
+ /* MG(20090902): Same host servicegroups dependencies */
+ if(same_host_servicedependency==TRUE)
+ temp_servicedependency->host_name=(char *)strdup(temp_dependentservice->name1);
/* clear the dependent servicegroup */
temp_servicedependency->have_dependent_servicegroup_name=FALSE;
@@ -5757,7 +5767,11 @@
}
/* duplicate service dependency definition */
- result=xodtemplate_duplicate_servicedependency(temp_servicedependency,temp_servicedependency->host_name,temp_servicedependency->service_description,NULL,NULL,temp_dependentservice->name1,temp_dependentservice->name2,NULL,NULL);
+ /* MG(20090902): Same host servicegroups dependencies */
+ if(same_host_servicede
...[email truncated]...
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]