summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3781e05)
raw | patch | inline | side by side (parent: 3781e05)
author | Chad Malfait <cmalfait@yahoo.com> | |
Sat, 13 Apr 2013 19:34:38 +0000 (13:34 -0600) | ||
committer | Florian Forster <octo@collectd.org> | |
Wed, 17 Apr 2013 05:45:15 +0000 (07:45 +0200) |
Signed-off-by: Florian Forster <octo@collectd.org>
configure.in | patch | blob | history | |
src/Makefile.am | patch | blob | history | |
src/collectd.conf.in | patch | blob | history | |
src/lvm.c | [new file with mode: 0644] | patch | blob |
src/volume.c | [deleted file] | patch | blob | history |
diff --git a/configure.in b/configure.in
index 0fb20c6c5ea8edf0485e20d07668c61eb64d448f..fb71e6f24ee943ded36ae4edc2bc431e45e6c371 100644 (file)
--- a/configure.in
+++ b/configure.in
plugin_interface="yes"
plugin_irq="yes"
plugin_load="yes"
+ plugin_lvm="yes"
plugin_memory="yes"
plugin_nfs="yes"
plugin_numa="yes"
plugin_thermal="yes"
plugin_uptime="yes"
plugin_vmem="yes"
- plugin_volume="yes"
plugin_vserver="yes"
plugin_wireless="yes"
AC_PLUGIN([load], [$plugin_load], [System load])
AC_PLUGIN([logfile], [yes], [File logging plugin])
AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions statistics])
+AC_PLUGIN([lvm], [$with_liblvm2app], [LVM statistics])
AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
AC_PLUGIN([match_hashed], [yes], [The hashed match])
AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
AC_PLUGIN([varnish], [$with_libvarnish], [Varnish cache statistics])
AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
-AC_PLUGIN([volume], [$with_liblvm2app], [Volume statistics])
AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
AC_PLUGIN([write_graphite], [yes], [Graphite / Carbon output plugin])
load . . . . . . . . $enable_load
logfile . . . . . . . $enable_logfile
lpar... . . . . . . . $enable_lpar
+ lvm . . . . . . . . . $enable_lvm
madwifi . . . . . . . $enable_madwifi
match_empty_counter . $enable_match_empty_counter
match_hashed . . . . $enable_match_hashed
uuid . . . . . . . . $enable_uuid
varnish . . . . . . . $enable_varnish
vmem . . . . . . . . $enable_vmem
- volume . . . . . . . $enable_volume
vserver . . . . . . . $enable_vserver
wireless . . . . . . $enable_wireless
write_graphite . . . $enable_write_graphite
diff --git a/src/Makefile.am b/src/Makefile.am
index 4ffb8b0119a55aa1429ec6d99415254c4f58ceb4..8dfdebedff03237bd3447283263bd5d6d322f659 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
lpar_la_LIBADD = -lperfstat
endif
+if BUILD_PLUGIN_LVM
+pkglib_LTLIBRARIES += lvm.la
+lvm_la_SOURCES = lvm.c
+lvm_la_LDFLAGS = -module -avoid-version
+lvm_la_LIBADD = $(BUILD_WITH_LIBLVM2APP_LIBS)
+collectd_LDADD += "-dlopen" lvm.la
+collectd_DEPENDENCIES += lvm.la
+endif
+
if BUILD_PLUGIN_MADWIFI
pkglib_LTLIBRARIES += madwifi.la
madwifi_la_SOURCES = madwifi.c madwifi.h
collectd_DEPENDENCIES += vmem.la
endif
-if BUILD_PLUGIN_VOLUME
-pkglib_LTLIBRARIES += volume.la
-volume_la_SOURCES = volume.c
-volume_la_LDFLAGS = -module -avoid-version
-volume_la_LIBADD = $(BUILD_WITH_LIBLVM2APP_LIBS)
-collectd_LDADD += "-dlopen" volume.la
-collectd_DEPENDENCIES += volume.la
-endif
-
if BUILD_PLUGIN_VSERVER
pkglib_LTLIBRARIES += vserver.la
vserver_la_SOURCES = vserver.c
diff --git a/src/collectd.conf.in b/src/collectd.conf.in
index ecc45c9ab9bd9320db6b68fa8a8fb9b63042566a..e95fae6a613799b6c72ac758e9502a3bcdc77955 100644 (file)
--- a/src/collectd.conf.in
+++ b/src/collectd.conf.in
#@BUILD_PLUGIN_LIBVIRT_TRUE@LoadPlugin libvirt
@BUILD_PLUGIN_LOAD_TRUE@@BUILD_PLUGIN_LOAD_TRUE@LoadPlugin load
#@BUILD_PLUGIN_LPAR_TRUE@LoadPlugin lpar
+#@BUILD_PLUGIN_LVM_TRUE@LoadPlugin lvm
#@BUILD_PLUGIN_MADWIFI_TRUE@LoadPlugin madwifi
#@BUILD_PLUGIN_MBMON_TRUE@LoadPlugin mbmon
#@BUILD_PLUGIN_MD_TRUE@LoadPlugin md
#@BUILD_PLUGIN_VARNISH_TRUE@LoadPlugin varnish
#@BUILD_PLUGIN_VMEM_TRUE@LoadPlugin vmem
#@BUILD_PLUGIN_VSERVER_TRUE@LoadPlugin vserver
-#@BUILD_PLUGIN_VOLUME_TRUE@LoadPlugin volume
#@BUILD_PLUGIN_WIRELESS_TRUE@LoadPlugin wireless
#@BUILD_PLUGIN_WRITE_GRAPHITE_TRUE@LoadPlugin write_graphite
#@BUILD_PLUGIN_WRITE_HTTP_TRUE@LoadPlugin write_http
diff --git a/src/lvm.c b/src/lvm.c
--- /dev/null
+++ b/src/lvm.c
@@ -0,0 +1,103 @@
+/**
+ * collectd - src/lvm.c
+ * Copyright (C) 2013 Chad Malfait
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; only version 2 of the License is applicable.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors:
+ * Chad Malfait <malfaitc at yahoo.com>
+ **/
+
+#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_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));
+ sstrncpy(vl.type_instance, type_instance, sizeof (vl.type_instance));
+
+ plugin_dispatch_values (&vl);
+}
+
+static int vg_read(vg_t vg, char const *vg_name)
+{
+ struct dm_list *lvs;
+ struct lvm_lv_list *lvl;
+
+ lvm_submit (vg_name, "free", lvm_vg_get_free_size(vg));
+
+ lvs = lvm_vg_list_lvs(vg);
+ dm_list_iterate_items(lvl, lvs) {
+ lvm_submit(vg_name, lvm_lv_get_name(lvl->lv), lvm_lv_get_size(lvl->lv));
+ }
+
+ return (0);
+}
+
+static int lvm_read(void)
+{
+ lvm_t lvm;
+ struct dm_list *vg_names;
+ struct lvm_str_list *name_list;
+
+ lvm = lvm_init(NULL);
+ if (!lvm) {
+ ERROR("lvm plugin: lvm_init failed.");
+ return (-1);
+ }
+
+ vg_names = lvm_list_vg_names(lvm);
+ if (!vg_names) {
+ ERROR("lvm plugin lvm_list_vg_name failed %s", lvm_errmsg(lvm));
+ lvm_quit(lvm);
+ return (-1);
+ }
+
+ dm_list_iterate_items(name_list, vg_names) {
+ vg_t vg;
+
+ vg = lvm_vg_open(lvm, name_list->str, "r", 0);
+ if (!vg) {
+ ERROR ("lvm plugin: lvm_vg_open (%s) failed: %s",
+ name_list->str, lvm_errmsg(lvm));
+ continue;
+ }
+
+ vg_read(vg, name_list->str);
+ lvm_vg_close(vg);
+ }
+
+ lvm_quit(lvm);
+ return (0);
+} /*lvm_read */
+
+void module_register(void)
+{
+ plugin_register_read("lvm", lvm_read);
+} /* void module_register */
diff --git a/src/volume.c b/src/volume.c
--- a/src/volume.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * collectd - src/volume.c
- * Copyright (C) 2013 Chad Malfait
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; only version 2 of the License is applicable.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Authors:
- * Chad Malfait <malfaitc at yahoo.com>
- **/
-
-#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_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));
- sstrncpy(vl.type_instance, type_instance, sizeof (vl.type_instance));
-
- plugin_dispatch_values (&vl);
-}
-
-static int vg_read(vg_t vg, char const *vg_name)
-{
- struct dm_list *lvs;
- struct lvm_lv_list *lvl;
-
- lvm_submit (vg_name, "free", lvm_vg_get_free_size(vg));
-
- lvs = lvm_vg_list_lvs(vg);
- dm_list_iterate_items(lvl, lvs) {
- lvm_submit(vg_name, lvm_lv_get_name(lvl->lv), lvm_lv_get_size(lvl->lv));
- }
-
- return (0);
-}
-
-static int lvm_read(void)
-{
- lvm_t lvm;
- struct dm_list *vg_names;
- struct lvm_str_list *name_list;
-
- lvm = lvm_init(NULL);
- if (!lvm) {
- ERROR("volume plugin: lvm_init failed.");
- return (-1);
- }
-
- vg_names = lvm_list_vg_names(lvm);
- if (!vg_names) {
- ERROR("volume plugin lvm_list_vg_name failed %s", lvm_errmsg(lvm));
- lvm_quit(lvm);
- return (-1);
- }
-
- dm_list_iterate_items(name_list, vg_names) {
- vg_t vg;
-
- vg = lvm_vg_open(lvm, name_list->str, "r", 0);
- if (!vg) {
- ERROR ("volume plugin: lvm_vg_open (%s) failed: %s",
- name_list->str, lvm_errmsg(lvm));
- continue;
- }
-
- vg_read(vg, name_list->str);
- lvm_vg_close(vg);
- }
-
- lvm_quit(lvm);
- return (0);
-} /*lvm_read */
-
-void module_register(void)
-{
- plugin_register_read("volume", lvm_read);
-} /* void module_register */