Closed lchabert closed 4 years ago
@sbyx Can you take a look into this one?
The mdt input plugin does not do any type conversion for non-key fields but passes fields along in the types they arrive in from protobuf. So my first assumption would be that the device sends the data as string already.
When i send data over HTTP/JSON transport, and start a netcat to print received data, decimal data is sent as a string by the switch .
On RFC, decimal64 fields is in reality two fields: The Decimal64 message contains an integer value of the digits and an unsigned integer precision indicating the number of digits following the decimal point. The following lib explains protobufs messages: https://github.com/openconfig/ygot/blob/master/docs/yang-to-protobuf-transformations-spec.md
How can i display the "type" sent by the switch using protobuf ? If it's send as a string, i will open a case on cisco TAC, but i need to be sure before open it.
Thanks,
I tried the same on a NX-OS in my lab, and it confirmed my suspicion. The device is actually filling out the "stringValue"-field in the GRPC message to the collector. Refer to https://github.com/CiscoDevNet/nx-telemetry-proto/blob/master/telemetry_bis.proto#L64
{
"nodeIdStr": "switch-rack8",
"subscriptionIdStr": "1",
"encodingPath": "Cisco-NX-OS-device:System/procsys-items/sysload-items",
"collectionId": "37950",
"msgTimestamp": "1580897921133",
"dataGpbkv": [
{
"fields": [
{
"name": "keys",
"fields": [
{
"name": "Cisco-NX-OS-device:System/procsys-items/sysload-items",
"stringValue": "Cisco-NX-OS-device:System/procsys-items/sysload-items"
}
]
},
{
"name": "content",
"fields": [
{
"fields": [
{
"name": "System",
"fields": [
{
"fields": [
{
"name": "xmlns",
"stringValue": "http://cisco.com/ns/yang/cisco-nx-os-device"
},
{
"name": "procsys-items",
"fields": [
{
"fields": [
{
"name": "sysload-items",
"fields": [
{
"fields": [
{
"name": "loadAverage15m",
"stringValue": "0.600000"
},
{
"name": "loadAverage1m",
"stringValue": "0.750000"
},
{
"name": "loadAverage5m",
"stringValue": "0.610000"
},
{
"name": "loadAverage5sec",
"stringValue": "13.000000"
},
{
"name": "name",
"stringValue": "sysload"
},
{
"name": "runProc",
"uint64Value": "1"
},
{
"name": "totalProc",
"uint64Value": "303"
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
So from your point of view, it's a cisco bug ? If Cisco send metrics data as string, any TSDB could not store telemetry values.
Do you have any method to make it work with telegraf ?
Well my point is at least the data comes in string format directly from the device. It is nothing in Telegraf doing that. You could give a try with the converter processor to cast the data fields to a different type before outputting: https://github.com/influxdata/telegraf/tree/master/plugins/processors/converter
Hi telegraf folks,
In order to make some charts with cisco NX-OS telemetry system, i want to collect logs with telegraf. Unfortunately, decimal64 yang type is returned as a string, and stored as a string into influxdb database (so queries can't be executed)... Please find configuration and technical data below.
Relevant telegraf.conf:
Relevant nexus 9k config
System info:
Telegraf version: Telegraf 1.13.1 (git: HEAD 0c175724) OS: debian buster/sid
Output log
I have exported the data to a json log file:
And execute a infuxdb query
As we can see, the load average is stored as a string, so no queries can be executed on it.
I have opened the NX-OS device yang file, and found the following types for the sysload_items container:
Do you have any hints to make it works ? Why the decimal64 fields is not casted into float fields, in order to be stored/queried by any TSDB ?
Thanks in advance,