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

Fixed Total Chassis Power sensor_index for SmartAX MA5603T/MA5683T #9115

Merged
merged 5 commits into from
Sep 2, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions includes/discovery/sensors/power/smartax.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
* @copyright 2018 TheGreatDoc
* @author TheGreatDoc
*/
$pow_frame_oid = '1.3.6.1.4.1.2011.2.6.7.1.1.1.1.11';

$power_frame_oid = '.1.3.6.1.4.1.2011.2.6.7.1.1.1.1.11.0';

$power = snmp_get($device, $power_frame_oid, '-Ovq');
$index = '0';
$sensor_index = 'TotalChassisPower';

discover_sensor($valid['sensor'], 'power', $device, $power_frame_oid, $index, 'smartax', 'Chassis Total', '1', '1', null, null, null, null, $power);
discover_sensor($valid['sensor'], 'power', $device, $power_frame_oid, $sensor_index, 'smartax', 'Chassis Total', null, null, null, null, null, null, $power);
Copy link
Member

@murrant murrant Aug 31, 2018

Choose a reason for hiding this comment

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

Why are you changing the multiplier and divisor to 0? And why did you change the index?

There only seems to be one sensor discovered, so I can't think of a reason to change the index.

Copy link
Contributor Author

@TheGreatDoc TheGreatDoc Aug 31, 2018

Choose a reason for hiding this comment

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

I've changed Index to sensor_index only for future understability. index is more interpreted as oid index, but this is sensor_index that can be (or not) oid index, and removed multiplier/divisor for clean as they are just '1', which I think is the same than passing them as null.

Oh, you dont mean the $var name. I've explained in the other PR ;)

Copy link
Member

Choose a reason for hiding this comment

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

If we have no reason to change the index we should leave it alone, same with the divisor / multiplier.

Test data is helpful so I'd revert the php changes and just submit the test data.

Copy link
Member

Choose a reason for hiding this comment

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

Well, I see that both discover_sensor() calls have the same index, so yes, one needs to be changed.

But, how we handle this in other cases it to change the type, not the index (from 'smartax' -> 'smartax-total' or something)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! Just curious: Why type instead of index? Whats the difference?


$power_oid = '1.3.6.1.4.1.2011.2.6.7.1.1.2.1.11.0';
$descr_oid = '1.3.6.1.4.1.2011.2.6.7.1.1.2.1.7.0';
Expand All @@ -43,5 +43,5 @@
$powerCurr = $value;
$pow_oid = '.' . $power_oid . '.' . $index;
$descr = $descr_data[$index];
discover_sensor($valid['sensor'], 'power', $device, $pow_oid, $index, 'smartax', $descr, '1', '1', null, null, null, null, $powerCurr);
discover_sensor($valid['sensor'], 'power', $device, $pow_oid, $index, 'smartax', $descr, null, null, null, null, null, null, $powerCurr);
}