+ return (submit_wafl_data (hostname, plugin_inst, cfg_wafl, &perf_data));
+} /* }}} void cna_handle_wafl_data */
+
+static int cna_setup_wafl (cfg_wafl_t *cw) /* {{{ */
+{
+ na_elem_t *e;
+
+ if (cw == NULL)
+ return (EINVAL);
+
+ if (cw->query != NULL)
+ return (0);
+
+ cw->query = na_elem_new("perf-object-get-instances");
+ if (cw->query == NULL)
+ {
+ ERROR ("netapp plugin: na_elem_new failed.");
+ return (-1);
+ }
+ na_child_add_string (cw->query, "objectname", "wafl");
+
+ e = na_elem_new("counters");
+ if (e == NULL)
+ {
+ na_elem_free (cw->query);
+ cw->query = NULL;
+ ERROR ("netapp plugin: na_elem_new failed.");
+ return (-1);
+ }
+ na_child_add_string(e, "foo", "name_cache_hit");
+ na_child_add_string(e, "foo", "name_cache_miss");
+ na_child_add_string(e, "foo", "find_dir_hit");
+ na_child_add_string(e, "foo", "find_dir_miss");
+ na_child_add_string(e, "foo", "buf_hash_hit");
+ na_child_add_string(e, "foo", "buf_hash_miss");
+ na_child_add_string(e, "foo", "inode_cache_hit");
+ na_child_add_string(e, "foo", "inode_cache_miss");
+
+ na_child_add(cw->query, e);
+
+ return (0);
+} /* }}} int cna_setup_wafl */
+
+static int cna_query_wafl (host_config_t *host) /* {{{ */
+{
+ na_elem_t *data;
+ int status;
+ time_t now;
+
+ if (host == NULL)
+ return (EINVAL);
+
+ /* If WAFL was not configured, return without doing anything. */
+ if (host->cfg_wafl == NULL)
+ return (0);
+
+ now = time (NULL);
+ if ((host->cfg_wafl->interval.interval + host->cfg_wafl->interval.last_read) > now)
+ return (0);
+
+ status = cna_setup_wafl (host->cfg_wafl);
+ if (status != 0)
+ return (status);
+ assert (host->cfg_wafl->query != NULL);
+
+ data = na_server_invoke_elem(host->srv, host->cfg_wafl->query);
+ if (na_results_status (data) != NA_OK)
+ {
+ ERROR ("netapp plugin: cna_query_wafl: na_server_invoke_elem failed: %s",
+ na_results_reason (data));
+ na_elem_free (data);
+ return (-1);
+ }
+
+ status = cna_handle_wafl_data (host->name, host->cfg_wafl, data);
+
+ if (status == 0)
+ host->cfg_wafl->interval.last_read = now;
+
+ na_elem_free (data);
+ return (status);
+} /* }}} int cna_query_wafl */