X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fvserver.c;h=8d524e77c982869f47828e17525adee078dbd934;hb=7e5df1a2c6611bd4ac9fb8ac4b78106f9139ae6e;hp=fef45587a456c455a84e042ad0fd04458ee0e742;hpb=838af4cdc6c8674ed3e14a95fea172118c707a85;p=collectd.git diff --git a/src/vserver.c b/src/vserver.c index fef45587..8d524e77 100644 --- a/src/vserver.c +++ b/src/vserver.c @@ -4,8 +4,7 @@ * * 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; either version 2 of the License, or (at your - * option) any later version. + * 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 @@ -38,59 +37,6 @@ # define VSERVER_HAVE_READ 0 #endif /* defined(KERNEL_LINUX) */ -static data_source_t octets_dsrc[2] = -{ - {"rx", DS_TYPE_COUNTER, 0, 4294967295.0}, - {"tx", DS_TYPE_COUNTER, 0, 4294967295.0} -}; - -static data_set_t octets_ds = -{ - "if_octets", 2, octets_dsrc -}; - -static data_source_t load_dsrc[3] = -{ - {"shortterm", DS_TYPE_GAUGE, 0.0, 100.0}, - {"midterm", DS_TYPE_GAUGE, 0.0, 100.0}, - {"longterm", DS_TYPE_GAUGE, 0.0, 100.0} -}; - -static data_set_t load_ds = -{ - "load", 3, load_dsrc -}; - -static data_source_t threads_dsrc[1] = -{ - {"value", DS_TYPE_GAUGE, 0.0, 65535.0} -}; - -static data_set_t threads_ds = -{ - "vs_threads", 1, threads_dsrc -}; - -static data_source_t processes_dsrc[1] = -{ - {"value", DS_TYPE_GAUGE, 0.0, 65535.0} -}; - -static data_set_t processes_ds = -{ - "vs_processes", 1, processes_dsrc -}; - -static data_source_t memory_dsrc[1] = -{ - {"value", DS_TYPE_GAUGE, 0.0, 9223372036854775807.0} -}; - -static data_set_t memory_ds = -{ - "vs_memory", 1, memory_dsrc -}; - #if VSERVER_HAVE_READ static int pagesize = 0; @@ -178,17 +124,14 @@ static int vserver_read (void) DIR *proc; struct dirent *dent; /* 42 */ - static complain_t complain_obj; - errno = 0; if (NULL == (proc = opendir (PROCDIR))) { - plugin_complain (LOG_ERR, &complain_obj, "vserver plugin: " - "fopen (%s) failed: %s", PROCDIR, strerror (errno)); + char errbuf[1024]; + ERROR ("vserver plugin: fopen (%s): %s", PROCDIR, + sstrerror (errno, errbuf, sizeof (errbuf))); return (-1); } - plugin_relief (LOG_NOTICE, &complain_obj, "vserver plugin: " - "fopen (%s) succeeded.", PROCDIR); while (NULL != (dent = readdir (proc))) { @@ -213,7 +156,11 @@ static int vserver_read (void) continue; if (NULL == (fh = fopen (file, "r"))) - ERROR ("Cannot open '%s': %s", file, strerror (errno)); + { + char errbuf[1024]; + ERROR ("Cannot open '%s': %s", file, + sstrerror (errno, errbuf, sizeof (errbuf))); + } while ((fh != NULL) && (NULL != fgets (buffer, BUFSIZE, fh))) { @@ -256,7 +203,11 @@ static int vserver_read (void) continue; if (NULL == (fh = fopen (file, "r"))) - ERROR ("Cannot open '%s': %s", file, strerror (errno)); + { + char errbuf[1024]; + ERROR ("Cannot open '%s': %s", file, + sstrerror (errno, errbuf, sizeof (errbuf))); + } while ((fh != NULL) && (NULL != fgets (buffer, BUFSIZE, fh))) { @@ -304,7 +255,11 @@ static int vserver_read (void) continue; if (NULL == (fh = fopen (file, "r"))) - ERROR ("Cannot open '%s': %s", file, strerror (errno)); + { + char errbuf[1024]; + ERROR ("Cannot open '%s': %s", file, + sstrerror (errno, errbuf, sizeof (errbuf))); + } while ((fh != NULL) && (NULL != fgets (buffer, BUFSIZE, fh))) { @@ -355,12 +310,6 @@ static int vserver_read (void) void module_register (void) { - plugin_register_data_set (&octets_ds); - plugin_register_data_set (&load_ds); - plugin_register_data_set (&threads_ds); - plugin_register_data_set (&processes_ds); - plugin_register_data_set (&memory_ds); - #if VSERVER_HAVE_READ plugin_register_init ("vserver", vserver_init); plugin_register_read ("vserver", vserver_read);