From: Florian Forster Date: Fri, 28 Sep 2007 11:45:39 +0000 (+0200) Subject: Merge branch 'collectd-3.11' into collectd-4.0 X-Git-Tag: collectd-4.0.9~1 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=bd66a09b35da21dcb405650ae4587bf2ca811438;p=collectd.git Merge branch 'collectd-3.11' into collectd-4.0 Conflicts: ChangeLog configure.in src/wireless.c --- bd66a09b35da21dcb405650ae4587bf2ca811438 diff --cc ChangeLog index a4f3fc5b,44e07093..7d48baf0 --- a/ChangeLog +++ b/ChangeLog @@@ -1,111 -1,7 +1,115 @@@ +yyyy-mm-dd, Version 4.0.9 + * apcups plugin: Fix reporting of the `load percent' data. + +2007-09-12, Version 4.0.8 + * collectd: The `sstrerror' function was improved to work correctly + with the broken GNU version of `strerror_r'. + * collectd: Write an error message to STDERR when loading of a plugin + fails. + * apcups plugin: Fix the `types' used to submit the values: They still + has an `apcups_' prefix which doesn't work anymore. + * rrdtool plugin: Create new RRD-files with the `begin' time set to + whatever the client thinks is `now'.. + +2007-08-26, Version 4.0.7 + * documentation: Some typos have been fixed and some information has + been improved. + * build system: Many fixes for detecting libraries in unusual places, + such as on RedHat systems. The affected libraries are `libcurl', + `libmysql', and `libupsclient'. + * network plugin: Allow the `Port' option to be specified as a number + (i. e. without quotes). + * nut plugin: A fix allows linking the nut plugin against + libupsclient, version >= 2.2.0. + * processes plugin: Fix a potential segmentation fault. + +2007-07-30, Version 4.0.6 + * sensors plugin: Fix the ignorelist functionality: Only the `type + instance' was used to match against the list, but the documentation + told otherwise. This release fixes the code, so it complies with the + documentation. + * syslog plugin: Call `openlog' right when the plugin is loaded, so + configuration messages will end up in the logging facility. + * conrtib/fedora: The contributed specfile for Fedora has been + updated. + +2007-07-05, Version 4.0.5 + * Portability: More fixes for OpenBSD have been included. + +2007-06-24, Version 4.0.4 + * cpu plugin: Fixed the Solaris code. + * dns plugin: Fixed a build issue for OpenBSD. + * interface plugin: Fixed the Solaris code. + * load plugin: Fixed the alternative `/proc' Linux code. + * memory plugin: Fixed the Solaris code. + * oconfig: Don't require `-lfl' anymore. + +2007-06-19, Version 4.0.3 + * cpu plugin: Fix the Darwin / Mac OS X code. + * ping plugin: Use the return value of `getpid', not its address. + * csv, rrdtool plugin: Fixed a bug that prevented an buffer to be + initialized correctly. + * configure: Added `--with-nan-emulation' to aid cross compilation. + +2007-06-12, Version 4.0.2 + * hddtemp and ntpd plugin: Corrected the parsing of port numbers when + they're given in numerically form. + +2007-06-07, Version 4.0.1 + * iptables plugin: A bug in the configuration routine has been fixed. + Setting a comment in the configfile will no longer cause a + segmentation fault. + +2007-06-03, Version 4.0.0 + * collectd: The plugin-infrastructure has been changed to allow for + more types of plugins, namely `write' and `log' plugins. + * collectd: The read-function has been changed to read many plugins in + parallel, using threads. Thus, plugins generally need to use + thread-safe functions from now on. + * collectd: The '-t' command line options allows to perform syntax tests + of the configuration file and exit immediately. + * csv plugin: The new `csv' plugin handles output to `comma separated + values'-files. + * rrdtool plugin: The new `rrdtool' plugin handles output to + RRD-files. Data can be cached to combine multiple updates into one + write to increase IO-performance. + * network plugin: The new `network' plugin handles IO via the network. + It implements a different, much more extensible protocol which can + combine many values in one packet, decreasing the number of UDP- + packets being sent. It can read from and send to the network and + with the appropriate configuration even forward packets to other + networks. + * unixsock plugin: The new `unixsock' plugin provides an interface to + communicate with the daemon while it is running. Right now the + commands `GETVAL' and `PUTVAL' are implemented, but more are to + come. + * perl plugin: The new `perl' plugin allows you to write extensions + for collectd in the scripting-language Perl. + * logfile plugin: The new `logfile' plugin writes logmessages to files + or STDOUT or STDERR. + * syslog plugin: The new `syslog' plugin sends logmessages to the + system's syslog daemon. + * entropy plugin: The new `entropy' plugin collects the amount of + entropy currently being available to the system. + * exec plugin: The new `exec' plugin forks child processes and reads + back values provided by the forked processes. + * iptables plugin: The new `iptables' plugin reads counters from + iptables rules. Thanks to Sjoerd van der Berg for contributing this + plugin. + * irq plugin: The new `irq' plugin collects the IRQ-counters. Thanks + to Peter Holik for contributing this plugin. + * nut plugin: The new `nut' plugin connects the upsd of the `network + ups tools' and reads information about the connected UPS. + * apache plugin: Support for lighttpd's `BusyServers' (aka. + connections) field was added by Florent Monbillard. + * collectd-nagios: The new `collectd-nagios' binary queries values + from collectd, parses them and exits according to Nagios-standards. + * manpages: The manpages have been improved a lot. + + 2007-09-28, Version 3.11.7 + * wireless plugin: Correct the handling of cards returning signal and + noise quality as percentage. + 2007-08-31, Version 3.11.6 * processes plugin: Fix a potential segmentation fault. diff --cc src/wireless.c index 81c968e8,c771b9ab..10675499 --- a/src/wireless.c +++ b/src/wireless.c @@@ -48,30 -93,36 +48,39 @@@ static double wireless_dbm_to_watt (dou } #endif -static void wireless_submit (char *device, - double quality, double power, double noise) +static void wireless_submit (const char *plugin_instance, const char *type, + double value) { - char buf[BUFSIZE]; - int status; + value_t values[1]; + value_list_t vl = VALUE_LIST_INIT; - status = snprintf (buf, BUFSIZE, "%u:%f:%f:%f", - (unsigned int) curtime, - quality, power, noise); - if ((status < 1) || (status >= BUFSIZE)) - return; + values[0].gauge = value; - plugin_submit (MODULE_NAME, device, buf); -} + vl.values = values; + vl.values_len = 1; + vl.time = time (NULL); + strcpy (vl.host, hostname_g); + strcpy (vl.plugin, "wireless"); + strncpy (vl.plugin_instance, plugin_instance, + sizeof (vl.plugin_instance)); + + plugin_dispatch_values (type, &vl); +} /* void wireless_submit */ + #define POWER_MIN -90.0 + #define POWER_MAX -50.0 + static double wireless_percent_to_power (double quality) + { + assert ((quality >= 0.0) && (quality <= 100.0)); + + return ((quality * (POWER_MAX - POWER_MIN)) + POWER_MIN); + } /* double wireless_percent_to_power */ + -static void wireless_read (void) +static int wireless_read (void) { #ifdef KERNEL_LINUX - FILE *fh; - char buffer[BUFSIZE]; + char buffer[1024]; char *device; double quality; @@@ -87,15 -137,17 +96,17 @@@ /* there are a variety of names for the wireless device */ if ((fh = fopen (WIRELESS_PROC_FILE, "r")) == NULL) { - syslog (LOG_WARNING, "wireless: fopen: %s", strerror (errno)); - return; + char errbuf[1024]; + WARNING ("wireless: fopen: %s", + sstrerror (errno, errbuf, sizeof (errbuf))); + return (-1); } - while (fgets (buffer, BUFSIZE, fh) != NULL) + devices_found = 0; + while (fgets (buffer, sizeof (buffer), fh) != NULL) { + char *endptr; + numfields = strsplit (buffer, fields, 8); if (numfields < 5) @@@ -109,25 -161,30 +120,34 @@@ fields[0][len] = '\0'; device = fields[0]; - quality = atof (fields[2]); - power = atof (fields[3]); - noise = atof (fields[4]); - - /* Fill in invalid values when conversion failed.. */ - if (quality == 0.0) - quality = -1.0; /* quality >= 0 */ - - if (power == 0.0) - power = 1.0; /* power <= 0 */ - if (noise == 0.0) - noise = 1.0; /* noise <= 0 */ + quality = strtod (fields[2], &endptr); + if (fields[2] == endptr) + quality = -1.0; /* invalid */ + + /* power [dBm] < 0.0 */ + power = strtod (fields[3], &endptr); + if (fields[3] == endptr) + power = 1.0; /* invalid */ + else if ((power >= 0.0) && (power <= 100.0)) + power = wireless_percent_to_power (power); + else if (power > 100.0) + power = 1.0; /* invalid */ + + /* noise [dBm] < 0.0 */ + noise = strtod (fields[3], &endptr); + if (fields[3] == endptr) + noise = 1.0; /* invalid */ + else if ((noise >= 0.0) && (noise <= 100.0)) + noise = wireless_percent_to_power (noise); + else if (noise > 100.0) + noise = 1.0; /* invalid */ - wireless_submit (device, quality, power, noise); + wireless_submit (device, "signal_quality", quality); + wireless_submit (device, "signal_power", power); + wireless_submit (device, "signal_noise", noise); + + devices_found++; } fclose (fh);