Changeset 4d3096faa4dd959a74ca5f5ed53911bac175ead5

Show
Ignore:
Timestamp:
05/06/10 19:04:53 (8 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1273172693 +0000
git-parent:

[ff59a235bf7709ecadf94d1b38a0efeb335345da]

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

fixes #277

Files:

Legend:

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

    r9bdec91 r4d3096f  
    428428noit_check_watch(uuid_t in, int period) { 
    429429  /* First look for a copy that is being watched */ 
     430  char uuid_str[UUID_STR_LEN + 1]; 
    430431  noit_check_t n, *f; 
    431432 
     
    440441  f->timeout = period - 10; 
    441442  f->flags |= NP_TRANSIENT; 
     443  uuid_unparse_lower(in, uuid_str); 
     444  noitL(noit_debug, "Watching %s@%d\n", uuid_str, period); 
    442445  noit_skiplist_insert(&watchlist, f); 
    443446  return f; 
     
    480483  } 
    481484  if(check->feeds->size == 0) { 
     485    char uuid_str[UUID_STR_LEN + 1]; 
     486    uuid_unparse_lower(check->checkid, uuid_str); 
     487    noitL(noit_debug, "Unwatching %s@%d\n", uuid_str, check->period); 
    482488    noit_skiplist_remove(&watchlist, check, NULL); 
    483489    noit_skiplist_destroy(check->feeds, free); 
     
    955961} 
    956962 
     963static int 
     964noit_console_show_watchlist(noit_console_closure_t ncct, 
     965                            int argc, char **argv, 
     966                            noit_console_state_t *dstate, 
     967                            void *closure) { 
     968  noit_skiplist_node *iter, *fiter; 
     969  nc_printf(ncct, "%d active watches.\n", watchlist.size); 
     970  for(iter = noit_skiplist_getlist(&watchlist); iter; 
     971      noit_skiplist_next(&watchlist, &iter)) { 
     972    char uuid_str[UUID_STR_LEN + 1]; 
     973    noit_check_t *check = iter->data; 
     974 
     975    uuid_unparse_lower(check->checkid, uuid_str); 
     976    nc_printf(ncct, "%s:\n\t[%s`%s`%s]\n\tPeriod: %dms\n\tFeeds[%d]:\n", 
     977              uuid_str, check->target, check->module, check->name, 
     978              check->period, check->feeds ? check->feeds->size : 0); 
     979    if(check->feeds && check->feeds->size) { 
     980      for(fiter = noit_skiplist_getlist(check->feeds); fiter; 
     981          noit_skiplist_next(check->feeds, &fiter)) { 
     982        nc_printf(ncct, "\t\t%s\n", (const char *)fiter->data); 
     983      } 
     984    } 
     985  } 
     986  return 0; 
     987} 
     988 
    957989static void 
    958990nc_printf_check_brief(noit_console_closure_t ncct, 
     
    10711103  noit_console_state_add_cmd(showcmd->dstate, 
    10721104    NCSCMD("checks", noit_console_show_checks, NULL, NULL, NULL)); 
    1073 
    1074  
     1105 
     1106  noit_console_state_add_cmd(showcmd->dstate, 
     1107    NCSCMD("watches", noit_console_show_watchlist, NULL, NULL, NULL)); 
     1108
     1109