diff --git a/includes/discovery/sensors/state/asa.inc.php b/includes/discovery/sensors/state/asa.inc.php index 4b7811f18e66..752377f18da7 100644 --- a/includes/discovery/sensors/state/asa.inc.php +++ b/includes/discovery/sensors/state/asa.inc.php @@ -1,21 +1,29 @@ * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. Please see LICENSE.txt at the top level of * the source code distribution for details. + * + * @link https://www.librenms.org + * + * @copyright 2016 Søren Friis Rosiak + * @author Søren Friis Rosiak + * @copyright 2024 CTNET BV + * @author Rudy Broersma */ -$temp = snmpwalk_cache_multi_oid($device, 'cfwHardwareStatusTable', [], 'CISCO-FIREWALL-MIB'); $cur_oid = '.1.3.6.1.4.1.9.9.147.1.2.1.1.1.3.'; +$temp = SnmpQuery::cache()->walk('CISCO-FIREWALL-MIB::cfwHardwareStatusTable')->table(1); if (is_array($temp)) { //Create State Index - if (strstr($temp['netInterface']['cfwHardwareStatusDetail'], 'not Configured') == false) { + if (strstr($temp['netInterface']['CISCO-FIREWALL-MIB::cfwHardwareStatusDetail'], 'not Configured') == false) { $state_name = 'cfwHardwareStatus'; $states = [ ['value' => 1, 'generic' => 2, 'graph' => 0, 'descr' => 'other'], @@ -32,19 +40,23 @@ create_state_index($state_name, $states); foreach ($temp as $index => $entry) { - $descr = ucwords(trim(preg_replace('/\s*\([^\s)]*\)/', '', $temp[$index]['cfwHardwareInformation']))); + $descr = ucwords(trim(preg_replace('/\s*\([^\s)]*\)/', '', $temp[$index]['CISCO-FIREWALL-MIB::cfwHardwareInformation']))); + if ($index == 'netInterface') { - $index = 4; + $oid_index = 4; } elseif ($index == 'primaryUnit') { - $index = 6; + $oid_index = 6; } elseif ($index == 'secondaryUnit') { - $index = 7; + $oid_index = 7; } + + $sensor_value = $temp[$index]['CISCO-FIREWALL-MIB::cfwHardwareStatusValue']; + //Discover Sensors - discover_sensor(null, 'state', $device, $cur_oid . $index, $index, $state_name, $descr, 1, 1, null, null, null, null, $temp[$index][' cfwHardwareStatusValue'], 'snmp', $index); + discover_sensor(null, 'state', $device, $cur_oid . $oid_index, $oid_index, $state_name, $descr, 1, 1, null, null, null, null, $sensor_value, 'snmp', $oid_index); //Create Sensor To State Index - create_sensor_to_state_index($device, $state_name, $index); + create_sensor_to_state_index($device, $state_name, $oid_index); } } }