From fd20382b1dcc913560ef0a8a49dd60829282e98c Mon Sep 17 00:00:00 2001 From: Frederic Van Espen Date: Mon, 31 Aug 2020 11:03:57 +0200 Subject: [PATCH] fall back to the value in case it's not listed in enum_values Signed-off-by: Frederic Van Espen --- collector.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/collector.go b/collector.go index 931bcbb4..8b705aa5 100644 --- a/collector.go +++ b/collector.go @@ -671,7 +671,12 @@ func indexOidsAsString(indexOids []int, typ string, fixedSize int, implied bool, return fmt.Sprintf("%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X:%02X%02X", parts...), subOid, indexOids case "EnumAsInfo": subOid, indexOids := splitOid(indexOids, 1) - return enumValues[subOid[0]], subOid, indexOids + value, ok := enumValues[subOid[0]] + if ok { + return value, subOid, indexOids + } else { + return fmt.Sprintf("%d", subOid[0]), subOid, indexOids + } default: panic(fmt.Sprintf("Unknown index type %s", typ)) return "", nil, nil