Changeset 9f90ba9a6093963bea2897ebb7cd4d1509a7ff31

Show
Ignore:
Timestamp:
11/22/11 22:21:26 (2 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1322000486 -0500
git-parent:

[16ce15221b247e2c154c6c14f52a100bbe6e410e]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1322000486 -0500
Message:

support extended_id for stratcon internal metrics

Files:

Legend:

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

    rdb7752d r9f90ba9  
    6363static char self_stratcon_hostname[256] = "\0"; 
    6464static struct sockaddr_in self_stratcon_ip; 
     65static noit_boolean stratcon_selfcheck_extended_id = true; 
    6566 
    6667static struct timeval DEFAULT_NOIT_PERIOD_TV = { 5UL, 0UL }; 
     
    11321133  int klen, n = 0, i; 
    11331134  char str[1024]; 
    1134   char uuid_str[UUID_STR_LEN+1]; 
     1135  char uuid_str[1024], tmp_uuid_str[UUID_STR_LEN+1]; 
    11351136  struct timeval epoch, diff; 
    11361137  u_int64_t uptime = 0; 
    1137  
    1138   uuid_unparse_lower(self_stratcon_id, uuid_str); 
     1138  char ip_str[128]; 
     1139 
     1140  inet_ntop(AF_INET, &self_stratcon_ip.sin_addr, ip_str, 
     1141            sizeof(ip_str)); 
     1142 
     1143  uuid_str[0] = '\0'; 
     1144  uuid_unparse_lower(self_stratcon_id, tmp_uuid_str); 
     1145  if(stratcon_selfcheck_extended_id) { 
     1146    strlcat(uuid_str, ip_str, sizeof(uuid_str)-37); 
     1147    strlcat(uuid_str, "`selfcheck`selfcheck`", sizeof(uuid_str)-37); 
     1148  } 
     1149  strlcat(uuid_str, tmp_uuid_str, sizeof(uuid_str)); 
    11391150 
    11401151#define PUSH_BOTH(type, str) do { \ 
     
    11491160  if(closure == NULL) { 
    11501161    /* Only do this the first time we get called */ 
    1151     char ip_str[128]; 
    1152     inet_ntop(AF_INET, &self_stratcon_ip.sin_addr, ip_str, 
    1153               sizeof(ip_str)); 
    11541162    snprintf(str, sizeof(str), "C\t%lu.%03lu\t%s\t%s\tstratcon\t%s\n", 
    11551163             (long unsigned int)now->tv_sec, 
     
    16271635     uuid_parse(uuid_str, self_stratcon_id) == 0) { 
    16281636    int period; 
     1637    noit_conf_get_boolean(NULL, "/stratcon/@extended_id", 
     1638                          &stratcon_selfcheck_extended_id); 
    16291639    /* If a UUID was provided for stratcon itself, we will report metrics 
    16301640     * on a large variety of things (including all noits).