Changeset fe3d821d356a8a6397a0ef63e64ccceee5d2430d

Show
Ignore:
Timestamp:
08/02/09 12:36:39 (5 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1249216599 +0000
git-parent:

[9cbcc9756c0f6df2e69296bfd4069ffa4ed5c42d]

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

first whack at custom threshold. refs #159

Files:

Legend:

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

    r1c53591 rfe3d821  
    111111  struct check_info *data; 
    112112  double avail, min = MAXFLOAT, max = 0.0, avg = 0.0, cnt; 
     113  int avail_needed = 100; 
     114  const char *config_val = NULL; 
    113115  int i, points = 0; 
    114116  char human_buffer[256]; 
     
    135137  avg /= (float)points; 
    136138 
     139  if(noit_hash_retr_str(check->config, "avail_needed", strlen("avail_needed"), 
     140                        &config_val)) 
     141    avail_needed = atoi(config_val); 
     142 
    137143  snprintf(human_buffer, sizeof(human_buffer), 
    138144           "cnt=%d,avail=%0.0f,min=%0.4f,max=%0.4f,avg=%0.4f", 
     
    144150  current.duration = duration.tv_sec * 1000 + duration.tv_usec / 1000; 
    145151  current.available = (avail > 0.0) ? NP_AVAILABLE : NP_UNAVAILABLE; 
    146   current.state = (avail < 1.0) ? NP_BAD : NP_GOOD; 
     152  current.state = (avail < ((float)avail_needed / 100.0)) ? NP_BAD : NP_GOOD; 
    147153  current.status = human_buffer; 
    148154  noit_stats_set_metric(&current, "count", 
  • src/modules/ping_icmp.xml

    rb289e27 rfe3d821  
    1515               default="5" 
    1616               allowed="\d+">The number of ICMP requests to send during a single check.</parameter> 
     17    <parameter name="avail_needed" 
     18               required="optional" 
     19               default="100" 
     20               allowed="\d+">The percentage of ICMP available required for the check to be considered "good."  By default, 100% of the ICMP requests must have responses for a good state.</parameter> 
    1721  </checkconfig> 
    1822  <examples>