Re: [Nagios-devel] New Nagios dev branch?
-
Guest
Re: [Nagios-devel] New Nagios dev branch?
--Apple-Mail-28--1030200468
Content-Type: text/plain;
charset=US-ASCII;
format=flowed;
delsp=yes
Content-Transfer-Encoding: 7bit
On 29 Jan 2010, at 05:36, Ethan Galstad wrote:
> We can. HEAD has usually been the latest/greatest, but it probably
> makes sense for an experimental branch.
That is wise. Ethan, do you have to set it up?
> Can you provide more details on what it is you are proposing to add?
> Synchronization stuff may make more sense being implemented as a NEB
> mobule or addon, so I'd like to see what's on the plate.
Patch attached. Applies cleanly to CVS at the moment.
While I agree that slave synchronisation sits outside code Nagios,
there are changes that are required to Nagios to support such a
feature. The patch contains the core changes required to Nagios.
The idea is that there is a "sync_retention_file" which has slightly
different logic to a normal "state_retention_file", such as only
syncing if the last_check time in the sync file is earlier than the
retained last_check time. The sync file is removed when it has been
read. A new API is also added (SYNC_RETENTION_FILE) to allow syncing
when required. Comments and downtimes are searched based on "similar
attributes" (because id numbers will not be the same).
It also contains test cases for reading the new sync_retention_file,
and some test cases for the new downtime search functions.
I've included documentation both in the sample configuration file and
the configmain.html (which looks generated?). There's probably
additional documentation required as this is an advanced feature and
I'll commit to doing that if this is going to be included.
Apologies for the code formatting. I'll clean that up if this is okay
to include in CVS.
Comments?
Ton
--Apple-Mail-28--1030200468
Content-Disposition: attachment;
filename=nagios_sync_retention_file.patch
Content-Type: application/octet-stream; x-unix-mode=0644;
name="nagios_sync_retention_file.patch"
Content-Transfer-Encoding: 7bit
Index: xdata/xrddefault.c
===================================================================
--- xdata/xrddefault.c (revision 1)
+++ xdata/xrddefault.c (working copy)
@@ -98,6 +98,7 @@
char *xrddefault_retention_file=NULL;
+char *xrddefault_sync_retention_file=NULL;
char *xrddefault_temp_file=NULL;
@@ -117,6 +118,7 @@
log_debug_info(DEBUGL_RETENTIONDATA,2,"Error: Cannot open main configuration file '%s' for reading!\n",main_config_file);
+ my_free(xrddefault_sync_retention_file);
my_free(xrddefault_retention_file);
my_free(xrddefault_temp_file);
@@ -194,6 +196,9 @@
if(!strcmp(varname,"xrddefault_retention_file") || !strcmp(varname,"state_retention_file"))
xrddefault_retention_file=(char *)strdup(varvalue);
+ else if(!strcmp(varname,"sync_retention_file"))
+ xrddefault_sync_retention_file=(char *)strdup(varvalue);
+
/* temp file definition */
else if(!strcmp(varname,"temp_file"))
xrddefault_temp_file=(char *)strdup(varvalue);
@@ -230,6 +235,7 @@
int xrddefault_cleanup_retention_data(char *config_file){
/* free memory */
+ my_free(xrddefault_sync_retention_file);
my_free(xrddefault_retention_file);
my_free(xrddefault_temp_file);
@@ -606,6 +612,17 @@
/******************************************************************/
int xrddefault_read_state_information(void){
+ return xrddefault_read_retention_file_information(xrddefault_retention_file,TRUE);
+}
+
+int xrddefault_sync_state_information(void){
+ int result=OK;
+ if(xrddefault_sync_retention_file!=NULL)
+ result=xrddefault_read_retention_file_information(xrddefault_sync_retention_file,FALSE);
+ return result;
+}
+
+int xrddefault_read_retention_file_information(char *retention_file, int overwrite_data){
char *input=NULL;
char *inputbuf=NULL;
char *temp_ptr=NULL;
@@ -658,12 +675,15 @@
struct timeval tv[2];
double runtime[2];
int found_directive=FALSE;
+ int retain_flag=TRUE;
+ time_t last_check=0L;
+ int add_object;
log_debug_info(DEBUGL_FUNCTIONS,0,"xrddefault_read_state_information() start\n");
/* make sure we have what we need */
- if(xrddefault_retention_file==NULL){
+ if(retenti
...[email truncated]...
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]