*
* Authors:
* Chad Malfait <malfaitc at yahoo.com>
- * Benjamin Gilbert <bgilbert at cs.cmu.edu>
+ * Benjamin Gilbert <bgilbert at backtick.net>
**/
#include <lvm2app.h>
#include "collectd.h"
+
#include "common.h"
#include "plugin.h"
static void lvm_submit (char const *plugin_instance, char const *type_instance,
uint64_t ivalue)
{
- value_t v;
value_list_t vl = VALUE_LIST_INIT;
- v.gauge = (gauge_t) ivalue;
-
- vl.values = &v;
+ vl.values = &(value_t) { .gauge = (gauge_t) ivalue };
vl.values_len = 1;
- sstrncpy(vl.host, hostname_g, sizeof (vl.host));
sstrncpy(vl.plugin, "lvm", sizeof (vl.plugin));
sstrncpy(vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
sstrncpy(vl.type, "df_complex", sizeof (vl.type));
lvm_submit (vg_name, "free", lvm_vg_get_free_size(vg));
lvs = lvm_vg_list_lvs(vg);
- if (lvs == NULL)
+ if (!lvs) {
+ /* no VGs are defined, which is not an error per se */
return;
+ }
+
dm_list_iterate_items(lvl, lvs) {
name = lvm_lv_get_name(lvl->lv);
- attrs = lvm_lv_get_attr(lvl->lv);
+ attrs = get_lv_property_string(lvl->lv, "lv_attr");
size = lvm_lv_get_size(lvl->lv);
if (name == NULL || attrs == NULL || size == NO_VALUE)
continue;