Null hostgroups

Moshe Hyzon mokatz at gmail.com
Tue Oct 23 18:23:46 CEST 2007


hey all,

I had written this up a few months ago, and I just recently noticed
that someone has the same itch via the nagioscommunity.org Nagios
Daemon Wishlist page.  This patch issues a warning if a host group to
has no  members.  I suppose one could do the same for service groups.

It is a patch against 2.9, I've not updated to 2.10 yet.

=======SNIP=======
--- xdata/xodtemplate.c.orig    2007-05-10 10:48:38.000000000 -0400
+++ xdata/xodtemplate.c 2007-05-10 10:53:11.000000000 -0400
@@ -7708,11 +7708,10 @@
        /* add all members to hostgroup */
        if(this_hostgroup->members==NULL){
 #ifdef NSCORE
-               snprintf(temp_buffer,sizeof(temp_buffer)-1,"Error:
Hostgroup has no members (config file '%s', starting on line
%d)\n",xodtemplate_config_file_name(this_hostgroup->_config_file),this_hostgroup->_start_line);
+               snprintf(temp_buffer,sizeof(temp_buffer)-1,"Warning:
Hostgroup has no explicit members (config file '%s', starting on line
%d)\n",xodtemplate_config_file_name(this_hostgroup->_config_file),this_hostgroup->_start_line);
                temp_buffer[sizeof(temp_buffer)-1]='\x0';
-               write_to_logs_and_console(temp_buffer,NSLOG_CONFIG_ERROR,TRUE);
+
write_to_logs_and_console(temp_buffer,NSLOG_CONFIG_WARNING,TRUE);
 #endif
-               return ERROR;
                }
        for(host_name=strtok(this_hostgroup->members,",");host_name!=NULL;host_name=strtok(NULL,",")){
                strip(host_name);
=======SNIP=======


Moshe Hyzon

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/




More information about the Developers mailing list