summaryrefslogtreecommitdiffstats
path: root/telemetry
diff options
context:
space:
mode:
authorOlivier Roques <oroques+fdio@cisco.com>2020-11-03 10:43:15 +0000
committerOlivier Roques <oroques+fdio@cisco.com>2020-11-03 10:43:15 +0000
commit2583ea64cc1c1f9e39d64e8d7b4e6e65dc7b7c97 (patch)
tree35f098121106d8c1407adb90fdbcc638e141ed69 /telemetry
parent76fe994ebedfe58e75771fedfadfd0ea92dffe5d (diff)
[HICN-562] Ignore ghost interfaces in VPP ollectd plugin
Sometimes there are interfaces listed by VPP statistics API that cannot be read from. This results in segfaults. This patch makes the VPP collectd plugin ignore them. Signed-off-by: Olivier Roques <oroques+fdio@cisco.com> Change-Id: I3b626b5bf553dc045c9fe46828889c47ea122020
Diffstat (limited to 'telemetry')
-rw-r--r--telemetry/vpp-collectd/vpp/vpp.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/telemetry/vpp-collectd/vpp/vpp.c b/telemetry/vpp-collectd/vpp/vpp.c
index 36a8da86e..ba838a050 100644
--- a/telemetry/vpp-collectd/vpp/vpp.c
+++ b/telemetry/vpp-collectd/vpp/vpp.c
@@ -302,9 +302,7 @@ static int vpp_read(void) {
for (int k = 0; k < vec_len(res); k++) {
if (res[k].type == STAT_DIR_TYPE_NAME_VECTOR) {
for (int i = 0; i < vec_len(res[k].name_vector); i++) {
- if (res[k].name_vector[i]) {
- vec_add1(interfaces, (char *)res[k].name_vector[i]);
- }
+ vec_add1(interfaces, (char *)res[k].name_vector[i]);
}
break;
}
@@ -320,13 +318,18 @@ static int vpp_read(void) {
case STAT_DIR_TYPE_COUNTER_VECTOR_SIMPLE:
for (int k = 0; k < vec_len(res[i].simple_counter_vec); k++) {
for (int j = 0; j < vec_len(res[i].simple_counter_vec[k]); j++) {
- value_t values[1] = {
- (value_t){.derive = res[i].simple_counter_vec[k][j]}};
+ if (!interfaces[j]) {
+ continue;
+ }
if (get_data_set(res[i].name, &data_set)) {
continue;
}
+ value_t values[1] = {
+ (value_t){.derive = res[i].simple_counter_vec[k][j]}
+ };
+
err = submit(interfaces[j], data_set.type, values, 1, &timestamp);
if (err)
@@ -338,15 +341,19 @@ static int vpp_read(void) {
case STAT_DIR_TYPE_COUNTER_VECTOR_COMBINED:
for (int k = 0; k < vec_len(res[i].combined_counter_vec); k++) {
for (int j = 0; j < vec_len(res[i].combined_counter_vec[k]); j++) {
- value_t values[2] = {
- (value_t){.derive = res[i].combined_counter_vec[k][j].packets},
- (value_t){.derive = res[i].combined_counter_vec[k][j].bytes},
- };
+ if (!interfaces[j]) {
+ continue;
+ }
if (get_data_set(res[i].name, &data_set)) {
continue;
}
+ value_t values[2] = {
+ (value_t){.derive = res[i].combined_counter_vec[k][j].packets},
+ (value_t){.derive = res[i].combined_counter_vec[k][j].bytes},
+ };
+
err = submit(interfaces[j], data_set.type, values, 2, &timestamp);
if (err)