summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1ab0aef)
raw | patch | inline | side by side (parent: 1ab0aef)
author | Florian Forster <octo@huhu.verplant.org> | |
Wed, 1 Jul 2009 13:14:27 +0000 (15:14 +0200) | ||
committer | Florian Forster <octo@noris.net> | |
Wed, 1 Jul 2009 13:42:38 +0000 (15:42 +0200) |
src/gmond.c | patch | blob | history |
diff --git a/src/gmond.c b/src/gmond.c
index aeb36c184623adce9fcf5fd06e3311779961f1bf..50659034465cfd522b4dece6f5d4a76af3fa7ed9 100644 (file)
--- a/src/gmond.c
+++ b/src/gmond.c
se->vl.values[ds_index].counter += value.counter;
else if (ds_type == DS_TYPE_GAUGE)
se->vl.values[ds_index].gauge = value.gauge;
+ else if (ds_type == DS_TYPE_DERIVE)
+ se->vl.values[ds_index].DERIVE += value.derive;
+ else if (ds_type == DS_TYPE_ABSOLUTE)
+ se->vl.values[ds_index].ABSOLUTE = value.absolute;
+
se->flags |= (0x01 << ds_index);
/* Check if all values have been set and submit if so. */
value_t value_counter;
value_t value_gauge;
+ value_t value_derive;
/* Fill in `host', `name', `value_counter', and `value_gauge' according to
* the value type, or return with an error. */
name = msg_uint.metric_id.name;
value_counter.counter = (counter_t) msg_uint.ui;
value_gauge.gauge = (gauge_t) msg_uint.ui;
+ value_derive.derive = (derive_t) msg_uint.ui;
break;
}
if ((endptr == msg_string.str) || (errno != 0))
value_gauge.gauge = NAN;
+ endptr = NULL;
+ errno = 0;
+ value_derive.derive = (derive_t) strtoll (msg_string.str,
+ &endptr, /* base = */ 0);
+ if ((endptr == msg_string.str) || (errno != 0))
+ value_derive.derive = 0;
+
break;
}
name = msg_float.metric_id.name;
value_counter.counter = (counter_t) msg_float.f;
value_gauge.gauge = (gauge_t) msg_float.f;
+ value_derive.derive = (derive_t) msg_float.f;
break;
}
name = msg_double.metric_id.name;
value_counter.counter = (counter_t) msg_double.d;
value_gauge.gauge = (gauge_t) msg_double.d;
+ value_derive.derive = (derive_t) msg_double.d;
break;
}
default:
map = metric_lookup (name);
if (map != NULL)
+ {
+ value_t val_copy;
+
+ val_copy = value_counter;
+ if (map->ds_type == DS_TYPE_GAUGE)
+ val_copy = value_gauge;
+ else if (map->ds_type == DS_TYPE_DERIVE)
+ val_copy = value_derive;
+
return (staging_entry_update (host, name,
map->type, map->type_instance,
map->ds_index, map->ds_type,
- (map->ds_type == DS_TYPE_COUNTER) ? value_counter : value_gauge));
+ val_copy));
+ }
DEBUG ("gmond plugin: Cannot find a translation for %s.", name);
return (-1);