summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d57d393)
raw | patch | inline | side by side (parent: d57d393)
author | Florian Forster <octo@collectd.org> | |
Sun, 30 Oct 2016 20:40:04 +0000 (21:40 +0100) | ||
committer | Florian Forster <octo@collectd.org> | |
Sun, 30 Oct 2016 20:40:04 +0000 (21:40 +0100) |
src/collectd.conf.pod | patch | blob | history | |
src/daemon/utils_match.c | patch | blob | history | |
src/daemon/utils_match.h | patch | blob | history | |
src/tail.c | patch | blob | history |
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 761351e4b9634eb2be1ffba8da478baba622a1aa..dff0e3706732b12967a88d0bd2c680758cb1919e 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
Use the last number found.
+=item B<GaugePersist>
+
+Use the last number found. The number if not reset at the end of an interval.
+It is continously reported until another number if matched. This is intended
+for cases in which only state changes are reported, for example a thermometer
+that only reports the temperature when it changes.
+
=item B<CounterSet>
=item B<DeriveSet>
index 914b6e278c746c1dd04e44a603894377f3991c0c..31ee6df2935b5bfe936f46c0b9795062dae0a226 100644 (file)
--- a/src/daemon/utils_match.c
+++ b/src/daemon/utils_match.c
void match_value_reset (cu_match_value_t *mv)
{
- if (mv == NULL)
+ if ((mv == NULL)
+ || ((mv->ds_type & UTILS_MATCH_DS_TYPE_GAUGE) == 0)
+ || ((mv->ds_type & UTILS_MATCH_CF_GAUGE_PERSIST) != 0))
return;
- if (mv->ds_type & UTILS_MATCH_DS_TYPE_GAUGE)
- {
- mv->value.gauge = NAN;
- mv->values_num = 0;
- }
+ mv->value.gauge = NAN;
+ mv->values_num = 0;
} /* }}} void match_value_reset */
void match_destroy (cu_match_t *obj)
index a1d10020e0472ffba04a66944eb038b4eb1417e6..d43ae3b340a578e2be647c53afde1152fa2fb7ce 100644 (file)
--- a/src/daemon/utils_match.h
+++ b/src/daemon/utils_match.h
#define UTILS_MATCH_CF_GAUGE_LAST 0x08
#define UTILS_MATCH_CF_GAUGE_INC 0x10
#define UTILS_MATCH_CF_GAUGE_ADD 0x20
+#define UTILS_MATCH_CF_GAUGE_PERSIST 0x40
#define UTILS_MATCH_CF_COUNTER_SET 0x01
#define UTILS_MATCH_CF_COUNTER_ADD 0x02
diff --git a/src/tail.c b/src/tail.c
index 74fdf84aa35233110bed7a2315d677cb4830fbf3..0ac8be7c87049be84415d33e71e0af8bed1ec482 100644 (file)
--- a/src/tail.c
+++ b/src/tail.c
cm->flags |= UTILS_MATCH_CF_GAUGE_INC;
else if (strcasecmp ("GaugeAdd", ci->values[0].value.string) == 0)
cm->flags |= UTILS_MATCH_CF_GAUGE_ADD;
+ else if (strcasecmp ("GaugePersist", ci->values[0].value.string) == 0)
+ cm->flags |= UTILS_MATCH_CF_GAUGE_PERSIST;
else
cm->flags = 0;
}