influxdata / influxdata/telegraf
[inputs.gnmi] Support Arista EOS origin=cli
- Dominant language
- Go
- Stars
- 17.8k
- Forks
- 5.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 161
Description
### Use Case
Arista EOS supports origin=cli where the path becomes the command you'd like to execute. I'd like to subscribe to the cli origin and execute commands at a sample interval to generate metrics. See command output below.
```bash
[admin@eos-switch-1 ~]$ gnmi -username admin -password admin -addr localhost:50000 get origin=cli "/show ip route vrf all summary"
/show ip route vrf all summary:
{
"aggregate": 0,
"attached": 3,
"bgpCounts": {
"bgpExternal": 65,
"bgpInternal": 1,
"bgpLocal": 0,
"bgpTotal": 66
},
"connected": 3,
"dynamicPolicy": 0,
"gribi": 0,
"internal": 7,
"isis": 0,
"isisCounts": {
"isisLevel1": 0,
"isisLevel2": 0,
"isisTotal": 0
},
"maskLen": {
"31": 3,
"32": 74,
"8": 2
},
"totalRoutes": 79,
"vcs": 0
}
```
### Expected behavior
Ignore path validation when origin is set to cli. Subscribe to the path as provided. If it fails, it fails. The name tag should be the path/command executed.
### Actual behavior
Telegraf currently returns the following error:
```bash
[telegraf] Error running agent: starting input inputs.gnmi: invalid string path /show ip route vrf all summary: invalid node name: "show ip route vrf all summary"
```
Which is I believe is raise from here: https://github.com/google/gnxi/blob/master/utils/xpath/xpath.go#L214
### Additional info
_No response_
Contributor guide
Research direction
Start at inputs.gnmi and trace its path validation to the google/gnxi xpath/xpath.go validation cited at line 214. Verify that origin=cli subscribes to the supplied command path without validation, preserves failures, and uses the executed path as the name tag.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100