Changeset 646e6d20498ab1b500fe30137a5541534219618b

Show
Ignore:
Timestamp:
02/19/08 02:40:41 (7 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1203388841 +0000
git-parent:

[b7510b4e0ce386e83beddeb468cdc1f35f16f7e2]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1203388841 +0000
Message:

change the availability stuff to be characters

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/modules/http.c

    r6e90b3f r646e6d2  
    153153  char human_buffer[256], code[4], rt[14]; 
    154154 
    155   memset(&current, 0, sizeof(current)); 
     155  noit_check_stats_clear(&current); 
    156156 
    157157  if(noit_hash_retrieve(check->config, "code", strlen("code"), 
     
    193193  stats_t current; 
    194194 
    195   memset(&current, 0, sizeof(current)); 
     195  noit_check_stats_clear(&current); 
    196196  current.available = NP_UNAVAILABLE; 
    197197  current.state = NP_BAD; 
     
    247247  xmlXPathObjectPtr pobj = NULL; 
    248248 
    249   memset(&current, 0, sizeof(current)); 
     249  noit_check_stats_clear(&current); 
    250250 
    251251  if(ci->body.b) resmon_results = xmlParseMemory(ci->body.b, ci->body.l); 
  • src/modules/ping_icmp.c

    r6e90b3f r646e6d2  
    8282  struct timeval duration; 
    8383 
    84   memset(&current, 0, sizeof(current)); 
     84  noit_check_stats_clear(&current); 
    8585 
    8686  data = (struct check_info *)check->closure; 
  • src/noit_check.c

    re781d1e r646e6d2  
    471471} 
    472472 
     473void 
     474noit_check_stats_clear(stats_t *s) { 
     475  memset(s, 0, sizeof(*s)); 
     476  s->state = NP_UNKNOWN; 
     477  s->available = NP_UNKNOWN; 
     478} 
    473479static void 
    474480__free_metric(void *vm) { 
     
    531537 
    532538  /* check for state changes */ 
    533   if(check->stats.current.available != 0 && 
    534      check->stats.previous.available != 0 && 
     539  if(check->stats.current.available != NP_UNKNOWN && 
     540     check->stats.previous.available != NP_UNKNOWN && 
    535541     check->stats.current.available != check->stats.previous.available) 
    536542    report_change = 1; 
    537   if(check->stats.current.state != 0 && 
    538      check->stats.previous.state != 0 && 
     543  if(check->stats.current.state != NP_UNKNOWN && 
     544     check->stats.previous.state != NP_UNKNOWN && 
    539545     check->stats.current.state != check->stats.previous.state) 
    540546    report_change = 1; 
  • src/noit_check.h

    re01b3ad r646e6d2  
    3939#define NP_UNCONFIG 0x00000008 
    4040 
    41 #define NP_UNKNOWN              /* stats_t.{available,state} */ 
    42 #define NP_AVAILABLE            /* stats_t.available */ 
    43 #define NP_UNAVAILABLE -1          /* stats_t.available */ 
    44 #define NP_BAD                  /* stats_t.state */ 
    45 #define NP_GOOD                 /* stats_t.state */ 
     41#define NP_UNKNOWN '0'             /* stats_t.{available,state} */ 
     42#define NP_AVAILABLE 'A'           /* stats_t.available */ 
     43#define NP_UNAVAILABLE 'U'         /* stats_t.available */ 
     44#define NP_BAD 'B'                 /* stats_t.state */ 
     45#define NP_GOOD 'G'                /* stats_t.state */ 
    4646 
    4747typedef struct { 
     
    5757typedef struct { 
    5858  struct timeval whence; 
    59   int16_t available; 
    60   int16_t state; 
     59  int8_t available; 
     60  int8_t state; 
    6161  u_int32_t duration; 
    6262  char *status; 
     
    143143  noit_poller_lookup_by_name(char *target, char *name); 
    144144 
     145API_EXPORT(void) 
     146  noit_check_stats_clear(stats_t *s); 
     147 
    145148struct _noit_module; 
    146149API_EXPORT(void)