Merge branch 'collectd-5.2'
authorFlorian Forster <octo@collectd.org>
Sun, 7 Apr 2013 17:23:40 +0000 (19:23 +0200)
committerFlorian Forster <octo@collectd.org>
Sun, 7 Apr 2013 17:23:40 +0000 (19:23 +0200)
1  2 
src/netapp.c
src/snmp.c

diff --cc src/netapp.c
@@@ -1758,13 -1602,78 +1761,14 @@@ static int cna_handle_volume_usage_dat
                }
  
                sis = na_elem_child(elem_volume, "sis");
 -              if (sis == NULL)
 -                      continue;
 -
 -              if (na_elem_child(sis, "sis-info"))
 -                      sis = na_elem_child(sis, "sis-info");
 -              
 -              sis_state = na_child_get_string(sis, "state");
 -              if (sis_state == NULL)
 -                      continue;
 -
 -              /* If SIS is not enabled, there's nothing left to do for this volume. */
 -              if (strcmp ("enabled", sis_state) != 0)
 -                      continue;
 -
 -              sis_saved_reported = na_child_get_uint64(sis, "size-saved", UINT64_MAX);
 -              if (sis_saved_reported == UINT64_MAX)
 -                      continue;
 -
 -              /* size-saved is actually a 32 bit number, so ... time for some guesswork. */
 -              if ((sis_saved_reported >> 32) != 0) {
 -                      /* In case they ever fix this bug. */
 -                      v->sis_saved = sis_saved_reported;
 -                      v->flags |= HAVE_VOLUME_USAGE_SIS_SAVED;
 -              } else { /* really hacky work-around code. {{{ */
 -                      uint64_t sis_saved_percent;
 -                      uint64_t sis_saved_guess;
 -                      uint64_t overflow_guess;
 -                      uint64_t guess1, guess2, guess3;
 -
 -                      /* Check if we have v->norm_used. Without it, we cannot calculate
 -                       * sis_saved_guess. */
 -                      if ((v->flags & HAVE_VOLUME_USAGE_NORM_USED) == 0)
 -                              continue;
 -
 -                      sis_saved_percent = na_child_get_uint64(sis, "percentage-saved", UINT64_MAX);
 -                      if (sis_saved_percent > 100)
 -                              continue;
 -
 -                      /* The "size-saved" value is a 32bit unsigned integer. This is a bug and
 -                       * will hopefully be fixed in later versions. To work around the bug, try
 -                       * to figure out how often the 32bit integer wrapped around by using the
 -                       * "percentage-saved" value. Because the percentage is in the range
 -                       * [0-100], this should work as long as the saved space does not exceed
 -                       * 400 GBytes. */
 -                      /* percentage-saved = size-saved / (size-saved + size-used) */
 -                      if (sis_saved_percent < 100)
 -                              sis_saved_guess = v->norm_used * sis_saved_percent / (100 - sis_saved_percent);
 -                      else
 -                              sis_saved_guess = v->norm_used;
 -
 -                      overflow_guess = sis_saved_guess >> 32;
 -                      guess1 = overflow_guess ? ((overflow_guess - 1) << 32) + sis_saved_reported : sis_saved_reported;
 -                      guess2 = (overflow_guess << 32) + sis_saved_reported;
 -                      guess3 = ((overflow_guess + 1) << 32) + sis_saved_reported;
 -
 -                      if (sis_saved_guess < guess2) {
 -                              if ((sis_saved_guess - guess1) < (guess2 - sis_saved_guess))
 -                                      v->sis_saved = guess1;
 -                              else
 -                                      v->sis_saved = guess2;
 -                      } else {
 -                              if ((sis_saved_guess - guess2) < (guess3 - sis_saved_guess))
 -                                      v->sis_saved = guess2;
 -                              else
 -                                      v->sis_saved = guess3;
 -                      }
 -                      v->flags |= HAVE_VOLUME_USAGE_SIS_SAVED;
 -              } /* }}} end of 32-bit workaround */
 +              if (sis != NULL) {
 +                      cna_handle_volume_sis_data (host, v, sis);
 +                      cna_handle_volume_sis_saved (host, v, sis);
 +              }
        } /* for (elem_volume) */
  
-       return (cna_submit_volume_usage_data (host->name, cfg_volume, host->interval));
+       return (cna_submit_volume_usage_data (host->name, cfg_volume,
+                               host->cfg_volume_usage->interval.interval));
  } /* }}} int cna_handle_volume_usage_data */
  
  static int cna_setup_volume_usage (cfg_volume_usage_t *cvu) /* {{{ */
diff --cc src/snmp.c
Simple merge