Changeset 4496cc4e7850184a250647f0a956c335c15f5f18

Show
Ignore:
Timestamp:
06/14/12 14:22:45 (2 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1339683765 -0400
git-parent:

[9ddee8b8064f61121aef145c845fd89d05a75156]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1339683765 -0400
Message:

Allow checks to note that they are passive.

If a check doesn't "do" anything to collect metrics and instead
passively allows metrics to arrive, then when you clone the check
to a transient copy, the metrics will always be blank. By
allowing modules to note that the check acts this way, we can
be smarter elsewhere. We should be able to use this to allow
transient streaming of things like statsd, collectd and traps.

Files:

Legend:

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

    r7a237a2 r4496cc4  
    14691469   * Then we can warn people if no stats where written in a period of time 
    14701470   */ 
     1471  check->flags |= NP_PASSIVE_COLLECTION; 
    14711472  INITIATE_CHECK(collectd_submit, self, check, cause); 
    14721473  return 0; 
  • src/modules/httptrap.c

    r34b1855 r4496cc4  
    550550                                        noit_check_t *check, 
    551551                                        int once, noit_check_t *cause) { 
     552  check->flags |= NP_PASSIVE_COLLECTION; 
    552553  if (check->closure == NULL) { 
    553554    httptrap_closure_t *ccl; 
  • src/modules/snmp.c

    re1dc8cf r4496cc4  
    10321032   * never "run."  We accept input out-of-band via snmp traps. 
    10331033   */ 
     1034  check->flags |= NP_PASSIVE_COLLECTION; 
    10341035  return 0; 
    10351036} 
  • src/modules/statsd.c

    rda37717 r4496cc4  
    310310                                        noit_check_t *check, 
    311311                                        int once, noit_check_t *cause) { 
     312  check->flags |= NP_PASSIVE_COLLECTION; 
    312313  if (check->closure == NULL) { 
    313314    statsd_closure_t *ccl; 
  • src/noit_check.c

    rc385b68 r4496cc4  
    13871387    if(uuid_compare(n.checkid, wcheck->checkid)) break; 
    13881388 
     1389    /* We advance before we use because the functions below could 
     1390     * destroy the watchlist item we're looking at right now 
     1391     */ 
     1392    noit_skiplist_next(&watchlist, &next); 
     1393 
    13891394    /* Swap the real check's stats into place */ 
    13901395    memcpy(&backup, &wcheck->stats.current, sizeof(stats_t)); 
     
    13991404    /* Swap them back out */ 
    14001405    memcpy(&wcheck->stats.current, &backup, sizeof(stats_t)); 
    1401  
    1402     noit_skiplist_next(&watchlist, &next); 
    14031406  } 
    14041407} 
  • src/noit_check.h

    rc385b68 r4496cc4  
    6363 */ 
    6464 
    65 #define NP_RUNNING   0x00000001 
    66 #define NP_KILLED    0x00000002 
    67 #define NP_DISABLED  0x00000004 
    68 #define NP_UNCONFIG  0x00000008 
    69 #define NP_TRANSIENT 0x00000010 
    70 #define NP_RESOLVE   0x00000020 
    71 #define NP_RESOLVED  0x00000040 
    72  
    73 #define NP_SUPPRESS_STATUS  0x00001000 
    74 #define NP_SUPPRESS_METRICS 0x00002000 
    75  
    76 #define NP_PREFER_IPV6   0x00004000 
    77 #define NP_SINGLE_RESOLVE 0x00008000 
     65/* The check is currently in-flight (running) */ 
     66#define NP_RUNNING               0x00000001 
     67/* The check has been killed by the scheduling system */ 
     68#define NP_KILLED                0x00000002 
     69/* The check is disable and should not be run */ 
     70#define NP_DISABLED              0x00000004 
     71/* The check is not sufficiently configured to operate */ 
     72#define NP_UNCONFIG              0x00000008 
     73/* The check is a transient copy of another check */ 
     74#define NP_TRANSIENT             0x00000010 
     75/* The check requires name service resolution */ 
     76#define NP_RESOLVE               0x00000020 
     77/* Name service resolution has been compelted for the check */ 
     78#define NP_RESOLVED              0x00000040 
     79/* This check should have 'S' lines suppressed from logging */ 
     80#define NP_SUPPRESS_STATUS       0x00001000 
     81/* This check should have 'M' lines suppressed from logging */ 
     82#define NP_SUPPRESS_METRICS      0x00002000 
     83/* The check should lookup IPv6 records before IPv4 */ 
     84#define NP_PREFER_IPV6           0x00004000 
     85/* Do no fallback to IPv6 from IPv4 and vice versa */ 
     86#define NP_SINGLE_RESOLVE        0x00008000 
     87/* Indicates that the check is receiving data passively 
     88 * and it does not do anything during invocation to collect metrics 
     89 */ 
     90#define NP_PASSIVE_COLLECTION    0x00010000 
    7891 
    7992#define PREFER_IPV4 "prefer-ipv4"