mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Keep stats for snmptranslate (#13379)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user