refactor: toner #4795

Merged
merged 3 commits into from Oct 14, 2016

Projects

None yet

4 participants

@murrant
Contributor
murrant commented Oct 14, 2016 edited

Please note

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

snmpwalk one level higher in the snmp tree, use mib for discovery
Negative values have special meaning according to the mib, recognize those.
Clean up calculations and use the get_toner_levels() in both discovery and polling
Don't fetch the capacity during polling, only discovery
Log when toner reaches 0
fixes: #4767 #4637

includes/functions.php
+ return 0;
+ }
+ } elseif ($device['os'] == 'brother') {
+ if (!str_contains($device['hardware'], 'NC-8600h')) {
@crcro
crcro Oct 14, 2016 Contributor

please note that the hardware value of brother nc-8600h device is something like MFC-L8850

@murrant
murrant Oct 14, 2016 Contributor

oops, thanks I started with an older branch.

murrant added some commits Oct 13, 2016
@murrant murrant refactor: toner
snmpwalk one level higher in the snmp tree, use Printer-MIB for discovery
Negative values have special meaning according to the mib, deal with those properly
Clean up calculations and use get_toner_levels() in both discovery and polling
Don't fetch the capacity during polling, only discovery
Log an event when toner is empty
324f8d5
@murrant murrant Fix hardware name for Brother toner level exception. d2ee402
@murrant murrant fix accidental line return c3220a0
@scrutinizer-notifier

The inspection completed: 2 new issues, 1 updated code elements

@murrant
Contributor
murrant commented Oct 14, 2016

Tested with a couple hp printers, brother-nc7700w.smprec and samsung-ml.snmprec

@murrant murrant closed this Oct 14, 2016
@murrant murrant reopened this Oct 14, 2016
@laf laf merged commit 74f8997 into librenms:master Oct 14, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@murrant murrant deleted the murrant:toner-fix branch Oct 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment