From 624e3e76338016eaaae4aec10afaa1ec2042a566 Mon Sep 17 00:00:00 2001 From: Antoine Van Elstraete Date: Mon, 26 Jan 2026 19:44:14 +0100 Subject: [PATCH] Fix SNMP latency to exclude Slim instance creation overhead Move time measurement to only capture the actual SNMP GET request, excluding the Slim() context manager initialization. Co-Authored-By: Claude Opus 4.5 --- checkers/snmp.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/checkers/snmp.py b/checkers/snmp.py index 8a76a62..8f668d1 100644 --- a/checkers/snmp.py +++ b/checkers/snmp.py @@ -66,7 +66,6 @@ class SnmpChecker(BaseChecker): temperature_oid = self.config.get("temperature_oid") timeout_val = self.config.get("timeout", 5) - start = time.time() try: with Slim() as slim: # Construit la liste des OIDs à interroger @@ -74,6 +73,7 @@ class SnmpChecker(BaseChecker): if temperature_oid: oids.append(ObjectType(ObjectIdentity(temperature_oid))) + start = time.time() error_indication, error_status, error_index, var_binds = await slim.get( community, host, @@ -82,8 +82,7 @@ class SnmpChecker(BaseChecker): timeout=timeout_val, retries=1 ) - - response_time = (time.time() - start) * 1000 # ms + response_time = (time.time() - start) * 1000 # ms if error_indication: return CheckResult(