Keep stats for snmptranslate (#13379)

This commit is contained in:
Tony Murray
2021-10-19 15:40:47 -05:00
committed by GitHub
parent 5edbd29f69
commit 17b97abbd2

View File

@@ -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;
}
/**