Changeset bf924d6886edb8393112493c37f2b1132cb1bcfe

Show
Ignore:
Timestamp:
03/02/11 16:15:05 (3 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1299082505 +0000
git-parent:

[9337e1f9d0aae029e90f90d6978b9b03a8f10d28]

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

There are a few collectd clients out there that trash the time. We
don't use the time for anything (like timestamping), but make sure the
time is after 1970. That seems arbitrary, so I've removed the constraint.

Files:

Legend:

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

    r9337e1f rbf924d6  
    364364 */ 
    365365 
    366 static unsigned long long collectd_ntohll (unsigned long long n) 
     366static u_int64_t collectd_ntohll (u_int64_t n) 
    367367{ 
    368368#if BYTE_ORDER == BIG_ENDIAN 
    369369  return (n); 
    370370#else 
    371   return (((unsigned long long) ntohl (n)) << 32) + ntohl (n >> 32); 
     371  u_int64_t retval; 
     372  retval = ((uint64_t) ntohl(n & 0xFFFFFFFFLLU)) << 32; 
     373  retval |= ntohl((n & 0xFFFFFFFF00000000LLU) >> 32); 
     374  return retval; 
    372375#endif 
    373 } /* unsigned long long collectd_ntohll */ 
     376} /* u_int64_t collectd_ntohll */ 
    374377 
    375378#define ntohd(d) (d) 
     
    10071010        break; 
    10081011 
    1009       if ((vl.time > 0) 
    1010           && (strlen (vl.host) > 0) 
    1011           && (strlen (vl.plugin) > 0) 
    1012           && (strlen (vl.type) > 0)) 
     1012      if ((strlen (vl.host) > 0) && 
     1013          (strlen (vl.plugin) > 0) && 
     1014          (strlen (vl.type) > 0)) 
    10131015      { 
    10141016        queue_values(ccl, self, check, &vl); 
     
    10171019      { 
    10181020        noitL(noit_error, 
    1019               "collectd: NOT dispatching values [%lld,%lld,%lld,%lld]\n", 
    1020               (long long int)vl.time, (long long int)strlen (vl.host), 
    1021               (long long int)strlen (vl.plugin), 
    1022               (long long int)strlen (vl.type)); 
     1021              "collectd: NOT dispatching values [%lld,%s:%s:%s]\n", 
     1022              (long long int)vl.time, vl.host, vl.plugin, vl.type); 
    10231023      } 
    10241024 
     
    10291029    { 
    10301030      uint64_t tmp = 0; 
    1031       status = parse_part_number (&buffer, &buffer_size, 
    1032           &tmp); 
     1031      status = parse_part_number (&buffer, &buffer_size, &tmp); 
    10331032      if (status == 0) 
    10341033      { 
     
    11041103            n.severity); 
    11051104      } 
     1105/* Time proves untrustworthy... and we don't use it. 
    11061106      else if (n.time <= 0) 
    11071107      { 
     
    11101110            "time == 0.\n"); 
    11111111      } 
     1112*/ 
    11121113      else if (strlen (n.message) <= 0) 
    11131114      {