forked from librenms/librenms
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Cisco ASA HA state sensors - Issue ID librenms#16544 (librenms#16770
) * Cisco ASA fix for librenms#16544 ASA Fix for librenms#16544 Previous version had an index translation to an integer, but the $temp table doesn't contain integer keys. Removed. Additionally, the discover_sensor had an erroneous space in the array column key * Update asa.json * Update asa.inc.php * Fix Cisco ASA state sensor discovery * Update Cisco ASA Test Data * Update asa.json * Remove lookup table. use SNMP flags instead * Migrate to SnmpQuery
- Loading branch information
1 parent
df44d1c
commit f783721
Showing
1 changed file
with
22 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,29 @@ | ||
<?php | ||
/* | ||
* LibreNMS | ||
* asa.inc.php | ||
* | ||
* LibreNMS state sensor discovery module for Cisco ASA appliances | ||
* | ||
* Copyright (c) 2016 Søren Friis Rosiak <[email protected]> | ||
* 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 <[email protected]> | ||
* @author Søren Friis Rosiak <[email protected]> | ||
* @copyright 2024 CTNET BV | ||
* @author Rudy Broersma <[email protected]> | ||
*/ | ||
|
||
$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); | ||
} | ||
} | ||
} |