From: Sven Trenkel Date: Mon, 28 Sep 2009 10:40:44 +0000 (+0200) Subject: Copypasta error in volume usage. X-Git-Tag: collectd-4.9.0~73^2~23^2~1 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=2f7e758941df10e5915682ead8b04c39efbd805c;p=collectd.git Copypasta error in volume usage. --- diff --git a/src/netapp.c b/src/netapp.c index 47f3b01a..446f8bf6 100644 --- a/src/netapp.c +++ b/src/netapp.c @@ -828,16 +828,21 @@ static void collect_volume_data(host_config_t *host, na_elem_t *out, void *data) /* 2^4 exa-bytes? This will take a while ;) */ size_free = na_child_get_uint64(inst, "size-available", UINT64_MAX); if (size_free != UINT64_MAX) - submit_double (host->name, volume->name, "df_complex", "used", - (double) size_used, /* time = */ 0); - - size_used = na_child_get_uint64(inst, "size-used", UINT64_MAX); - if (size_free != UINT64_MAX) submit_double (host->name, volume->name, "df_complex", "free", (double) size_free, /* time = */ 0); + size_used = na_child_get_uint64(inst, "size-used", UINT64_MAX); + if (size_used != UINT64_MAX) { + if ((volume->cfg_volume_usage.flags & HAVE_VOLUME_USAGE_SNAP) + && (size_used >= volume->cfg_volume_usage.snap_used)) + size_used -= volume->cfg_volume_usage.snap_used; + submit_double (host->name, volume->name, "df_complex", "used", + (double) size_used, /* time = */ 0); + } + snap_reserved = na_child_get_uint64(inst, "snapshot-blocks-reserved", UINT64_MAX); - if (snap_reserved != UINT64_MAX) + if (!(volume->cfg_volume_usage.flags & HAVE_VOLUME_USAGE_SNAP) && (snap_reserved != UINT64_MAX)) + /* If we have snap usage data this value has already been submitted. */ /* 1 block == 1024 bytes as per API docs */ submit_double (host->name, volume->name, "df_complex", "snap_reserved", (double) (1024 * snap_reserved), /* time = */ 0); @@ -1389,7 +1394,7 @@ static host_config_t *cna_config_host (const oconfig_item_t *ci, /* {{{ */ const host_config_t *default_host, const cfg_service_t *def_def_service) { oconfig_item_t *item; - host_config_t *host, *hc; + host_config_t *host; cfg_service_t default_service = *def_def_service; int status; int i;