Show
Ignore:
Timestamp:
06/06/08 18:56:54 (11 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1212778614 +0000
git-parent:

[bee4ff5cd3e246444249d7c48e9bb34fd5e4c831]

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

fixes #30

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/noit_conf_checks.c

    r9491030 r5e653fe  
    406406      if(!idx) nc_printf(ncct, "idle"); 
    407407      nc_write(ncct, "\n", 1); 
    408       if(check->stats.current.status) 
    409         nc_printf(ncct, " recently: %s\n", check->stats.current.status); 
     408      if(check->stats.current.whence.tv_sec == 0) { 
     409        nc_printf(ncct, " last run: never\n"); 
     410      } 
     411      else { 
     412        stats_t *c = &check->stats.current; 
     413        struct timeval now, diff; 
     414        gettimeofday(&now, NULL); 
     415        sub_timeval(now, c->whence, &diff); 
     416        nc_printf(ncct, " last run: %0.3f seconds ago\n", 
     417                  diff.tv_sec + (diff.tv_usec / 1000000.0)); 
     418        nc_printf(ncct, " availability/state: %s/%s\n", 
     419                  noit_check_available_string(c->available), 
     420                  noit_check_state_string(c->state)); 
     421        nc_printf(ncct, " status: %s\n", c->status ? c->status : "[[null]]"); 
     422        nc_printf(ncct, " metrics:\n"); 
     423        memset(&iter, 0, sizeof(iter)); 
     424        while(noit_hash_next(&c->metrics, &iter, &k, &klen, &data)) { 
     425          char buff[256]; 
     426          noit_stats_snprint_metric(buff, sizeof(buff), (metric_t *)data); 
     427          nc_printf(ncct, "   %s\n", buff); 
     428        } 
     429      } 
    410430    } 
    411431  }