contactgroup{ }, and contactgroups # bug?
Chet Luther
chet.luther at gmail.com
Fri Dec 9 16:22:23 CET 2005
On 12/5/05, Cam <cameron.matheson at gmail.com> wrote:
> Hi,
>
> So I'm writing some scripts to help me maintain my nagios
> configuration (actually to help other people be able to add new hosts,
> change some configuration parameters, etc). Anyway, I'm having a
> problem right now. In the case of hosts/hostgroups, this works fine:
>
> define hostgroup{
> houstgroup_name kiosks
> alias kiosks
> }
>
> define host{
> name host_template
> hostgroups kiosks
> ...
> }
>
> define host{
> host_name foobar
> use host_template
> ...
> } #foobar will be put in the hostgroup kiosks
>
> however, doing an equivalent configuration w/ contacts/contactgroups
> doesn't work (i'm using nagios 2.0b4):
>
> define contactgroup{
> contactgroup_name kiosk-folks
> alias Kiosk People
> }
>
> define contact{
> name kiosk_contact
> contactgroups kiosk-folks
> ...
> register 0
> }
>
> define contact{
> use kiosk_contact
> contact_name jdoe
> alias John Doe
> ...
> } # DOESN'T ADD TO KIOSK-FOLKS
>
> When try to verify my nagios configuration this is the error i get:
>
> Error: Contactgroup has no members (config file
> '/usr/local/opt/nagios/etc/contactgroups.cfg', starting on line 25)
>
> I don't understand why it works for the one, but not for the other.
> Is this a bug?
This is somewhere between a missing feature and a bug, but it is quite
inconsistent. Here's a quick patch to fix it. It is applied against
the current CVS tree.
diff -urN nagios-orig/xdata/xodtemplate.c nagios/xdata/xodtemplate.c
--- nagios-orig/xdata/xodtemplate.c 2005-11-16 03:49:35.000000000 -0500
+++ nagios/xdata/xodtemplate.c 2005-12-09 10:04:17.000000000 -0500
@@ -5874,6 +5874,8 @@
this_contact->contact_name=strdup(template_contact->contact_name);
if(this_contact->alias==NULL && template_contact->alias!=NULL)
this_contact->alias=strdup(template_contact->alias);
+ if(this_contact->contactgroups==NULL &&
template_contact->contactgroups!=NULL)
+
this_contact->contactgroups=strdup(template_contact->contactgroups);
if(this_contact->email==NULL && template_contact->email!=NULL)
this_contact->email=strdup(template_contact->email);
if(this_contact->pager==NULL && template_contact->pager!=NULL)
--
Chet Luther
chet.luther at gmail.com
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
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