Hi,
I am using the “Display Name” option in Grafana to graph network switches that in poll via snmp in Telegraf 1.22.0 than then get posted to influx DB 2.2.
the collection stanza looks as follows for the switch.
[[inputs.snmp]]
agents = [“udp://myswitch.example.com:161”]
agent_host_tag=“cisco-rack-b”
version = 2
community = “some comm…”
path = ["/usr/local/share/snmp/mibs"]
[[inputs.snmp.table]]
oid = “IF-MIB::ifXTable”
name = “interface”
inherit_tags = [“source”]
[[inputs.snmp.table.field]]
oid = “IF-MIB::ifName”
name = “ifName”
is_tag = true
[[inputs.snmp.table.field]]
oid = “IF-MIB::ifAlias”
name = “ifAlias”
is_tag = true
However, the field lables are a rather long convoluted series of lables. I instead want to make a mix of the port name (ifName) and the port description (ifAlias). They display exactly how I wanted, however if there happens to be no description value, rather than just have blank, the variable name pops up.
e.g if I have 2 ports “0/1” and “0/2” and the descriptions
0/1 Router uplink
0/2
(where 0/2 is blank)
I use
${__field.labels.ifName} ${__field.labels.ifAlias}
In the Display Names section
The display ends up being
“0/1 Router uplink”
“0/2 ${__field.labels.ifAlias}”
ie. If ifAlias does not have a value it shows the var name. How can I force granfa to display a null string or some default value like “NA” ?