From: Sebastian Harl Date: Mon, 9 Aug 2010 20:04:54 +0000 (+0200) Subject: collectdctl: Added support for ‘U’ (undef) values in ‘putval’. X-Git-Tag: collectd-5.0.0-beta0~53 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=71ddf90efc69ccf8fef77a9a2ac5e4acf35a69bf;p=collectd.git collectdctl: Added support for ‘U’ (undef) values in ‘putval’. --- diff --git a/src/collectdctl.c b/src/collectdctl.c index cc195095..7ee90a03 100644 --- a/src/collectdctl.c +++ b/src/collectdctl.c @@ -33,6 +33,8 @@ #include +#include + #include #include #include @@ -469,7 +471,12 @@ static int putval (lcc_connection_t *c, int argc, char **argv) * anyway. Also, lcc uses the type information for formatting the * number only, so the real meaning does not matter. -tokkee */ dot = strchr (value, (int)'.'); - if (dot) { /* floating point value */ + endptr = NULL; + if (strcasecmp (value, "U") == 0) { + values[values_len].gauge = NAN; + values_types[values_len] = LCC_TYPE_GAUGE; + } + else if (dot) { /* floating point value */ values[values_len].gauge = strtod (value, &endptr); values_types[values_len] = LCC_TYPE_GAUGE; } diff --git a/src/collectdctl.pod b/src/collectdctl.pod index 65d4e051..21c0b500 100644 --- a/src/collectdctl.pod +++ b/src/collectdctl.pod @@ -117,10 +117,11 @@ limitation in the C library). A value list describes one data-set as handled by collectd. It is a colon (C<:>) separated list of the time and the values. Each value is either given as an integer if the data-type is a counter, or as a double if the data-type -is a gauge value. The number of values and the data-types have to match the -type specified in the identifier (see L for details). The time is -specified as epoch (i.Ee., standard UNIX time) or as a literal C -which will be interpreted as now. +is a gauge value. A literal C is interpreted as an undefined gauge value. +The number of values and the data-types have to match the type specified in +the identifier (see L for details). The time is specified as +epoch (i.Ee., standard UNIX time) or as a literal C which will be +interpreted as now. =head1 EXAMPLES