Skip to content

Commit 0f120c6

Browse files
authored
Cisco Telegraf fix (#16071)
1 parent 3c17ec2 commit 0f120c6

2 files changed

Lines changed: 211 additions & 2 deletions

File tree

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
From 279c3f7c7bde9ef7871fdc70799b03bc5cc9fc88 Mon Sep 17 00:00:00 2001
2+
From: Sindhu Karri <lakarri@microsoft.com>
3+
Date: Thu, 19 Feb 2026 16:35:01 +0000
4+
Subject: [PATCH] Handle DME events for cisco NXOS telemetry data
5+
Upstream Reference Link: https://github.com/influxdata/telegraf/pull/18254
6+
7+
---
8+
.../cisco_telemetry_mdt.go | 8 +-
9+
.../cisco_telemetry_mdt_test.go | 162 ++++++++++++++++++
10+
2 files changed, 168 insertions(+), 2 deletions(-)
11+
12+
diff --git a/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go b/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go
13+
index f52533fcb..660b1e2fc 100644
14+
--- a/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go
15+
+++ b/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go
16+
@@ -695,8 +695,12 @@ func (c *CiscoTelemetryMDT) parseContentField(grouper *metric.SeriesGrouper, fie
17+
nxChildren = subfield
18+
} else {
19+
sub := subfield.Fields
20+
- if len(sub) > 0 && sub[0] != nil && sub[0].Fields[0].Name == "subscriptionId" && len(sub[0].Fields) >= 2 {
21+
- nxAttributes = sub[0].Fields[1].Fields[0].Fields[0].Fields[0].Fields[0].Fields[0]
22+
+ if len(sub) > 0 && sub[0] != nil && len(sub[0].Fields) >= 2 {
23+
+ if sub[0].Fields[0].Name == "subscriptionId" {
24+
+ nxAttributes = sub[0].Fields[1].Fields[0].Fields[0].Fields[0].Fields[0].Fields[0]
25+
+ } else if sub[0].Fields[1].Name == "subscriptionId" {
26+
+ nxAttributes = sub[0].Fields[0].Fields[0].Fields[0].Fields[0].Fields[0].Fields[0]
27+
+ }
28+
}
29+
}
30+
//if nxAttributes == NULL then class based query.
31+
diff --git a/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt_test.go b/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt_test.go
32+
index 841172f18..dc6db69e9 100644
33+
--- a/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt_test.go
34+
+++ b/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt_test.go
35+
@@ -1240,3 +1240,165 @@ func TestSourceFieldRewrite(t *testing.T) {
36+
fields := map[string]interface{}{"bool": false}
37+
acc.AssertContainsTaggedFields(t, "alias", fields, tags)
38+
}
39+
+
40+
+func TestHandleNXDMEEventListWithDn(t *testing.T) {
41+
+ c := &CiscoTelemetryMDT{
42+
+ Log: testutil.Logger{},
43+
+ Transport: "dummy",
44+
+ Aliases: map[string]string{"dme": "sys/intf/phys-[eth1/11]"},
45+
+ }
46+
+ acc := &testutil.Accumulator{}
47+
+ err := c.Start(acc)
48+
+ // error is expected since we are passing in dummy transport
49+
+ require.Error(t, err)
50+
+
51+
+ tel := &telemetry.Telemetry{
52+
+ MsgTimestamp: 1769120146205,
53+
+ EncodingPath: "EVENT-LIST",
54+
+ NodeId: &telemetry.Telemetry_NodeIdStr{NodeIdStr: "NX-PGBL-GX2"},
55+
+ Subscription: &telemetry.Telemetry_SubscriptionIdStr{SubscriptionIdStr: "1"},
56+
+ DataGpbkv: []*telemetry.TelemetryField{
57+
+ {
58+
+ Fields: []*telemetry.TelemetryField{
59+
+ {
60+
+ Name: "keys",
61+
+ Fields: []*telemetry.TelemetryField{
62+
+ {
63+
+ Name: "EVENT-LIST",
64+
+ ValueByType: &telemetry.TelemetryField_StringValue{StringValue: "EVENT-LIST"},
65+
+ },
66+
+ },
67+
+ },
68+
+ {
69+
+ Name: "content",
70+
+ Fields: []*telemetry.TelemetryField{
71+
+ {
72+
+ Fields: []*telemetry.TelemetryField{
73+
+ {
74+
+ Name: "children",
75+
+ Fields: []*telemetry.TelemetryField{
76+
+ {
77+
+ Fields: []*telemetry.TelemetryField{
78+
+ {
79+
+ Name: "imdata",
80+
+ Fields: []*telemetry.TelemetryField{
81+
+ {
82+
+ Fields: []*telemetry.TelemetryField{
83+
+ {
84+
+ Name: "ethpmPhysIf",
85+
+ Fields: []*telemetry.TelemetryField{
86+
+ {
87+
+ Fields: []*telemetry.TelemetryField{
88+
+ {
89+
+ Name: "attributes",
90+
+ Fields: []*telemetry.TelemetryField{
91+
+ {
92+
+ Fields: []*telemetry.TelemetryField{
93+
+ {
94+
+ Name: "childAction",
95+
+ ValueByType: &telemetry.TelemetryField_StringValue{
96+
+ StringValue: "",
97+
+ },
98+
+ },
99+
+ {
100+
+ Name: "dn",
101+
+ ValueByType: &telemetry.TelemetryField_StringValue{
102+
+ StringValue: "sys/intf/phys-[eth1/11]/phys",
103+
+ },
104+
+ },
105+
+ {
106+
+ Name: "lastLinkStChg",
107+
+ ValueByType: &telemetry.TelemetryField_StringValue{
108+
+ StringValue: "2026-01-22T14:15:46.199-08:00",
109+
+ },
110+
+ },
111+
+ {
112+
+ Name: "operBitset",
113+
+ ValueByType: &telemetry.TelemetryField_StringValue{
114+
+ StringValue: "3-4",
115+
+ },
116+
+ },
117+
+ {
118+
+ Name: "operSt",
119+
+ ValueByType: &telemetry.TelemetryField_StringValue{
120+
+ StringValue: "up",
121+
+ },
122+
+ },
123+
+ {
124+
+ Name: "operStQual",
125+
+ ValueByType: &telemetry.TelemetryField_StringValue{
126+
+ StringValue: "none",
127+
+ },
128+
+ },
129+
+ {
130+
+ Name: "resetCtr",
131+
+ ValueByType: &telemetry.TelemetryField_Sint64Value{
132+
+ Sint64Value: 2,
133+
+ },
134+
+ },
135+
+ {
136+
+ Name: "rn",
137+
+ ValueByType: &telemetry.TelemetryField_StringValue{
138+
+ StringValue: "",
139+
+ },
140+
+ },
141+
+ {
142+
+ Name: "status",
143+
+ ValueByType: &telemetry.TelemetryField_StringValue{
144+
+ StringValue: "modified",
145+
+ },
146+
+ },
147+
+ },
148+
+ },
149+
+ },
150+
+ },
151+
+ },
152+
+ },
153+
+ },
154+
+ },
155+
+ },
156+
+ },
157+
+ },
158+
+ },
159+
+ {
160+
+ Name: "subscriptionId",
161+
+ ValueByType: &telemetry.TelemetryField_Uint64Value{Uint64Value: 18379759394883829764},
162+
+ },
163+
+ },
164+
+ },
165+
+ },
166+
+ },
167+
+ },
168+
+ },
169+
+ },
170+
+ },
171+
+ },
172+
+ },
173+
+ },
174+
+ }
175+
+ data, err := proto.Marshal(tel)
176+
+ require.NoError(t, err)
177+
+
178+
+ c.handleTelemetry(data)
179+
+ require.Empty(t, acc.Errors)
180+
+
181+
+ // Verify that the metric was created with the correct measurement name and fields
182+
+ require.Len(t, acc.Metrics, 1, "Expected exactly 1 metric")
183+
+
184+
+ tags := map[string]string{
185+
+ "path": "EVENT-LIST",
186+
+ "EVENT_LIST": "EVENT-LIST",
187+
+ "source": "NX-PGBL-GX2",
188+
+ "subscription": "1",
189+
+ }
190+
+ fields := map[string]interface{}{
191+
+ "dn": "sys/intf/phys-[eth1/11]/phys",
192+
+ "lastLinkStChg": "2026-01-22T14:15:46.199-08:00",
193+
+ "operBitset": "3-4",
194+
+ "operSt": "up",
195+
+ "operStQual": "none",
196+
+ "resetCtr": int64(2),
197+
+ "status": "modified",
198+
+ }
199+
+ acc.AssertContainsTaggedFields(t, "EVENT-LIST", fields, tags)
200+
+}
201+
--
202+
2.45.4
203+

SPECS/telegraf/telegraf.spec

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Summary: agent for collecting, processing, aggregating, and writing metrics.
22
Name: telegraf
33
Version: 1.31.0
4-
Release: 15%{?dist}
4+
Release: 16%{?dist}
55
License: MIT
66
Vendor: Microsoft Corporation
77
Distribution: Azure Linux
@@ -31,7 +31,9 @@ Patch16: CVE-2025-47911.patch
3131
Patch17: CVE-2025-58190.patch
3232
Patch18: CVE-2026-2303.patch
3333
Patch19: CVE-2026-26014.patch
34-
34+
# Patch added based on customer request https://microsoft.visualstudio.com/OS/_workitems/edit/61041768
35+
# Fix was introduced 1.37.2, this patch can be removed once we update to 1.37.2 or later
36+
Patch20: cisco_telegraf_bug61041768.patch
3537

3638
BuildRequires: golang
3739
BuildRequires: systemd-devel
@@ -96,6 +98,10 @@ fi
9698
%dir %{_sysconfdir}/%{name}/telegraf.d
9799

98100
%changelog
101+
* Fri Feb 27 2026 Sindhu Karri <lakarri@microsoft.com> - 1.31.0-16
102+
- Added patch to fix the issue reported in https://microsoft.visualstudio.com/OS/_workitems/edit/61041768
103+
Fix in telegraf to support cisco telemetry plugin that collects telemetry data from cisco NXOS switches.
104+
99105
* Fri Feb 27 2026 Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> - 1.31.0-15
100106
- Patch for CVE-2026-26014, CVE-2026-2303, CVE-2025-58190, CVE-2025-47911
101107

0 commit comments

Comments
 (0)