From 1e704df29f3c4f43ea82da701f967876fdc39b58 Mon Sep 17 00:00:00 2001 From: dropthemic <20729448+dropthemic@users.noreply.github.com> Date: Mon, 8 Jan 2024 05:47:43 -0800 Subject: [PATCH] fix: use oid_index if oid is empty (#52) Fixed oid showing name instead of oid numerical values --- check_synology.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check_synology.py b/check_synology.py index a444885..3c8c093 100755 --- a/check_synology.py +++ b/check_synology.py @@ -138,7 +138,7 @@ def exitCode(): output = '' perfdata = '|' for item in snmpwalk('1.3.6.1.4.1.6574.2.1.1.2'): - i = item.oid.split('.')[-1] + i = item.oid_index or item.oid.split('.')[-1] disk_name = item.value disk_status_nr = snmpget('1.3.6.1.4.1.6574.2.1.1.5.' + str(i)) disk_temp = snmpget('1.3.6.1.4.1.6574.2.1.1.6.' + str(i)) @@ -190,7 +190,7 @@ def exitCode(): output = '' perfdata = '|' for item in snmpwalk('1.3.6.1.2.1.25.2.3.1.3'): - i = item.oid.split('.')[-1] + i = item.oid_index or item.oid.split('.')[-1] storage_name = item.value if re.match("/volume(?!.+/@docker.*)", storage_name): allocation_units = snmpget('1.3.6.1.2.1.25.2.3.1.4.' + str(i))