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>
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)
#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
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;
}