]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/collectd/0022-openvpn-Change-data-type-from-COUNTER-to-DERIVE.patch
collectd: Fix typo in "derive"
[ipfire-2.x.git] / src / patches / collectd / 0022-openvpn-Change-data-type-from-COUNTER-to-DERIVE.patch
CommitLineData
2056dd30
AM
1From 3458d610e8b99eb88c2f06ad576b4f46e0169877 Mon Sep 17 00:00:00 2001
2From: Michael Tremer <michael.tremer@ipfire.org>
3Date: Fri, 26 Sep 2014 12:02:27 +0200
4Subject: [PATCH 22/22] openvpn: Change data type from COUNTER to DERIVE
5
6COUNTER is not what we want here, so we will use DERIVE.
7---
8 src/openvpn.c | 26 +++++++++++++-------------
9 src/types.db | 2 ++
10 2 files changed, 15 insertions(+), 13 deletions(-)
11
12diff --git a/src/openvpn.c b/src/openvpn.c
13index 2db3677..d446e99 100644
14--- a/src/openvpn.c
15+++ b/src/openvpn.c
16@@ -116,13 +116,13 @@ static void numusers_submit (char *pinst, char *tinst, gauge_t value)
17 } /* void numusers_submit */
18
19 /* dispatches stats about traffic (TCP or UDP) generated by the tunnel per single endpoint */
20-static void iostats_submit (char *pinst, char *tinst, counter_t rx, counter_t tx)
21+static void iostats_submit (char *pinst, char *tinst, derive_t rx, derive_t tx)
22 {
23 value_t values[2];
24 value_list_t vl = VALUE_LIST_INIT;
25
26- values[0].counter = rx;
27- values[1].counter = tx;
28+ values[0].derive = rx;
29+ values[1].derive = tx;
30
31 /* NOTE ON THE NEW NAMING SCHEMA:
32 * using plugin_instance to identify each vpn config (and
33@@ -137,7 +137,7 @@ static void iostats_submit (char *pinst, char *tinst, counter_t rx, counter_t tx
34 if (pinst != NULL)
35 sstrncpy (vl.plugin_instance, pinst,
36 sizeof (vl.plugin_instance));
37- sstrncpy (vl.type, "if_octets", sizeof (vl.type));
38+ sstrncpy (vl.type, "if_octets_derive", sizeof (vl.type));
39 if (tinst != NULL)
40 sstrncpy (vl.type_instance, tinst, sizeof (vl.type_instance));
41
42@@ -146,13 +146,13 @@ static void iostats_submit (char *pinst, char *tinst, counter_t rx, counter_t tx
43
44 /* dispatches stats about data compression shown when in single mode */
45 static void compression_submit (char *pinst, char *tinst,
46- counter_t uncompressed, counter_t compressed)
47+ derive_t uncompressed, derive_t compressed)
48 {
49 value_t values[2];
50 value_list_t vl = VALUE_LIST_INIT;
51
52- values[0].counter = uncompressed;
53- values[1].counter = compressed;
54+ values[0].derive = uncompressed;
55+ values[1].derive = compressed;
56
57 vl.values = values;
58 vl.values_len = STATIC_ARRAY_SIZE (values);
59@@ -161,7 +161,7 @@ static void compression_submit (char *pinst, char *tinst,
60 if (pinst != NULL)
61 sstrncpy (vl.plugin_instance, pinst,
62 sizeof (vl.plugin_instance));
63- sstrncpy (vl.type, "compression", sizeof (vl.type));
979c8463 64+ sstrncpy (vl.type, "compression_derive", sizeof (vl.type));
2056dd30
AM
65 if (tinst != NULL)
66 sstrncpy (vl.type_instance, tinst, sizeof (vl.type_instance));
67
68@@ -175,11 +175,11 @@ static int single_read (char *name, FILE *fh)
69 const int max_fields = STATIC_ARRAY_SIZE (fields);
70 int fields_num, read = 0;
71
72- counter_t link_rx, link_tx;
73- counter_t tun_rx, tun_tx;
74- counter_t pre_compress, post_compress;
75- counter_t pre_decompress, post_decompress;
76- counter_t overhead_rx, overhead_tx;
77+ derive_t link_rx, link_tx;
78+ derive_t tun_rx, tun_tx;
79+ derive_t pre_compress, post_compress;
80+ derive_t pre_decompress, post_decompress;
81+ derive_t overhead_rx, overhead_tx;
82
83 link_rx = 0;
84 link_tx = 0;
85diff --git a/src/types.db b/src/types.db
86index ad54240..03ec75b 100644
87--- a/src/types.db
88+++ b/src/types.db
89@@ -18,6 +18,7 @@ cache_result value:COUNTER:0:4294967295
90 cache_size value:GAUGE:0:4294967295
91 charge value:GAUGE:0:U
92 compression uncompressed:COUNTER:0:U, compressed:COUNTER:0:U
93+compression_derive uncompressed:DERIVE:0:U, compressed:DERIVE:0:U
94 compression_ratio value:GAUGE:0:2
95 connections value:COUNTER:0:U
96 conntrack entropy:GAUGE:0:4294967295
97@@ -74,6 +75,7 @@ if_dropped rx:COUNTER:0:4294967295, tx:COUNTER:0:4294967295
98 if_errors rx:COUNTER:0:4294967295, tx:COUNTER:0:4294967295
99 if_multicast value:COUNTER:0:4294967295
100 if_octets rx:COUNTER:0:4294967295, tx:COUNTER:0:4294967295
101+if_octets_derive rx:DERIVE:0:U, tx:DERIVE:0:U
102 if_packets rx:COUNTER:0:4294967295, tx:COUNTER:0:4294967295
103 if_rx_errors value:COUNTER:0:4294967295
104 if_tx_errors value:COUNTER:0:4294967295
105--
1061.9.3
107