return v;
} /* }}} disk_t *get_disk */
-static int submit_one_value (const char *host, /* {{{ */
+static int submit_values (const char *host, /* {{{ */
const char *plugin_inst,
- const char *type, const char *type_inst, value_t value,
+ const char *type, const char *type_inst,
+ value_t *values, int values_len,
time_t timestamp)
{
value_list_t vl = VALUE_LIST_INIT;
- vl.values = &value;
- vl.values_len = 1;
+ vl.values = values;
+ vl.values_len = values_len;
if (timestamp > 0)
vl.time = timestamp;
return (plugin_dispatch_values (&vl));
} /* }}} int submit_uint64 */
-#if 0
-static int submit_uint64 (const char *host, const char *plugin_inst, /* {{{ */
- const char *type, const char *type_inst, uint64_t ui64)
+static int submit_two_counters (const char *host, const char *plugin_inst, /* {{{ */
+ const char *type, const char *type_inst, counter_t val0, counter_t val1,
+ time_t timestamp)
{
- value_t v;
+ value_t values[2];
- v.counter = (counter_t) ui64;
+ values[0].counter = val0;
+ values[1].counter = val1;
- return (submit_one_value (host, plugin_inst, type, type_inst, v));
-} /* }}} int submit_uint64 */
-#endif
+ return (submit_values (host, plugin_inst, type, type_inst,
+ values, 2, timestamp));
+} /* }}} int submit_two_counters */
static int submit_double (const char *host, const char *plugin_inst, /* {{{ */
const char *type, const char *type_inst, double d, time_t timestamp)
v.gauge = (gauge_t) d;
- return (submit_one_value (host, plugin_inst, type, type_inst, v, timestamp));
+ return (submit_values (host, plugin_inst, type, type_inst,
+ &v, 1, timestamp));
} /* }}} int submit_uint64 */
static int submit_cache_ratio (const char *host, /* {{{ */
*old_hits = new_hits;
*old_misses = new_misses;
- return (submit_one_value (host, plugin_inst, "cache_ratio", type_inst, v, timestamp));
+ return (submit_values (host, plugin_inst, "cache_ratio", type_inst,
+ &v, 1, timestamp));
} /* }}} int submit_cache_ratio */
static void collect_perf_wafl_data(host_config_t *host, na_elem_t *out, void *data) { /* {{{ */
name = na_child_get_string(counter, "name");
if (!strcmp(name, "name_cache_hit"))
- name_cache_hit = na_child_get_uint64(counter, "value", 0);
+ name_cache_hit = na_child_get_uint64(counter, "value", UINT64_MAX);
else if (!strcmp(name, "name_cache_miss"))
- name_cache_miss = na_child_get_uint64(counter, "value", 0);
+ name_cache_miss = na_child_get_uint64(counter, "value", UINT64_MAX);
else if (!strcmp(name, "find_dir_hit"))
- find_dir_hit = na_child_get_uint64(counter, "value", 0);
+ find_dir_hit = na_child_get_uint64(counter, "value", UINT64_MAX);
else if (!strcmp(name, "find_dir_miss"))
- find_dir_miss = na_child_get_uint64(counter, "value", 0);
+ find_dir_miss = na_child_get_uint64(counter, "value", UINT64_MAX);
else if (!strcmp(name, "buf_hash_hit"))
- buf_hash_hit = na_child_get_uint64(counter, "value", 0);
+ buf_hash_hit = na_child_get_uint64(counter, "value", UINT64_MAX);
else if (!strcmp(name, "buf_hash_miss"))
- buf_hash_miss = na_child_get_uint64(counter, "value", 0);
+ buf_hash_miss = na_child_get_uint64(counter, "value", UINT64_MAX);
else if (!strcmp(name, "inode_cache_hit"))
- inode_cache_hit = na_child_get_uint64(counter, "value", 0);
+ inode_cache_hit = na_child_get_uint64(counter, "value", UINT64_MAX);
else if (!strcmp(name, "inode_cache_miss"))
- inode_cache_miss = na_child_get_uint64(counter, "value", 0);
+ inode_cache_miss = na_child_get_uint64(counter, "value", UINT64_MAX);
else
INFO ("netapp plugin: Found unexpected child: %s", name);
}
/* Submit requested counters */
- if (wafl->flags & PERF_WAFL_NAME_CACHE)
+ if ((wafl->flags & PERF_WAFL_NAME_CACHE)
+ && (name_cache_hit != UINT64_MAX) && (name_cache_miss != UINT64_MAX))
submit_cache_ratio (host->name, plugin_inst, "name_cache_hit",
name_cache_hit, name_cache_miss,
&wafl->last_name_cache_hit, &wafl->last_name_cache_miss,
timestamp);
- if (wafl->flags & PERF_WAFL_DIR_CACHE)
+ if ((wafl->flags & PERF_WAFL_DIR_CACHE)
+ && (find_dir_hit != UINT64_MAX) && (find_dir_miss != UINT64_MAX))
submit_cache_ratio (host->name, plugin_inst, "find_dir_hit",
find_dir_hit, find_dir_miss,
&wafl->last_find_dir_hit, &wafl->last_find_dir_miss,
timestamp);
- if (wafl->flags & PERF_WAFL_BUF_CACHE)
+ if ((wafl->flags & PERF_WAFL_BUF_CACHE)
+ && (buf_hash_hit != UINT64_MAX) && (buf_hash_miss != UINT64_MAX))
submit_cache_ratio (host->name, plugin_inst, "buf_hash_hit",
buf_hash_hit, buf_hash_miss,
&wafl->last_buf_hash_hit, &wafl->last_buf_hash_miss,
timestamp);
- if (wafl->flags & PERF_WAFL_INODE_CACHE)
+ if ((wafl->flags & PERF_WAFL_INODE_CACHE)
+ && (inode_cache_hit != UINT64_MAX) && (inode_cache_miss != UINT64_MAX))
submit_cache_ratio (host->name, plugin_inst, "inode_cache_hit",
inode_cache_hit, inode_cache_miss,
&wafl->last_inode_cache_hit, &wafl->last_inode_cache_miss,
continue;
if (strcmp(name, "disk_busy") == 0)
- disk_busy = na_child_get_uint64(counter, "value", 0);
+ disk_busy = na_child_get_uint64(counter, "value", UINT64_MAX);
else if (strcmp(name, "base_for_disk_busy") == 0)
- base_for_disk_busy = na_child_get_uint64(counter, "value", 0);
+ base_for_disk_busy = na_child_get_uint64(counter, "value", UINT64_MAX);
}
- if ((disk_busy == 0) || (base_for_disk_busy == 0))
+ if ((disk_busy == UINT64_MAX) || (base_for_disk_busy == UINT64_MAX))
{
disk->perf_data.last_disk_busy = 0;
disk->perf_data.last_base_for_disk_busy = 0;