Skip to content
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 24 commits into from Oct 13, 2016
Merged
Show file tree
Hide file tree
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 Sep 26, 2016
0fad272
F5 temp discovery module done
boudreau Sep 26, 2016
c8d29a9
changed desc of sensors in DB
boudreau Sep 26, 2016
975adf9
added fanspeed and Power states
boudreau Sep 27, 2016
79388cf
Added other sensors states
boudreau Sep 27, 2016
2651669
Update f5.inc.php
boudreau Sep 28, 2016
61394b4
modified for CS Style and recommendation
boudreau Sep 28, 2016
9d87695
Update defaults.inc.php
boudreau Sep 28, 2016
4d80d8f
Update f5.inc.php
boudreau Sep 29, 2016
86b74ca
Update f5.inc.php
boudreau Sep 29, 2016
a409ae2
missing '.' at start of the OIDs
boudreau Sep 29, 2016
74380e3
Rename F5-EM-MIB.txt to F5-EM-MIB
boudreau Oct 11, 2016
7ccb911
Rename F5-BIGIP-APM-MIB.txt to F5-BIGIP-APM-MIB
boudreau Oct 11, 2016
b42059d
Rename F5-BIGIP-WAM-MIB.txt to F5-BIGIP-WAM-MIB
boudreau Oct 11, 2016
7dbfcf5
Rename F5-BIGIP-LOCAL-MIB.txt to F5-BIGIP-LOCAL-MIB
boudreau Oct 11, 2016
9c3ff6a
Rename F5-BIGIP-COMMON-MIB.txt to F5-BIGIP-COMMON-MIB
boudreau Oct 11, 2016
d1711bf
Rename F5-BIGIP-GLOBAL-MIB.txt to F5-BIGIP-GLOBAL-MIB
boudreau Oct 11, 2016
e53faea
Rename F5-BIGIP-SYSTEM-MIB.txt to F5-BIGIP-SYSTEM-MIB
boudreau Oct 11, 2016
144b222
changes requested
boudreau Oct 11, 2016
7d254cd
Changes requested
boudreau Oct 11, 2016
94d76b0
Merge branch 'master' of https://github.com/librenms/librenms into is…
boudreau Oct 11, 2016
7741907
syntax error
boudreau Oct 11, 2016
3630505
modified state f5
boudreau Oct 11, 2016
e380fca
Formatting updates
laf Oct 6, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 28 additions & 0 deletions includes/discovery/sensors/fanspeeds/f5.inc.php
@@ -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);
}
}
}
}
}
210 changes: 210 additions & 0 deletions includes/discovery/sensors/states/f5.inc.php
@@ -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);
Copy link
Member

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?


//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')
8 changes: 4 additions & 4 deletions includes/discovery/sensors/temperatures/avtech.inc.php
Expand Up @@ -4,7 +4,7 @@
if ($device['os'] == 'avtech') {
echo 'AVTECH: ';
if (strpos($device['sysObjectID'], '.20916.1.7') !== false) {
// TemPageR 3E
// TemPageR 3E
$device_oid = '.1.3.6.1.4.1.20916.1.7.';

$internal = array(
Expand All @@ -28,7 +28,7 @@
);
avtech_add_sensor($device, $sen2);
} elseif (strpos($device['sysObjectID'], '.20916.1.9') !== false) {
// RoomAlert 3E
// RoomAlert 3E
$device_oid = '.1.3.6.1.4.1.20916.1.9.';

$internal = array(
Expand All @@ -45,7 +45,7 @@
);
avtech_add_sensor($device, $sen1);
} elseif (strpos($device['sysObjectID'], '.20916.1.1') !== false) {
// TemPageR 4E
// TemPageR 4E
$device_oid = '.1.3.6.1.4.1.20916.1.1.';

$internal = array(
Expand Down Expand Up @@ -84,7 +84,7 @@
);
avtech_add_sensor($device, $sen3);
} elseif (strpos($device['sysObjectID'], '.20916.1.6') !== false) {
// RoomAlert 4E
// RoomAlert 4E
$device_oid = '.1.3.6.1.4.1.20916.1.6.';
$divisor = 1;

Expand Down
9 changes: 2 additions & 7 deletions includes/discovery/sensors/temperatures/comware.inc.php
Expand Up @@ -13,9 +13,7 @@
if ($device['os'] == 'comware') {
echo 'Comware ';

$entphydata = dbFetchRows("SELECT `entPhysicalIndex`, `entPhysicalClass`, `entPhysicalName` FROM `entPhysical` WHERE `device_id` = ? AND `entPhysicalClass` REGEXP 'module|sensor' ORDER BY `entPhysicalIndex`", array(
$device['device_id']
));
$entphydata = dbFetchRows("SELECT `entPhysicalIndex`, `entPhysicalClass`, `entPhysicalName` FROM `entPhysical` WHERE `device_id` = ? AND `entPhysicalClass` REGEXP 'module|sensor' ORDER BY `entPhysicalIndex`", array($device['device_id']));

if (!empty($entphydata)) {
$tempdata = snmpwalk_cache_multi_oid($device, 'hh3cEntityExtTemperature', array(), 'HH3C-ENTITY-EXT-MIB');
Expand All @@ -36,10 +34,7 @@
foreach ($comware_oids as $index => $entry) {
if (is_numeric($entry['hh3cTransceiverTemperature']) && $entry['hh3cTransceiverTemperature'] != 2147483647) {
$oid = '.1.3.6.1.4.1.25506.2.70.1.1.1.15.' . $index;
$dbquery = dbFetchRows("SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ? AND `ifAdminStatus` = 'up'", array(
$index,
$device['device_id']
));
$dbquery = dbFetchRows("SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ? AND `ifAdminStatus` = 'up'", array($index,$device['device_id']));
$limit_low = $entry['hh3cTransceiverTempLoAlarm'] / $divisor_alarm;
$warn_limit_low = $entry['hh3cTransceiverTempLoWarn'] / $divisor_alarm;
$limit = $entry['hh3cTransceiverTempHiAlarm'] / $divisor_alarm;
Expand Down
40 changes: 40 additions & 0 deletions includes/discovery/sensors/temperatures/f5.inc.php
@@ -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');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems more appropriate to walk sysCpuSensorEntry so you don't need the other two snmp_get()'s


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