[Date Prev]   [Date Next] [Thread Prev]   [Thread Next] [Date Index]   [Thread Index]

 

     Re: [nocol-users] auto-update

 > From: Steve Mickeler
 > Is there a way to get nocol to auto-detect any changed in the config files
 > such as portmon-confg or ippingmon-confg so it can start/stop monitoring
 > new stuff as needed ?

I did some work on "reconfig ippingmon with kill -HUP"
fix recently.  Patches for v4.2beta5 are enclosed fwiw.

Note well: my #define __USE_BSD_SIGNAL is a bone-headed
linux specific hack that should be made portable!

But even worse, these patches don't "intelligently" restart
ippingmon: doing a kill -HUP with variables at the critical
level causes the variables to go back to the warning level.
This, in turn, causes problems with my up/down reporting
with doing really frequent reconfigurations with large
polling intervals.

So it would be wonderful if someone would solve this
problem by writing reinit_sites() or somesuch for pingmon.
I'll probably do it (some day this spring?) if no one
else does.

steve
-- -- -- --
Steve Rader
Systems and Network Manager
WiscNet--Internetworking for Wisconsin
rader@wiscnet.net
bash: syntax error near unexpected token `=:)'

-- cut here --
*** lib/misc.c.orig     Thu Mar 20 23:04:02 1997
--- lib/misc.c  Tue Nov 10 14:49:55 1998
***************
*** 36,41 ****
--- 36,42 ----
  #include "nocol.h"
  
  #include <stdio.h>
+ #define __USE_BSD_SIGNAL
  #include <signal.h>                           /* signal numbers       */
  #include <sys/file.h>
  #include <errno.h>
***************
*** 50,56 ****
  nocol_startup(pconfigfile, pdatafile)
       char **pconfigfile, **pdatafile;
  {
!     void nocol_done(), usr1_handler();
      char *s ;
  
      if ((s = (char *)strrchr(prognm, '/')) != NULL)
--- 51,57 ----
  nocol_startup(pconfigfile, pdatafile)
       char **pconfigfile, **pdatafile;
  {
!     void nocol_done(), usr1_handler(), nocol_reload();
      char *s ;
  
      if ((s = (char *)strrchr(prognm, '/')) != NULL)
***************
*** 101,113 ****
      bsdsignal (SIGQUIT, nocol_done);
      bsdsignal (SIGTERM, nocol_done);
      bsdsignal (SIGINT,  nocol_done);
!     bsdsignal (SIGHUP,  nocol_done);
      bsdsignal (SIGUSR1, usr1_handler);
  #else
      signal (SIGQUIT, nocol_done);     /* Delete pid/data file while dying */
      signal (SIGTERM, nocol_done);
      signal (SIGINT,  nocol_done);
!     signal (SIGHUP,  nocol_done);
      signal (SIGUSR1, usr1_handler);   /* toggles debug */
  #endif
  
--- 102,114 ----
      bsdsignal (SIGQUIT, nocol_done);
      bsdsignal (SIGTERM, nocol_done);
      bsdsignal (SIGINT,  nocol_done);
!     bsdsignal (SIGHUP,  nocol_reload);
      bsdsignal (SIGUSR1, usr1_handler);
  #else
      signal (SIGQUIT, nocol_done);     /* Delete pid/data file while dying */
      signal (SIGTERM, nocol_done);
      signal (SIGINT,  nocol_done);
!     signal (SIGHUP,  nocol_reload);
      signal (SIGUSR1, usr1_handler);   /* toggles debug */
  #endif
  
-- cut here --

-- cut here --
*** pingmon/pingmon.c.orig      Mon Mar 31 00:25:22 1997
--- pingmon/pingmon.c   Tue Nov 10 15:01:13 1998
***************
*** 37,42 ****
--- 37,43 ----
  
  #include <string.h>                   /* For strcat() definitions     */
  #include <sys/file.h>
+ #define __USE_BSD_SIGNAL
  #include <signal.h>                   /* For signal numbers           */
  
  /*+ 
***************
*** 197,202 ****
--- 198,207 ----
      char record[MAXLINE];
      struct tm *loctime ;
      time_t locclock ;                 /* Careful, don't use 'long'    */
+     
+     if (debug) {
+       fprintf(stderr, "reading config file\n");
+     }
  
      if ((p_nodes = fopen(configfile, "r")) == NULL)
      {
***************
*** 278,284 ****
--- 283,300 ----
  
      }                                 /* end: while                   */
      fclose (p_nodes);                 /* Not needed any more          */    
+     if (debug) {
+       fprintf(stderr, "done reading config file\n");
+     }
      return(1);                                /* All OK                       */
  
  }     /* end:  init_sites()   */
+ 
+ nocol_reload ( ) {
+     int       fdout = 0;                      /* File desc for output data file */
+     if (debug) { fprintf(stderr,"cought HUP... reloading...\n"); }
+     fdout = open(datafile, O_RDWR|O_CREAT|O_TRUNC, DATAFILE_MODE);
+     init_sites(fdout, configfile);
+     return(1);
+ }

-- cut here --