New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add additional F5 sensor support #4642
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
5352553
added recent F5 mibs ver 11.6
boudreau 0fad272
F5 temp discovery module done
boudreau c8d29a9
changed desc of sensors in DB
boudreau 975adf9
added fanspeed and Power states
boudreau 79388cf
Added other sensors states
boudreau 2651669
Update f5.inc.php
boudreau 61394b4
modified for CS Style and recommendation
boudreau 9d87695
Update defaults.inc.php
boudreau 4d80d8f
Update f5.inc.php
boudreau 86b74ca
Update f5.inc.php
boudreau a409ae2
missing '.' at start of the OIDs
boudreau 74380e3
Rename F5-EM-MIB.txt to F5-EM-MIB
boudreau 7ccb911
Rename F5-BIGIP-APM-MIB.txt to F5-BIGIP-APM-MIB
boudreau b42059d
Rename F5-BIGIP-WAM-MIB.txt to F5-BIGIP-WAM-MIB
boudreau 7dbfcf5
Rename F5-BIGIP-LOCAL-MIB.txt to F5-BIGIP-LOCAL-MIB
boudreau 9c3ff6a
Rename F5-BIGIP-COMMON-MIB.txt to F5-BIGIP-COMMON-MIB
boudreau d1711bf
Rename F5-BIGIP-GLOBAL-MIB.txt to F5-BIGIP-GLOBAL-MIB
boudreau e53faea
Rename F5-BIGIP-SYSTEM-MIB.txt to F5-BIGIP-SYSTEM-MIB
boudreau 144b222
changes requested
boudreau 7d254cd
Changes requested
boudreau 94d76b0
Merge branch 'master' of https://github.com/librenms/librenms into is…
boudreau 7741907
syntax error
boudreau 3630505
modified state f5
boudreau e380fca
Formatting updates
laf File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
if ($device['os'] == 'f5') { | ||
$oids = snmp_walk($device, 'sysChassisFanSpeed', '-OsqU', 'F5-BIGIP-SYSTEM-MIB'); | ||
|
||
if ($oids) { | ||
d_echo($oids."\n"); | ||
echo 'sysChassisFanSpeed '; | ||
|
||
$divisor = 1; | ||
$type = 'f5'; | ||
|
||
foreach (explode("\n", $oids) as $data) { | ||
$data = trim($data); | ||
if ($data) { | ||
list($oid, $descr) = explode(' ', $data, 2); | ||
$split_oid = explode('.', $oid); | ||
$index = $split_oid[(count($split_oid) - 1)]; | ||
$descr = 'Fan Speed ' . $index; | ||
$oid = '.1.3.6.1.4.1.3375.2.1.3.2.1.2.1.3.' . $index; | ||
$fanspeed = $oids[$index]['sysChassisFanSpeed'] / $divisor; | ||
if ($fanspeed > 0) { | ||
discover_sensor($valid['sensor'], 'fanspeed', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $fanspeed); | ||
} | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,210 @@ | ||
<?php | ||
//Check State of F5 power, Fanspeed, and failover status | ||
|
||
if ($device['os'] == 'f5') { | ||
// Power Status OID (Value : 0 Bad, 1 Good, 2 NotPresent) | ||
$temp = snmpwalk_cache_multi_oid($device, 'sysChassisPowerSupplyTable', array(), 'F5-BIGIP-SYSTEM-MIB'); | ||
|
||
if (is_array($temp)) { | ||
echo 'F5 power supply: '; | ||
//Create State Index | ||
$state_name = 'sysChassisPowerSupplyStatus'; | ||
$state_index_id = create_state_index($state_name); | ||
|
||
//Create State Translation | ||
if ($state_index_id) { | ||
$states = array( | ||
array($state_index_id,'Bad',0,0,2) , | ||
array($state_index_id,'Good',0,1,0) , | ||
array($state_index_id,'NotPresent',0,2,3), | ||
); | ||
foreach ($states as $value) { | ||
$insert = array( | ||
'state_index_id' => $value[0], | ||
'state_descr' => $value[1], | ||
'state_draw_graph' => $value[2], | ||
'state_value' => $value[3], // Value polled from device | ||
'state_generic_value' => $value[4], // Set value based on the Nagios standard 0=OK, 1=Warning, 2=Critical, 3=Unknown | ||
); | ||
dbInsert($insert, 'state_translations'); | ||
} | ||
} | ||
|
||
foreach ($temp as $index => $data) { | ||
$descr = "sysChassisPowerSupplyStatus.".$temp[$index]['sysChassisPowerSupplyIndex']; | ||
$current = $data['sysChassisPowerSupplyStatus']; | ||
$sensorType = 'f5'; | ||
$oid = '.1.3.6.1.4.1.3375.2.1.3.2.2.2.1.2.'.$index; | ||
discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, '1', '1', null, null, null, null, $current, 'snmp', $index); | ||
|
||
//Create Sensor To State Index | ||
create_sensor_to_state_index($device, $state_name, $index); | ||
} // End foreach (array_keys($temp) as $index) | ||
} // End if (is_array($temp)) | ||
|
||
// FailOver State | ||
/* From the MIB file: | ||
sysCmFailoverStatusId OBJECT-TYPE | ||
SYNTAX INTEGER { | ||
unknown(0), offline(1), forcedOffline(2), standby(3), active(4) | ||
} | ||
MAX-ACCESS read-only | ||
STATUS current | ||
DESCRIPTION | ||
"The failover status ID on the system. | ||
unknown - the failover status of the device is unknown; | ||
offline - the device is offline; | ||
forcedOffline - the device is forced offline; | ||
standby - the device is standby; | ||
active - the device is active." | ||
::= { sysCmFailoverStatus 1 } | ||
*/ | ||
|
||
$temp1 = snmpwalk_cache_multi_oid($device, 'sysCmFailoverStatus', array(), 'F5-BIGIP-SYSTEM-MIB'); | ||
|
||
if (is_array($temp1)) { | ||
echo 'F5 FailOver State: '; | ||
//Create State Index | ||
$state_name = 'sysCmFailoverStatusId'; | ||
$state_index_id = create_state_index($state_name); | ||
|
||
//Create State Translation | ||
if ($state_index_id) { | ||
$states = array( | ||
array($state_index_id,'Unknown',0,0,3), | ||
array($state_index_id,'OffLine',0,1,2), | ||
array($state_index_id,'ForcedOffline',0,2,2), | ||
array($state_index_id,'Standby',0,3,1), | ||
array($state_index_id,'Active',0,4,0), | ||
); | ||
foreach ($states as $value) { | ||
$insert = array( | ||
'state_index_id' => $value[0], | ||
'state_descr' => $value[1], | ||
'state_draw_graph' => $value[2], | ||
'state_value' => $value[3], // Value polled from device | ||
'state_generic_value' => $value[4], // Set value based on the Nagios standard 0=OK, 1=Warning, 2=Critical, 3=Unknown | ||
); | ||
dbInsert($insert, 'state_translations'); | ||
} | ||
} | ||
|
||
foreach (array_keys($temp1) as $index) { | ||
$descr = "sysCmFailoverStatusId.".$temp1[$index]['sysCmFailoverStatusId']; | ||
$current = $temp1[$index]['sysCmFailoverStatusId']; | ||
$sensorType = 'f5'; | ||
$oid = '.1.3.6.1.4.1.3375.2.1.14.3.1.'.$index; | ||
discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, '1', '1', null, null, null, null, $current, 'snmp', $index); | ||
|
||
//Create Sensor To State Index | ||
create_sensor_to_state_index($device, $state_name, $index); | ||
} // End foreach (array_keys($temp1) as $index) | ||
} // End if (is_array($temp1)) | ||
|
||
|
||
// Color State: | ||
/* | ||
sysCmFailoverStatusColor OBJECT-TYPE | ||
SYNTAX INTEGER { | ||
green(0), | ||
yellow(1), | ||
red(2), | ||
blue(3), | ||
gray(4), | ||
black(5) | ||
} | ||
MAX-ACCESS read-only | ||
STATUS current | ||
DESCRIPTION | ||
"The color of the failover status on the system. | ||
green - the system is functioning correctly; | ||
yellow - the system may be functioning suboptimally; | ||
red - the system requires attention to function correctly; | ||
blue - the system's status is unknown or incomplete; | ||
gray - the system is intentionally not functioning (offline); | ||
black - the system is not connected to any peers." | ||
::= { sysCmFailoverStatus 3 } | ||
|
||
*/ | ||
|
||
$temp1 = snmpwalk_cache_multi_oid($device, 'sysCmFailoverStatusColor', array(), 'F5-BIGIP-SYSTEM-MIB'); | ||
|
||
if (is_array($temp1)) { | ||
echo 'F5 FailOver State Color: '; | ||
//Create State Index | ||
$state_name = 'sysCmFailoverStatusColor'; | ||
$state_index_id = create_state_index($state_name); | ||
|
||
//Create State Translation | ||
if ($state_index_id) { | ||
$states = array( | ||
array($state_index_id,'Green: functioning correctly',0,0,0), | ||
array($state_index_id,'Yellow: functioning suboptimally',0,1,1), | ||
array($state_index_id,'Red: requires attention to function correctly',0,2,2), | ||
array($state_index_id,'Blue: status is unknown',0,3,3), | ||
array($state_index_id,'Gray: intentionally not functioning',0,4,0), | ||
array($state_index_id,'Black: not connected to any peers',0,5,2), | ||
); | ||
foreach ($states as $value) { | ||
$insert = array( | ||
'state_index_id' => $value[0], | ||
'state_descr' => $value[1], | ||
'state_draw_graph' => $value[2], | ||
'state_value' => $value[3], // Value polled from device | ||
'state_generic_value' => $value[4], // Set value based on the Nagios standard 0=OK, 1=Warning, 2=Critical, 3=Unknown | ||
); | ||
dbInsert($insert, 'state_translations'); | ||
} | ||
} | ||
|
||
foreach (array_keys($temp1) as $index) { | ||
$descr = "sysCmFailoverStatusColor.".$index; | ||
$current = $temp1[$index]['sysCmFailoverStatusColor']; | ||
$sensorType = 'f5'; | ||
$oid = '.1.3.6.1.4.1.3375.2.1.14.3.3.'.$index; | ||
discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, '1', '1', null, null, null, null, $current, 'snmp', $index); | ||
|
||
//Create Sensor To State Index | ||
create_sensor_to_state_index($device, $state_name, $index); | ||
} // End foreach (array_keys($temp1) as $index) | ||
} // End if (is_array($temp1)) | ||
|
||
$temp3 = snmpwalk_cache_multi_oid($device, 'sysChassisFanStatus', array(), 'F5-BIGIP-SYSTEM-MIB'); | ||
|
||
if (is_array($temp3)) { | ||
echo 'F5 FanSpeed State: '; | ||
//Create State Index | ||
$state_name = 'sysChassisFanStatus'; | ||
$state_index_id = create_state_index($state_name); | ||
|
||
//Create State Translation | ||
if ($state_index_id) { | ||
$states = array( | ||
array($state_index_id,'Bad',0,0,2), | ||
array($state_index_id,'Good',0,1,0), | ||
array($state_index_id,'NotPresent',0,2,3), | ||
); | ||
foreach ($states as $value) { | ||
$insert = array( | ||
'state_index_id' => $value[0], | ||
'state_descr' => $value[1], | ||
'state_draw_graph' => $value[2], | ||
'state_value' => $value[3], // Value polled from device | ||
'state_generic_value' => $value[4], // Set value based on the Nagios standard 0=OK, 1=Warning, 2=Critical, 3=Unknown | ||
); | ||
dbInsert($insert, 'state_translations'); | ||
} | ||
} | ||
|
||
foreach (array_keys($temp3) as $index) { | ||
$descr = "Fan Speed Status ".$index; | ||
$current = $temp3[$index]['sysChassisFanStatus']; | ||
$sensorType = 'f5'; | ||
$oid = '.1.3.6.1.4.1.3375.2.1.3.2.1.2.1.2.'.$index; | ||
discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, '1', '1', null, null, null, null, $current, 'snmp', $index); | ||
|
||
//Create Sensor To State Index | ||
create_sensor_to_state_index($device, $state_name, $index); | ||
} // End foreach (array_keys($temp3) as $index) | ||
} // End if (is_array($temp3)) | ||
} // End if ($device['os'] == 'f5') |
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
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
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
if ($device['os'] == 'f5') { | ||
$f5_chassis = array(); | ||
// Get the Chassis Temperature values | ||
//Pull the sysChassisTempTable table from the snmpwalk | ||
$f5_chassis = snmpwalk_cache_multi_oid($device, 'sysChassisTempTable', array(), 'F5-BIGIP-SYSTEM-MIB'); | ||
|
||
if (is_array($f5_chassis)) { | ||
echo "sysChassisTempTable: "; | ||
|
||
foreach (array_keys($f5_chassis) as $index) { | ||
$descr = "sysChassisTempTemperature.".$f5_chassis[$index]['sysChassisTempIndex']; | ||
$current = $f5_chassis[$index]['sysChassisTempTemperature']; | ||
$sensorType = 'f5'; | ||
$oid = '.1.3.6.1.4.1.3375.2.1.3.2.3.2.1.2.'.$index; | ||
|
||
discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, $sensorType, $descr, '1', '1', null, null, null, null, $current); | ||
} | ||
} | ||
|
||
// Get the CPU Temperature values | ||
$f5cpu = array(); | ||
$f5cpu = snmpwalk_cache_multi_oid($device, 'sysCpuSensorTemperature', array(), 'F5-BIGIP-SYSTEM-MIB'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems more appropriate to walk |
||
|
||
if (is_array($f5cpu)) { | ||
echo "sysCpuSensorTemperature: "; | ||
|
||
foreach (array_keys($f5cpu) as $index) { | ||
$slotnum = $f5cpu[$index]['sysCpuSensorSlot']; | ||
$cpuname = $f5cpu[$index]['sysCpuSensorName']; | ||
$descr = "Cpu Temperature slot".$index; | ||
$current = $f5cpu[$index]['sysCpuSensorTemperature']; | ||
$sensorType = 'f5'; | ||
$oid = '.1.3.6.1.4.1.3375.2.1.3.6.2.1.2.'.$index; | ||
|
||
discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, $sensorType, $descr, '1', '1', null, null, null, null, $current); | ||
} | ||
} | ||
}//end if |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we have this value already from the snmpwalk?