influxdata / influxdata/telegraf

inputs.cisco_telemetry_mdt: 'embedded_tags' generating spurious messages

Open
#17,004 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
17.8k
Forks
5.8k
Avg merge
1d 20h
Merged PRs (30d)
161

Description

### Relevant telegraf.conf

```toml
[[inputs.cisco_telemetry_mdt]]
transport = 'grpc'
service_address = ':57000'
max_msg_size = 100000000
embedded_tags = [
'ietf-interfaces:interfaces-state/interface/ietf-diffserv-target:diffserv-target-entry/diffserv-target-classifier-statistics/meter-statistics/meter-id'
]

[[outputs.file]]
files = ['/tmp/metrics.log']
data_format = 'json'
json_timestamp_units = '1s'
```

### Logs from Telegraf

```text
-
```

### System info

Telegraf 1.34.3, RockyLinux 9

### Docker

_No response_

### Steps to reproduce

1. Set up a MDT subscription in a Cisco Catalyst device:
```
telemetry ietf subscription 100
encoding encode-kvgpb
filter xpath /if:interfaces-state/interface/target:diffserv-target-entry/diffserv-target-classifier-statistics
source-address 10.0.0.15
source-vrf clab-mgmt
stream yang-push
update-policy periodic 500
no receiver ip address 192.168.100.11 57000 protocol grpc-tcp
receiver ip address 192.168.100.20 57000 protocol grpc-tcp
```

2. Configure some example policies:
```
policy-map INPUT_3Mb
class class-default
police cir 3000000 bc 62500
conform-action transmit
exceed-action drop
policy-map OUTPUT_1Mb
class class-default
shape average 1000000 8000 8000
interface GigabitEthernet2
service-policy output OUTPUT_1Mb
interface GigabitEthernet3
service-policy input INPUT_3Mb
```

### Expected behavior

Receive a couple of MDT metrics like these. Please note `meter_statistics/meter_id` tag in the second metric.

```
{
"fields": {
"classifier_entry_statistics/classified_bytes": 21649700,
"classifier_entry_statistics/classified_pkts": 14530,
"classifier_entry_statistics/classified_rate": 509,
"queuing_statistics/drop_bytes": 10760780,
"queuing_statistics/drop_pkts": 7222,
"queuing_statistics/output_bytes": 10888920,
"queuing_statistics/output_pkts": 7308,
"queuing_statistics/queue_size_bytes": 0,
"queuing_statistics/queue_size_pkts": 64,
"queuing_statistics/wred_stats/early_drop_bytes": 0,
"queuing_statistics/wred_stats/early_drop_pkts": 0
},
"name": "ietf-interfaces:interfaces-state/interface/ietf-diffserv-target:diffserv-target-entry/diffserv-target-classifier-statistics",
"tags": {
"classifier_entry_name": "class-default",
"direction": "outbound",
"name": "GigabitEthernet2",
"parent_path": "OUTPUT_1Mb class-default",
"path": "ietf-interfaces:interfaces-state/interface/ietf-diffserv-target:diffserv-target-entry/diffserv-target-classifier-statistics",
"policy_name": "OUTPUT_1Mb",
"source": "switch",
"subscription": "100"
},
"timestamp": 1727266737
}

{
"fields": {
"classifier_entry_statistics/classified_bytes": 111006574,
"classifier_entry_statistics/classified_pkts": 74503,
"classifier_entry_statistics/classified_rate": 2603,
"meter_statistics/meter_failed_bytes": 0,
"meter_statistics/meter_failed_pkts": 0,
"meter_statistics/meter_succeed_bytes": 21622964,
"meter_statistics/meter_succeed_pkts": 14514,
"queuing_statistics/drop_bytes": 0,
"queuing_statistics/drop_pkts": 0,
"queuing_statistics/output_bytes": 0,
"queuing_statistics/output_pkts": 0,
"queuing_statistics/queue_size_bytes": 0,
"queuing_statistics/queue_size_pkts": 0,
"queuing_statistics/wred_stats/early_drop_bytes": 0,
"queuing_statistics/wred_stats/early_drop_pkts": 0
},
"name": "ietf-interfaces:interfaces-state/interface/ietf-diffserv-target:diffserv-target-entry/diffserv-target-classifier-statistics",
"tags": {
"classifier_entry_name": "class-default",
"direction": "inbound",
"meter_statistics/meter_id": "0",
"name": "GigabitEthernet3",
"parent_path": "INPUT_3Mb class-default",
"path": "ietf-interfaces:interfaces-state/interface/ietf-diffserv-target:diffserv-target-entry/diffserv-target-classifier-statistics",
"policy_name": "INPUT_3Mb",
"source": "switch",
"subscription": "100"
},
"timestamp": 1727266737
}
```

### Actual behavior

The expected metrics are received, but also an additional dummy one for each policy containing a meter id (i.e, the field used for `embedded_tags`). In this example, just one additional dummy metric:

```
{
"fields": {
"classifier_entry_statistics/classified_bytes": 111006574,
"classifier_entry_statistics/classified_pkts": 74503,
"classifier_entry_statistics/classified_rate": 2603,
},
"name": "ietf-interfaces:interfaces-state/interface/ietf-diffserv-target:diffserv-target-entry/diffserv-target-classifier-statistics",
"tags": {
"classifier_entry_name": "class-default",
"direction": "inbound",
"name": "GigabitEthernet3",
"parent_path": "INPUT_3Mb class-default",
"path": "ietf-interfaces:interfaces-state/interface/ietf-diffserv-target:diffserv-target-entry/diffserv-target-classifier-statistics",
"policy_name": "INPUT_3Mb",
"source": "switch",
"subscription": "100"
},
"timestamp": 1727266737
}
```

### Additional info

If `embedded_tags` is not used, the expected number of messages is received. It looks like some kind of bug in the Telegraf MDT plugin when handling the `embedded_tags` option.

This is the Yang model used:

```
$ pyang -f tree ietf-diffserv-target.yang
module: ietf-diffserv-target

augment /if:interfaces/if:interface:
+--rw diffserv-target-entry* [direction policy-name]
+--rw direction identityref
+--rw policy-name string
augment /if:interfaces-state/if:interface:
+--ro diffserv-target-entry* [direction policy-name]
+--ro direction identityref
+--ro policy-name string
+--ro diffserv-target-classifier-statistics* [classifier-entry-name parent-path]
+--ro classifier-entry-name string
+--ro parent-path string
+--ro classifier-entry-statistics
| +--ro classified-pkts? uint64
| +--ro classified-bytes? uint64
| +--ro classified-rate? uint64
+--ro meter-statistics* [meter-id]
| +--ro meter-id uint16
| +--ro meter-succeed-pkts? uint64
| +--ro meter-succeed-bytes? uint64
| +--ro meter-failed-pkts? uint64
| +--ro meter-failed-bytes? uint64
+--ro queuing-statistics
+--ro output-pkts? uint64
+--ro output-bytes? uint64
+--ro queue-size-pkts? uint64
+--ro queue-size-bytes? uint64
+--ro drop-pkts? uint64
+--ro drop-bytes? uint64
+--ro wred-stats
+--ro early-drop-pkts? uint64
+--ro early-drop-bytes? uint64
```

Contributor guide

Open the contributing guide

Research direction

Start by locating the inputs.cisco_telemetry_mdt plugin and its embedded_tags handling. Reproduce the issue with the supplied telegraf.conf and Cisco MDT subscription, then compare emitted metrics with and without embedded_tags. Done means the expected metrics remain present without an additional dummy metric for policies containing the embedded tag.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.