summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 92c1972)
raw | patch | inline | side by side (parent: 92c1972)
author | Stefan Rinkes <stefan.rinkes@gmail.com> | |
Thu, 28 Apr 2011 17:43:09 +0000 (19:43 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Thu, 13 Sep 2012 11:10:04 +0000 (13:10 +0200) |
src/pf.c | patch | blob | history | |
src/types.db | patch | blob | history |
diff --git a/src/pf.c b/src/pf.c
index bbac3019f8f128a27a6cde6db54fc9bde7100f79..93fb500204424ccdcb788ca9831e17cead7cc97b 100644 (file)
--- a/src/pf.c
+++ b/src/pf.c
static int pf_init(void);
static int pf_read(void);
-static void submit_counter(const char *, const char *, counter_t);
+static void submit_counter(const char *, const char *, counter_t, int);
char *pf_device = "/dev/pf";
close(pfdev);
for (i = 0; i < PFRES_MAX; i++)
- submit_counter("pf_counters", cnames[i], status.counters[i]);
+ submit_counter("pf_counters", cnames[i], status.counters[i], 0);
for (i = 0; i < LCNT_MAX; i++)
- submit_counter("pf_limits", lnames[i], status.lcounters[i]);
+ submit_counter("pf_limits", lnames[i], status.lcounters[i], 0);
for (i = 0; i < FCNT_MAX; i++)
- submit_counter("pf_state", names[i], status.fcounters[i]);
+ submit_counter("pf_state", names[i], status.fcounters[i], 0);
for (i = 0; i < SCNT_MAX; i++)
- submit_counter("pf_source", names[i], status.scounters[i]);
+ submit_counter("pf_source", names[i], status.scounters[i], 0);
+
+ submit_counter("pf_states", "current", status.states, 1);
return (0);
}
void
-submit_counter(const char *type, const char *inst, counter_t val)
+submit_counter(const char *type, const char *inst, counter_t val, int usegauge)
{
#ifndef TEST
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
- values[0].counter = val;
+ if (usegauge)
+ values[0].gauge = val;
+ else
+ values[0].counter = val;
vl.values = values;
vl.values_len = 1;
diff --git a/src/types.db b/src/types.db
index b2845f665539f0a2425782362fead3b97f977f04..744ea18514e8a12a5d9fcaf38263ed9968a07c67 100644 (file)
--- a/src/types.db
+++ b/src/types.db
pf_counters value:COUNTER:0:U
pf_limits value:COUNTER:0:U
pf_state value:COUNTER:0:U
+pf_states value:GAUGE:0:U
pf_source value:COUNTER:0:U
states_cur value:GAUGE:0:U
states_tot value:COUNTER:0:U