Add check for differently named Cisco Power sensor #5119

Merged
merged 2 commits into from Dec 7, 2016

Projects

None yet

4 participants

@geordish
Contributor
geordish commented Dec 6, 2016 edited

Please note

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

Fix for #5106

@geordish geordish Add check for differently named Cisco Power sensor
1c4be11
@geordish geordish Bad fix for this problem
69348d1
@geordish
Contributor
geordish commented Dec 6, 2016 edited

@laf @murrant @Rosiak @paulgear etc. The fix I've proposed is probably pretty bad, and going to break other stuff. Got any ideas about how we should do this properly?

Quick summary.
in includes/polling/functions.php around line 46, various files are included, some of which set $sensor_state using the current value of $sensor_state. $sensor_state hasn't been set at this point.

$sensor_state then gets set immediately afterwards.

One thought I have is changing this section of code to be:

if (file_exists('includes/polling/sensors/'. $class .'/'. $device['os'] .'.inc.php')) {
       require_once 'includes/polling/sensors/'. $class .'/'. $device['os'] .'.inc.php';
} else {
       $sensor_value = trim(str_replace('"', '', $snmp_data[$sensor['sensor_oid']]));
}

Then modifying each of the includes to act upon $snmp_data[$sensor['sensor_oid']], rather than $sensor_data.

Thoughts?

@scrutinizer-notifier

The inspection completed: 1 new issues

@laf laf added the Bug label Dec 7, 2016
@laf laf merged commit e67572c into librenms:master Dec 7, 2016

2 checks passed

Auto-Deploy Build finished.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@murrant murrant added a commit to murrant/librenms that referenced this pull request Dec 8, 2016
@geordish @murrant geordish + murrant fix: Add check for differently named Cisco Power sensor (#5119) d9e7751
@VimCommando VimCommando added a commit to VimCommando/librenms that referenced this pull request Jan 4, 2017
@geordish @VimCommando geordish + VimCommando fix: Add check for differently named Cisco Power sensor (#5119) 9d3df63
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment