mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 10:28:13 +00:00
refactor - Use ->table(2) rather than ::pivotTable function. (#15796)
This commit is contained in:
parent
0611f81b14
commit
391a918e2e
@ -137,18 +137,6 @@ class Powerconnect extends OS implements ProcessorDiscovery, ProcessorPolling, N
|
|||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function pivotTable(array $table): array
|
|
||||||
{
|
|
||||||
$res = [];
|
|
||||||
foreach ($table as $column => $data) {
|
|
||||||
foreach ($data as $index => $value) {
|
|
||||||
$res[$index][$column] = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function pollNac()
|
public function pollNac()
|
||||||
{
|
{
|
||||||
$nac = new Collection();
|
$nac = new Collection();
|
||||||
@ -160,15 +148,13 @@ class Powerconnect extends OS implements ProcessorDiscovery, ProcessorPolling, N
|
|||||||
return $nac;
|
return $nac;
|
||||||
}
|
}
|
||||||
|
|
||||||
$table = SnmpQuery::mibs(['DNOS-AUTHENTICATION-MANAGER-MIB'])->mibDir('dell')->hideMib()->enumStrings()->walk('agentAuthMgrClientStatusTable')->table();
|
$table = SnmpQuery::mibs(['DNOS-AUTHENTICATION-MANAGER-MIB'])->mibDir('dell')->hideMib()->enumStrings()->walk('agentAuthMgrClientStatusTable')->table(2);
|
||||||
if (count($table) === 0) {
|
if (count($table) === 0) {
|
||||||
d_echo('Client status table is empty, not processing NAC entries.');
|
d_echo('Client status table is empty, not processing NAC entries.');
|
||||||
|
|
||||||
return $nac;
|
return $nac;
|
||||||
}
|
}
|
||||||
|
|
||||||
$table = self::pivotTable($table);
|
|
||||||
|
|
||||||
$hostmode = SnmpQuery::mibs(['DNOS-AUTHENTICATION-MANAGER-MIB'])->mibDir('dell')->hideMib()->enumStrings()->walk('agentAuthMgrPortHostMode')->valuesByIndex();
|
$hostmode = SnmpQuery::mibs(['DNOS-AUTHENTICATION-MANAGER-MIB'])->mibDir('dell')->hideMib()->enumStrings()->walk('agentAuthMgrPortHostMode')->valuesByIndex();
|
||||||
foreach ($table as &$row) {
|
foreach ($table as &$row) {
|
||||||
if ($row['agentAuthMgrClientAuthState'] === 'success') {
|
if ($row['agentAuthMgrClientAuthState'] === 'success') {
|
||||||
|
Loading…
Reference in New Issue
Block a user