From 71ddf90efc69ccf8fef77a9a2ac5e4acf35a69bf Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Mon, 9 Aug 2010 22:04:54 +0200 Subject: [PATCH] =?utf8?q?collectdctl:=20Added=20support=20for=20=E2=80=98?= =?utf8?q?U=E2=80=99=20(undef)=20values=20in=20=E2=80=98putval=E2=80=99.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/collectdctl.c | 9 ++++++++- src/collectdctl.pod | 9 +++++---- 2 files changed, 13 insertions(+), 5 deletions(-) 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 -- 2.30.2