summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bcce4d5)
raw | patch | inline | side by side (parent: bcce4d5)
author | Andre Ferraz <andre.ferraz@locaweb.com.br> | |
Thu, 24 Jul 2014 16:02:32 +0000 (13:02 -0300) | ||
committer | Andre Ferraz <andre.ferraz@locaweb.com.br> | |
Thu, 24 Jul 2014 16:02:32 +0000 (13:02 -0300) |
src/tail.c | patch | blob | history | |
src/utils_match.c | patch | blob | history | |
src/utils_match.h | patch | blob | history |
diff --git a/src/tail.c b/src/tail.c
index 20f2a9b47cdf380c4ff81100de2ae33cd3f72de6..b2d5226857714a8ed40f0c0836d506a4bcb17068 100644 (file)
--- a/src/tail.c
+++ b/src/tail.c
cm->flags |= UTILS_MATCH_CF_GAUGE_MAX;
else if (strcasecmp ("GaugeLast", ci->values[0].value.string) == 0)
cm->flags |= UTILS_MATCH_CF_GAUGE_LAST;
+ else if (strcasecmp ("GaugeInc", ci->values[0].value.string) == 0)
+ 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
cm->flags = 0;
}
diff --git a/src/utils_match.c b/src/utils_match.c
index 062bcfe37fd152851eb11eb03464daabe0b53ae2..44eaece201f6234a57bb3c449927c9c6b46ecf32 100644 (file)
--- a/src/utils_match.c
+++ b/src/utils_match.c
gauge_t value;
char *endptr = NULL;
+ if (data->ds_type & UTILS_MATCH_CF_GAUGE_INC)
+ {
+ data->value.gauge = isnan (data->value.gauge) ? 1 : data->value.gauge + 1;
+ data->values_num++;
+ return(0);
+ }
+
if (matches_num < 2)
return (-1);
if (data->value.gauge < value)
data->value.gauge = value;
}
+ else if (data->ds_type & UTILS_MATCH_CF_GAUGE_ADD)
+ {
+ data->value.gauge += value;
+ }
else
{
ERROR ("utils_match: default_callback: obj->ds_type is invalid!");
diff --git a/src/utils_match.h b/src/utils_match.h
index 36abe30ca427ee48861a792e0563cd327fa953b1..d32178a43800aff05c6236569f21acf11d88090a 100644 (file)
--- a/src/utils_match.h
+++ b/src/utils_match.h
#define UTILS_MATCH_CF_GAUGE_MIN 0x02
#define UTILS_MATCH_CF_GAUGE_MAX 0x04
#define UTILS_MATCH_CF_GAUGE_LAST 0x08
+#define UTILS_MATCH_CF_GAUGE_INC 0x09
+#define UTILS_MATCH_CF_GAUGE_ADD 0x10
#define UTILS_MATCH_CF_COUNTER_SET 0x01
#define UTILS_MATCH_CF_COUNTER_ADD 0x02