/**
* collectd - src/netapp.c
- * Copyright (C) 2009 Sven Trenkel
+ * Copyright (C) 2009,2010 Sven Trenkel
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
/* Submits all the caches used by WAFL. Uses "submit_cache_ratio". */
static int submit_wafl_data (const char *hostname, const char *instance, /* {{{ */
- cfg_wafl_t *old_data, const cfg_wafl_t *new_data, int interval)
+ cfg_wafl_t *old_data, const cfg_wafl_t *new_data, cdtime_t interval)
{
/* Submit requested counters */
if (HAS_ALL_FLAGS (old_data->flags, CFG_WAFL_NAME_CACHE | HAVE_WAFL_NAME_CACHE)
*/
/* Data corresponding to <WAFL /> */
static int cna_handle_wafl_data (const char *hostname, cfg_wafl_t *cfg_wafl, /* {{{ */
- na_elem_t *data, int interval)
+ na_elem_t *data, cdtime_t interval)
{
cfg_wafl_t perf_data;
const char *plugin_inst;
return (-1);
}
- status = cna_handle_wafl_data (host->name, host->cfg_wafl, data, host->interval);
+ status = cna_handle_wafl_data (host->name, host->cfg_wafl, data,
+ host->cfg_wafl->interval.interval);
if (status == 0)
host->cfg_wafl->interval.last_read = now;
return (-1);
}
- status = cna_handle_disk_data (host->name, host->cfg_disk, data, host->interval);
+ status = cna_handle_disk_data (host->name, host->cfg_disk, data,
+ host->cfg_disk->interval.interval);
if (status == 0)
host->cfg_disk->interval.last_read = now;
return (-1);
}
- status = cna_handle_volume_perf_data (host->name, host->cfg_volume_perf, data, host->interval);
+ status = cna_handle_volume_perf_data (host->name, host->cfg_volume_perf, data,
+ host->cfg_volume_perf->interval.interval);
if (status == 0)
host->cfg_volume_perf->interval.last_read = now;
} /* }}} end of 32-bit workaround */
} /* 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) /* {{{ */
return (-1);
}
- status = cna_handle_system_data (host->name, host->cfg_system, data, host->interval);
+ status = cna_handle_system_data (host->name, host->cfg_system, data,
+ host->cfg_system->interval.interval);
if (status == 0)
host->cfg_system->interval.last_read = now;
na_server_adminuser(host->srv, host->username, host->password);
na_server_set_timeout(host->srv, 5 /* seconds */);
- return 0;
+ return (0);
} /* }}} int cna_init_host */
static int cna_init (void) /* {{{ */
return (0);
} /* }}} cna_init */
+static int cna_read_internal (host_config_t *host) { /* {{{ */
+ int status;
+
+ status = cna_query_wafl (host);
+ if (status != 0)
+ return (status);
+
+ status = cna_query_disk (host);
+ if (status != 0)
+ return (status);
+
+ status = cna_query_volume_perf (host);
+ if (status != 0)
+ return (status);
+
+ status = cna_query_volume_usage (host);
+ if (status != 0)
+ return (status);
+
+ status = cna_query_system (host);
+ if (status != 0)
+ return (status);
+
+ return 0;
+} /* }}} int cna_read_internal */
+
static int cna_read (user_data_t *ud) { /* {{{ */
host_config_t *host;
int status;
status = cna_init_host (host);
if (status != 0)
return (status);
-
- cna_query_wafl (host);
- cna_query_disk (host);
- cna_query_volume_perf (host);
- cna_query_volume_usage (host);
- cna_query_system (host);
+
+ status = cna_read_internal (host);
+ if (status != 0)
+ {
+ if (host->srv != NULL)
+ na_server_close (host->srv);
+ host->srv = NULL;
+ }
return 0;
} /* }}} int cna_read */