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 <noreply@anthropic.com>
This commit is contained in:
@@ -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,7 +82,6 @@ class SnmpChecker(BaseChecker):
|
||||
timeout=timeout_val,
|
||||
retries=1
|
||||
)
|
||||
|
||||
response_time = (time.time() - start) * 1000 # ms
|
||||
|
||||
if error_indication:
|
||||
|
||||
Reference in New Issue
Block a user