From 553376a3a6c63875c84b406962e56b908dc4e675 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sat, 10 Nov 2007 13:47:49 +0100 Subject: [PATCH] libvirt plugin: Renamed the `libvirtstats' plugin to `libvirt'. --- configure.in | 8 ++++---- src/Makefile.am | 16 ++++++++-------- src/{libvirtstats.c => libvirt.c} | 34 +++++++++++++++++----------------- 3 files changed, 29 insertions(+), 29 deletions(-) rename src/{libvirtstats.c => libvirt.c} (96%) diff --git a/configure.in b/configure.in index 88323f30..2936058c 100644 --- a/configure.in +++ b/configure.in @@ -1843,7 +1843,7 @@ plugin_entropy="no" plugin_interface="no" plugin_ipvs="no" plugin_irq="no" -plugin_libvirtstats="no" +plugin_libvirt="no" plugin_load="no" plugin_memory="no" plugin_multimeter="no" @@ -1937,7 +1937,7 @@ fi if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes" then - plugin_libvirtstats="yes" + plugin_libvirt="yes" fi if test "x$have_getloadavg" = "xyes" @@ -1998,7 +1998,7 @@ AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics]) AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters]) AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics]) AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics]) -AC_PLUGIN([libvirtstats],[$plugin_libvirtstats], [Virtual machine statistics]) +AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics]) AC_PLUGIN([load], [$plugin_load], [System load]) AC_PLUGIN([logfile], [yes], [File logging plugin]) AC_PLUGIN([mbmon], [yes], [Query mbmond]) @@ -2128,7 +2128,7 @@ Configuration: iptables . . . . . $enable_iptables ipvs . . . . . . . $enable_ipvs irq . . . . . . . . $enable_irq - libvirtstats . . . $enable_libvirtstats + libvirt . . . . . . $enable_libvirt load . . . . . . . $enable_load logfile . . . . . . $enable_logfile mbmon . . . . . . . $enable_mbmon diff --git a/src/Makefile.am b/src/Makefile.am index bc78912c..b7f343fa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -278,14 +278,14 @@ collectd_LDADD += "-dlopen" irq.la collectd_DEPENDENCIES += irq.la endif -if BUILD_PLUGIN_LIBVIRTSTATS -pkglib_LTLIBRARIES += libvirtstats.la -libvirtstats_la_SOURCES = libvirtstats.c -libvirtstats_la_CFLAGS = $(BUILD_WITH_LIBVIRT_CFLAGS) $(BUILD_WITH_LIBXML2_CFLAGS) -libvirtstats_la_LIBADD = $(BUILD_WITH_LIBVIRT_LIBS) $(BUILD_WITH_LIBXML2_LIBS) -libvirtstats_la_LDFLAGS = -module -avoid-version -collectd_LDADD += "-dlopen" libvirtstats.la -collectd_DEPENDENCIES += libvirtstats.la +if BUILD_PLUGIN_LIBVIRT +pkglib_LTLIBRARIES += libvirt.la +libvirt_la_SOURCES = libvirt.c +libvirt_la_CFLAGS = $(BUILD_WITH_LIBVIRT_CFLAGS) $(BUILD_WITH_LIBXML2_CFLAGS) +libvirt_la_LIBADD = $(BUILD_WITH_LIBVIRT_LIBS) $(BUILD_WITH_LIBXML2_LIBS) +libvirt_la_LDFLAGS = -module -avoid-version +collectd_LDADD += "-dlopen" libvirt.la +collectd_DEPENDENCIES += libvirt.la endif if BUILD_PLUGIN_LOAD diff --git a/src/libvirtstats.c b/src/libvirt.c similarity index 96% rename from src/libvirtstats.c rename to src/libvirt.c index 66b5781d..0a998228 100644 --- a/src/libvirtstats.c +++ b/src/libvirt.c @@ -1,5 +1,5 @@ /** - * collectd - src/libvirtstats.c + * collectd - src/libvirt.c * Copyright (C) 2006,2007 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify it @@ -131,7 +131,7 @@ static void submit_counter2 (const char *type, counter_t v0, counter_t v1, } while(0) static int -libvirtstats_init (void) +lv_init (void) { if (virInitialize () != 0) return -1; @@ -140,7 +140,7 @@ libvirtstats_init (void) } static int -libvirtstats_config (const char *key, const char *value) +lv_config (const char *key, const char *value) { if (virInitialize () != 0) return 1; @@ -210,7 +210,7 @@ libvirtstats_config (const char *key, const char *value) value_copy = strdup (value); if (value_copy == NULL) { - ERROR ("libvirtstats plugin: strdup failed."); + ERROR ("libvirt plugin: strdup failed."); return -1; } @@ -247,13 +247,13 @@ libvirtstats_config (const char *key, const char *value) } static int -libvirtstats_read (void) +lv_read (void) { time_t t; int i; if (conn == NULL) { - ERROR ("libvirtstats plugin: Not connected. Use Connection in " + ERROR ("libvirt plugin: Not connected. Use Connection in " "config file to supply connection URI. For more information " "see "); return -1; @@ -295,7 +295,7 @@ libvirtstats_read (void) vinfo = malloc (info.nrVirtCpu * sizeof vinfo[0]); if (vinfo == NULL) { - ERROR ("libvirtstats plugin: malloc failed."); + ERROR ("libvirt plugin: malloc failed."); continue; } @@ -382,7 +382,7 @@ refresh_lists (void) /* Get list of domains. */ domids = malloc (sizeof (int) * n); if (domids == 0) { - ERROR ("libvirtstats plugin: malloc failed."); + ERROR ("libvirt plugin: malloc failed."); return -1; } @@ -424,7 +424,7 @@ refresh_lists (void) goto cont; if (add_domain (dom) < 0) { - ERROR ("libvirtstats plugin: malloc failed."); + ERROR ("libvirt plugin: malloc failed."); goto cont; } @@ -631,7 +631,7 @@ ignore_device_match (ignorelist_t *il, const char *domname, const char *devpath) n = sizeof (char) * (strlen (domname) + strlen (devpath) + 2); name = malloc (n); if (name == NULL) { - ERROR ("libvirtstats plugin: malloc failed."); + ERROR ("libvirt plugin: malloc failed."); return 0; } snprintf (name, n, "%s:%s", domname, devpath); @@ -650,7 +650,7 @@ init_value_list (value_list_t *vl, time_t t, virDomainPtr dom) vl->time = t; vl->interval = interval_g; - strncpy (vl->plugin, "libvirtstats", sizeof (vl->plugin)); + strncpy (vl->plugin, "libvirt", sizeof (vl->plugin)); vl->plugin[sizeof (vl->plugin) - 1] = '\0'; vl->host[0] = '\0'; @@ -768,7 +768,7 @@ submit_counter2 (const char *type, counter_t v0, counter_t v1, } /* void submit_counter2 */ static int -libvirtstats_shutdown (void) +lv_shutdown (void) { free_block_devices (); free_interface_devices (); @@ -791,12 +791,12 @@ libvirtstats_shutdown (void) void module_register (void) { - plugin_register_config ("libvirtstats", - libvirtstats_config, + plugin_register_config ("libvirt", + lv_config, config_keys, NR_CONFIG_KEYS); - plugin_register_init ("libvirtstats", libvirtstats_init); - plugin_register_read ("libvirtstats", libvirtstats_read); - plugin_register_shutdown ("libvirtstats", libvirtstats_shutdown); + plugin_register_init ("libvirt", lv_init); + plugin_register_read ("libvirt", lv_read); + plugin_register_shutdown ("libvirt", lv_shutdown); } /* -- 2.11.0