Open gavmckee80 opened 3 years ago
Hi @gavmckee80! The value of elem
is a list of each of the elements between the slashes in the xpath-style string that you would use with gNMIc. For /interfaces/interface/state/counters
it would look something like:
{
"request": {
"default": {
"subscribe": {
"prefix": {
},
"subscription": [
{
"path": {
"elem": [
{
"name": "interfaces"
},
{
"name": "interface"
},
{
"name": "state"
},
{
"name": "counters"
}
]
}
}
]
}
}
},
"target": {
"<host>": {
"addresses": [
"<host>:6030"
],
"credentials": {
"username": "xxxxxx",
"password": "xxxxxx"
},
"request": "default",
"meta": {
"NoTLSVerify": "yes"
}
}
}
}
You're also able to use xpath-style paths with the "simple" Target Loader in gnmi-gateway. For example your simple config file would look something like:
connection:
my-router:
addresses:
- my-router.test.example.net:9339
credentials:
username: myusername
password: mypassword
request: default
meta:
NoTLSVerify: yes
request:
default:
paths:
- /interfaces/interface/state/counters
@colinmcintosh , thanks for coming back to me - this is a great project and saves me writing a bunch of code :D , which is even better.
I'll probably load from Netbox at some point , I'm just trying to get all the components to work , Clustering etc.
Another question on paths first.
I have two seperate requestss defined , one for Arista (eos) and one for Palo Alto (panos).
The second path in eos is to get the CPU stats
Again testing
gnmic -a arista-sw1:6030 -u eos -p password --insecure subscribe --path "components/component/cpu" --stream-mode on_change
{
"source": "arista-sw1:6030",
"subscription-name": "default-1629846458",
"timestamp": 1629847029458359290,
"time": "2021-08-24T23:17:09.45835929Z",
"updates": [
{
"Path": "components/component[name=CPU0]/cpu/utilization/state/instant",
"values": {
"components/component/cpu/utilization/state/instant": 6
}
}
]
}
........
When I spin up the GNMI GW I don't seem to get the CPU related output.
{
"request": {
"eos": {
"subscribe": {
"prefix": {
},
"subscription": [
{
"path": {
"elem": [
{
"name": "interfaces"
},
{
"name": "interface"
},
{
"name": "state"
},
{
"name": "counters"
}
]
}
},
{
"path": {
"elem": [
{
"name": "components"
},
{
"name": "component"
},
{
"name": "cpu"
}
]
}
}
]
}
},
"panos": {
"subscribe": {
"prefix": {
},
"subscription": [
{
"path": {
"elem": [
{
"name": "interfaces"
},
{
"name": "interface"
},
{
"name": "state"
},
{
"name": "counters"
}
]
}
}
]
}
}
},
"target": {
"arista-sw1": {
"addresses": [
"arista-sw1:6030"
],
"credentials": {
"username": "eos",
"password": "password"
},
"request": "eos",
"meta": {
"NoTLSVerify": "yes"
}
}
},
"panos-fw1": {
"addresses": [
"panos-fw1:9339"
],
"credentials": {
"username": "panos",
"password": "password"
},
"request": "panos",
"meta": {
"NoTLSVerify": "yes"
}
}
}
Is there a way to set the origin for a request also ? Something like .... gnmi -addr arista-sw1:6030 -username admin \ get origin=eos_native '/Kernel/proc/cpu/utilization/total'
I'm using gnmi-gateway (details below)
I'm trying to figure out how to translate an Openconfig path into my configuration.
If I use gnmic tool as follows :
In my gnmi-gateway configuration file
When using that same path I get
Can you advise how I use more specific paths ?