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

Add additional F5 sensor support #4642

merged 24 commits into from Oct 13, 2016

Conversation

boudreau
Copy link
Contributor

@boudreau boudreau commented Sep 27, 2016

Please note

Please read this information carefully. You can run ./scripts/pre-commit.php to check your code before submitting.

@LibreNMS-CI
Copy link

Auto-Deploy finished, Test PR at http://4642.ci.librenms.org or https://4642.ci.librenms.org

Copy link
Member

@murrant murrant left a comment

Choose a reason for hiding this comment

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

Please check the comments I made in all places.

I just made this PR, should be an ok example for keeping things tidy.
#4640

}
}

foreach (array_keys($temp) as $index) {
Copy link
Member

Choose a reason for hiding this comment

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

You can do foreach($temp as $index => $data) here.


foreach (array_keys($temp) as $index) {
$descr = "sysChassisPowerSupplyStatus.".$temp[$index]['sysChassisPowerSupplyIndex'];
$current = $temp[$index]['sysChassisPowerSupplyStatus'];
Copy link
Member

Choose a reason for hiding this comment

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

and $current = $data['sysChassisPowerSupplyStatus']; here

$current = $temp[$index]['sysChassisPowerSupplyStatus'];
$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');
Copy link
Member

Choose a reason for hiding this comment

The 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

@laf laf changed the title Issue 4599 Add additional F5 sensor support Sep 27, 2016
@laf
Copy link
Member

laf commented Sep 27, 2016

Also lots of formatting issues, please see our docs about running pre-commit checks.

@LibreNMS-CI
Copy link

Auto-Deploy finished, Test PR at http://4642.ci.librenms.org or https://4642.ci.librenms.org

@LibreNMS-CI
Copy link

Auto-Deploy finished, Test PR at http://4642.ci.librenms.org or https://4642.ci.librenms.org

@@ -703,7 +703,9 @@
$config['poller_modules']['cisco-mac-accounting'] = 1;
$config['poller_modules']['cipsec-tunnels'] = 1;
$config['poller_modules']['cisco-ace-loadbalancer'] = 1;
$config['poller_modules']['F5-loadbalancer'] = 1;
Copy link
Member

Choose a reason for hiding this comment

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

Not sure you've added these in. They aren't poller modules.

$config['poller_modules']['cisco-ace-serverfarms'] = 1;
$config['poller_modules']['F5-serverfarms'] = 1;
Copy link
Member

Choose a reason for hiding this comment

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

Same goes for this.

$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;
Copy link
Member

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

$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;
Copy link
Member

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

$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;
Copy link
Member

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

$descr = "sysCmFailoverStatusColor.".$index;
$current = $temp1[$index]['sysCmFailoverStatusColor'];
$sensorType = 'f5';
$oid = '1.3.6.1.4.1.3375.2.1.14.3.3.'.$index;
Copy link
Member

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

$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;
Copy link
Member

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

@LibreNMS-CI
Copy link

Auto-Deploy finished, Test PR at http://4642.ci.librenms.org or https://4642.ci.librenms.org

@boudreau
Copy link
Contributor Author

boudreau commented Sep 29, 2016

Hi,

Sorry, got mixed up with another project, no changes should be applied on the includes/defaults.inc.phphttps://github.com//pull/4642#pullrequestreview-2036461: file.

I added the missing ‘.’ on the OIDs.

Thanks

Yves

@LibreNMS-CI
Copy link

Auto-Deploy finished, Test PR at http://4642.ci.librenms.org or https://4642.ci.librenms.org

1 similar comment
@LibreNMS-CI
Copy link

Auto-Deploy finished, Test PR at http://4642.ci.librenms.org or https://4642.ci.librenms.org

@Rosiak
Copy link
Member

Rosiak commented Oct 1, 2016

Sorry to bother again, but would it be possible to clean up the state sensor code?
You should be able to use includes/discovery/sensors/states/cisco.inc.php as an example.

@laf laf removed the Blocker 🚫 label Oct 3, 2016
$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);
Copy link
Member

Choose a reason for hiding this comment

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

Haven't we got fanspeed from the sysChassisFanSpeed walk?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure, I'm following?
I did the same code structure as in dell.inc.php in includes/discovery/sensors/fanspeeds.
It also looks the same in the lmsensors.inc.php. They snmp_walk and then it snmp_get ?

$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');
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 that from the snmpwalk of sysCmFailoverStatusColor

$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;
Copy link
Member

Choose a reason for hiding this comment

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

Again don't we have this value from the walk already?

$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);
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?

$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(
Copy link
Member

Choose a reason for hiding this comment

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

The formatting of this seems unnecessary.

@@ -36,10 +38,12 @@
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,
$dbquery = dbFetchRows(
Copy link
Member

Choose a reason for hiding this comment

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

The formatting of this seems unnecessary.

$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;
Copy link
Member

Choose a reason for hiding this comment

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

This seems unnecessary to set all these variables when they are only ever null, just pass null to the function.

<?php

if ($device['os'] == 'f5') {
$f5 = null;
Copy link
Member

Choose a reason for hiding this comment

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

should be $f5 = array()``or better yet$f5_chassis = array();`

}

// Get the CPU Temperature values
$f5cpu = null;
Copy link
Member

Choose a reason for hiding this comment

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

Should be $f5_cpu = array();

// Get the CPU Temperature values
$f5cpu = null;
// $f5cpu = snmpwalk_cache_oid($device, 'sysCpuSensorTemperature', array(), 'F5-BIGIP-SYSTEM-MIB');
$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

@laf
Copy link
Member

laf commented Oct 3, 2016

I've put some comments in this. Please also remove the .txt extension from all MIBs.

@laf
Copy link
Member

laf commented Oct 11, 2016

bump @boudreau

@scrutinizer-notifier
Copy link

The inspection completed: 10 new issues

@laf laf added Device 🖥️ New or added device support and removed Blocker 🚫 labels Oct 13, 2016
@laf laf merged commit 5669dce into librenms:master Oct 13, 2016
@boudreau boudreau deleted the issue-4599 branch October 19, 2016 11:46
@lock lock bot locked as resolved and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Device 🖥️ New or added device support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants