-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Changes from 5 commits
5352553
0fad272
c8d29a9
975adf9
79388cf
2651669
61394b4
9d87695
4d80d8f
86b74ca
a409ae2
74380e3
7ccb911
b42059d
7dbfcf5
9c3ff6a
d1711bf
e53faea
144b222
7d254cd
94d76b0
7741907
3630505
e380fca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
if ($device['os'] == 'f5') { | ||
$oids = snmp_walk($device, 'sysChassisFanSpeed', '-OsqnU', 'F5-BIGIP-SYSTEM-MIB'); | ||
d_echo($oids."\n"); | ||
|
||
if ($oids !== false) { | ||
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 = (snmp_get($device, $oid, '-Oqv') / $divisor); | ||
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. Haven't we got fanspeed from the sysChassisFanSpeed walk? 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. Not sure, I'm following? |
||
if ($fanspeed > 0) { | ||
discover_sensor($valid['sensor'], 'fanspeed', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $fanspeed); | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,226 @@ | ||
<?php | ||
|
||
if ($device['os'] == 'f5') { | ||
echo 'F5 power supply: '; | ||
// 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)) { | ||
|
||
//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 (array_keys($temp) as $index) { | ||
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. You can do foreach($temp as $index => $data) here. |
||
$descr = "sysChassisPowerSupplyStatus.".$temp[$index]['sysChassisPowerSupplyIndex']; | ||
$current = $temp[$index]['sysChassisPowerSupplyStatus']; | ||
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. and $current = $data['sysChassisPowerSupplyStatus']; here |
||
$sensorType = 'f5'; | ||
$oid = '1.3.6.1.4.1.3375.2.1.3.2.2.2.1.2.'.$index; | ||
$oid_status = snmp_get($device, $oid, '-Oqv'); | ||
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. Remove this line, it is unused and causes many extra snmp_get() calls |
||
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 } | ||
*/ | ||
echo 'F5 FailOver State: '; | ||
$temp1 = snmpwalk_cache_multi_oid($device, 'sysCmFailoverStatus' , array(), 'F5-BIGIP-SYSTEM-MIB'); | ||
|
||
if (is_array($temp1)) { | ||
|
||
//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; | ||
$oid_status = snmp_get($device, $oid, '-Oqv'); | ||
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 } | ||
|
||
*/ | ||
echo 'F5 FailOver State Color: '; | ||
$temp1 = snmpwalk_cache_multi_oid($device, 'sysCmFailoverStatusColor' , array(), 'F5-BIGIP-SYSTEM-MIB'); | ||
|
||
if (is_array($temp1)) { | ||
|
||
//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; | ||
$oid_status = snmp_get($device, $oid, '-Oqev'); | ||
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)) | ||
|
||
echo 'F5 FanSpeed State: '; | ||
$temp3 = snmpwalk_cache_multi_oid($device, 'sysChassisFanStatus' , array(), 'F5-BIGIP-SYSTEM-MIB'); | ||
|
||
if (is_array($temp3)) { | ||
|
||
//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; | ||
$oid_status = snmp_get($device, $oid, '-Oqv'); | ||
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') |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
if ($device['os'] == 'f5') { | ||
$f5 = null; | ||
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. should be |
||
// Get the Chassis Temperature values | ||
//Pull the sysChassisTempTable table from the snmpwalk | ||
$f5 = snmpwalk_cache_oid($device, 'sysChassisTempTable', array(), 'F5-BIGIP-SYSTEM-MIB'); | ||
|
||
if (is_array($f5)) { | ||
echo "sysChassisTempTable "; | ||
|
||
foreach (array_keys($f5) as $index) { | ||
$descr = "sysChassisTempTemperature.".$f5[$index]['sysChassisTempIndex']; | ||
$current = $f5[$index]['sysChassisTempTemperature']; | ||
$sensorType = 'f5'; | ||
$oid = '.1.3.6.1.4.1.3375.2.1.3.2.3.2.1.2.'.$index; | ||
$low_limit = null; | ||
$low_warn_limit = null; | ||
$high_warn_limit = null; | ||
$high_limit = null; | ||
|
||
discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, $sensorType, $descr, '1', '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current); | ||
} | ||
} | ||
|
||
// Get the CPU Temperature values | ||
$f5cpu = null; | ||
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. Should be |
||
// $f5cpu = snmpwalk_cache_oid($device, 'sysCpuSensorTemperature', array(), 'F5-BIGIP-SYSTEM-MIB'); | ||
$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) { | ||
$cpuname_oid = "1.3.6.1.4.1.3375.2.1.3.6.2.1.4.$index"; | ||
$slot_oid = "1.3.6.1.4.1.3375.2.1.3.6.2.1.5.$index"; | ||
$slotnum = snmp_get($device, $slot_oid, '-Oqv', 'F5-BIGIP-SYSTEM-MIB'); | ||
$cpuname = snmp_get($device, $cpuname_oid, '-Oqv', 'F5-BIGIP-SYSTEM-MIB'); | ||
|
||
$descr = "Cpu Temperature slot".$slotnum."/".$cpuname; | ||
$current = $f5cpu[$index]['sysCpuSensorTemperature']; | ||
$sensorType = 'f5'; | ||
$oid = '1.3.6.1.4.1.3375.2.1.3.6.2.1.2.'.$index; | ||
$low_limit = null; | ||
$low_warn_limit = null; | ||
$high_warn_limit = null; | ||
$high_limit = null; | ||
|
||
discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, $sensorType, $descr, '1', '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current); | ||
} | ||
} | ||
|
||
}//end if |
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.
This should start with a . - .1.3.6