[Nagios-users] Bug in 3.0.2 with service escalation contact groups
Andy Shellam
andy.shellam-lists at mailnetwork.co.uk
Tue May 27 18:38:26 CEST 2008
Hi Mathieu,
Thanks so much for this patch - I'll apply it tonight and see what
happens. I'm only a beginner in C (wrote my first full program in it
yesterday!) so I can sort of understand this code. It took me a while
to see where the problem lay, but now I can - it seems to be splitting
by either a comma or a space in service escalations, but not in host
escalations.
It would be good if somebody could clear up the "intended" practice -
whether Nagios should, or should not, accept spaces in name fields as
there does seem to be some confusion! Which other directives use a
space as their field separators? Other fields such as
notification_options use commas, which was why I thought it was OK to
use spaces in names.
Thanks again,
Andy
Mathieu Gagné wrote:
> Hi Andy,
>
> Andy Shellam wrote:
>>
>> I'm more inclined to think that the service escalation is wrong in its
>> behaviour, but then I could be wrong?
>>
>
> HostEscalation differs from ServiceEscalation as you can see in the
> source code:
>
> File: xdata/xodtemplate.c
>
> For ServiceEscalation
>
> Line: 10251 (for contactgroups)
> for(contact_group=strtok(this_serviceescalation->contact_groups,",
> ");contact_group!=NULL;contact_group=strtok(NULL,", ")){
>
> Line: 10265 (for contacts)
> for(contact_name=strtok(this_serviceescalation->contacts,",
> ");contact_name!=NULL;contact_name=strtok(NULL,", ")){
>
>
> For HostEscalation
>
> Line: 10397 (for contactgroups)
> for(contact_group=strtok(this_host->contact_groups,",");contact_group!=NULL;contact_group=strtok(NULL,",")){
>
>
> Line: 10413 (for contacts)
> for(contact_name=strtok(this_host->contacts,",");contact_name!=NULL;contact_name=strtok(NULL,",")){
>
>
>
> The white-space is considered a field separator for "contact_groups"
> in ServiceEscalation but not HostEscalation.
>
> As an attachment is a patch which fixes this bug.
>
> And for the records, somebody should cleanup the source code regarding
> this field separator glitch. The white-space is considered a field
> separator in a lot of places.
>
> I'm not a C guru so I'm not sure if it's here on purpose or not and if
> "fixing" it breaks backward-compatibility.
>
> --
> Mathie Gagné
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
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