Ignore specific retention data

Ton Voon ton.voon at altinity.com
Fri Jul 21 16:28:57 CEST 2006


Hi!

We have been working on load balanced, failover nodes for distributed  
slaves (phew - lots of keywords in that sentence!). The idea we had  
was that you have 2 Nagios slave servers that load balanced a set of  
hosts (and their services) and forward those results back to the  
master. We call those 2 Nagios slave servers the nodes in the slave  
cluster.

The design is that those two nodes would have all hosts defined in  
the cluster, but some would have active checks turned off (via the  
configuration files). There would be a service on each node to  
monitor the other node and in the event of a failure, an event  
handler would then turn active checks on for the hosts on the other  
node via the command file.

This works well .... until the list of hosts on a node changes.

It seems that with retain_state_information=1, there's a variable in  
retention.dat for each host or slave called modified_attributes. This  
is altered when a command is entered via the command file.

So, hosts that have had active checks turned on will be saved with  
modified_attributes=2 (the bit is defined as  
MODATTR_ACTIVE_CHECKS_ENABLED in include/common.h). Then, on Nagios  
reload, it will use the value for active_checks_enabled in here,  
rather than the value we want it to use in the configuration file.

We still want to have retained state information, but we want it to  
ignore the last state due to an enable/disable active check.

We can make it work using this patch:

--- nagios-2.4/xdata/xrddefault.c       2006-04-07 15:00:57.000000000  
+0100
+++ nagios-2.5/xdata/xrddefault.c       2006-07-21 13:08:35.430520177  
+0100
@@ -239,7 +239,7 @@

                 fprintf(fp,"host {\n");
                 fprintf(fp,"\thost_name=%s\n",temp_host->name);
-               fprintf(fp,"\tmodified_attributes=%lu\n",temp_host- 
 >modified_attributes);
+               fprintf(fp,"\tmodified_attributes=%lu\n",temp_host- 
 >modified_attributes&16381);
                 fprintf(fp,"\tcheck_command=%s\n",(temp_host- 
 >host_check_command==NULL)?"":temp_host->host_check_command);
                 fprintf(fp,"\tevent_handler=%s\n",(temp_host- 
 >event_handler==NULL)?"":temp_host->event_handler);
                 fprintf(fp,"\thas_been_checked=%d\n",temp_host- 
 >has_been_checked);
@@ -293,7 +293,7 @@
                 fprintf(fp,"service {\n");
                 fprintf(fp,"\thost_name=%s\n",temp_service->host_name);
                 fprintf(fp,"\tservice_description=%s\n",temp_service- 
 >description);
-               fprintf(fp,"\tmodified_attributes=%lu\n",temp_service- 
 >modified_attributes);
+               fprintf(fp,"\tmodified_attributes=%lu\n",temp_service- 
 >modified_attributes&16381);
                 fprintf(fp,"\tcheck_command=%s\n",(temp_service- 
 >service_check_command==NULL)?"":temp_service->service_check_command);
                 fprintf(fp,"\tevent_handler=%s\n",(temp_service- 
 >event_handler==NULL)?"":temp_service->event_handler);
                 fprintf(fp,"\thas_been_checked=%d\n",temp_service- 
 >has_been_checked);


This alters the value in the retention file to strip off data re:  
active checks. My question is:

Would this be a useful parameter to put into nagios.cfg?

Ton

http://www.altinity.com
T: +44 (0)870 787 9243
F: +44 (0)845 280 1725
Skype: tonvoon


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20060721/245bf749/attachment.html>
-------------- next part --------------
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
-------------- next part --------------
_______________________________________________
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