From 17b97abbd22684881a66cdec8d6ffe8a7c4494f4 Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Tue, 19 Oct 2021 15:40:47 -0500 Subject: [PATCH] Keep stats for snmptranslate (#13379) --- includes/snmp.inc.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/snmp.inc.php b/includes/snmp.inc.php index 20972fd33e..d483a22109 100644 --- a/includes/snmp.inc.php +++ b/includes/snmp.inc.php @@ -787,6 +787,7 @@ function snmp_gen_auth(&$device, $cmd = [], $strIndexing = null) */ function snmp_translate($oid, $mib = 'ALL', $mibdir = null, $options = null, $device = null) { + $measure = Measurement::start('snmptranslate'); $cmd = [Config::get('snmptranslate', 'snmptranslate'), '-M', mibdir($mibdir, $device), '-m', $mib]; if (oid_is_numeric($oid)) { @@ -801,7 +802,11 @@ function snmp_translate($oid, $mib = 'ALL', $mibdir = null, $options = null, $de $cmd = array_merge($cmd, (array) $options); $cmd[] = $oid; - return trim(external_exec($cmd)); + $result = trim(external_exec($cmd)); + + $measure->manager()->recordSnmp($measure->end()); + + return $result; } /**