Skip to content

Commit 846f757

Browse files
authored
Misc fixes in legacy codebase (librenms#18251)
* Misc fixes in legacy codebase * Apply fixes from StyleCI * Implement agent sensor value assignment Add handling for agent sensors and log if no agent data is available. * Remove unused variable 'mib' if set * Apply fixes from StyleCI
1 parent 897b323 commit 846f757

23 files changed

+31
-27
lines changed

includes/discovery/junose-atm-vp.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
$port_id = dbFetchCell('SELECT `port_id` FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?', [$device['device_id'], $ifIndex]);
1818

1919
if (is_numeric($port_id) && is_numeric($vp_id)) {
20-
discover_juniAtmvp($valid_vp, $device['device_id'], $port_id, $vp_id, null);
20+
discover_juniAtmVp($valid_vp, $device['device_id'], $port_id, $vp_id, null);
2121
}
2222
} //end foreach
2323
} //end if

includes/discovery/sensors/count/fortigate.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121

2222
// Sensors for license status
23-
$licenseOids = SnmpQuery::hideMIB()->walk('FORTINET-FORTIGATE-MIB::fgSystemInfoAdvanced')->table(1);
23+
$licenseOids = SnmpQuery::hideMib()->walk('FORTINET-FORTIGATE-MIB::fgSystemInfoAdvanced')->table(1);
2424

2525
if (! empty($licenseOids)) {
2626
foreach ($licenseOids as $index => $entry) {

includes/discovery/sensors/current/ocnos.inc.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
use LibreNMS\OS;
4+
35
if (empty($os)) {
46
$os = OS::make($device);
57
}

includes/discovery/sensors/dbm/ocnos.inc.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
use LibreNMS\OS;
4+
35
if (empty($os)) {
46
$os = OS::make($device);
57
}

includes/discovery/sensors/percent/fortigate.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
* @author Rudy Broersma
1717
*/
1818

19-
$fgDhcpTables = SnmpQuery::hideMIB()->walk('FORTINET-FORTIGATE-MIB::fgDhcpTables')->table(0);
19+
$fgDhcpTables = SnmpQuery::hideMib()->walk('FORTINET-FORTIGATE-MIB::fgDhcpTables')->table(0);
2020

2121
if (! empty($fgDhcpTables['fgDhcpLeaseUsage'])) {
2222
foreach ($fgDhcpTables['fgDhcpLeaseUsage'] as $vdomID => $table) {
23-
$vdomName = SnmpQuery::enumStrings()->hideMIB()->get('FORTINET-FORTIGATE-MIB:fgVdEntName.' . $vdomID)->value();
23+
$vdomName = SnmpQuery::enumStrings()->hideMib()->get('FORTINET-FORTIGATE-MIB:fgVdEntName.' . $vdomID)->value();
2424

2525
foreach ($table as $index => $value) {
2626
$indexSplit = explode('.', $index);

includes/discovery/sensors/state/fortigate.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
$fgHaStatsIndex_num = '.1.3.6.1.4.1.12356.101.13.2.1.1.1';
3434

3535
// Fetch the cluster members
36-
$haStatsEntries = SnmpQuery::hideMIB()->walk('FORTINET-FORTIGATE-MIB::fgHaStatsIndex')->table(1);
36+
$haStatsEntries = SnmpQuery::hideMib()->walk('FORTINET-FORTIGATE-MIB::fgHaStatsIndex')->table(1);
3737

3838
// As of July 2024:
3939
// FortiNet considers a single-node cluster a valid setup. Therefor, if a cluster node is removed or

includes/discovery/sensors/state/hp.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
if (! empty($temp)) {
5555
//Create State Index
5656
$state_name = $oid;
57-
$state_index_id = create_state_index($state_name, $states);
57+
create_state_index($state_name, $states);
5858

5959
foreach ($temp as $index => $entry) {
6060
$drive_bay = snmp_get($device, "cpqDaPhyDrvBay.$index", '-Ovqn', 'CPQIDA-MIB', 'hp');

includes/discovery/sensors/state/loop-telecom.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
'ctrl' => 100,
8484
];
8585

86-
$test = create_state_index($state_name, $states);
86+
create_state_index($state_name, $states);
8787
$num_oid = '.1.3.6.1.4.1.823.34441.1.9.1.9.';
8888
$num_index = 1; //Create a seperate index since $index = the slotname and not the number.
8989
foreach ($oids as $index => $entry) {

includes/discovery/sensors/temperature/ocnos.inc.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
use LibreNMS\OS;
4+
35
if (empty($os)) {
46
$os = OS::make($device);
57
}

includes/discovery/sensors/voltage/ocnos.inc.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
use LibreNMS\OS;
4+
35
if (empty($os)) {
46
$os = OS::make($device);
57
}

0 commit comments

Comments
 (0)