Merge pull request #4267 from HybridAU/master

newdevice: Added support for Lanier printers #4267
This commit is contained in:
Neil Lathwood
2016-08-30 14:27:23 +01:00
committed by GitHub
5 changed files with 20 additions and 10 deletions

View File

@@ -123,6 +123,7 @@ LibreNMS contributors:
- Bennett Blodinger <bennett.blodinger@gmail.com> (benwa)
- Michael Hansen <nerdalertdk@gmail.com> (nerdalertdk)
- Daniel Cox <danielcoxman@gmail.com> (ospfbgp)
- Michael Van Delft <librenms@xo.tc> (HybridAU)
[1]: http://observium.org/ "Observium web site"
Observium was written by:

BIN
html/images/os/lanier.png Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 B

View File

@@ -1501,6 +1501,15 @@ $config['os'][$os]['icon'] = 'ricoh';
$config['os'][$os]['over'][0]['graph'] = 'device_toner';
$config['os'][$os]['over'][0]['text'] = 'Toner';
// lanier is a rebadged ricoh
$os = 'lanier';
$config['os'][$os]['group'] = 'printer';
$config['os'][$os]['text'] = 'Lanier Printer';
$config['os'][$os]['type'] = 'printer';
$config['os'][$os]['icon'] = 'lanier';
$config['os'][$os]['over'][0]['graph'] = 'device_toner';
$config['os'][$os]['over'][0]['text'] = 'Toner';
$os = 'nrg';
$config['os'][$os]['group'] = 'printer';
$config['os'][$os]['text'] = 'NRG Printer';
@@ -1534,13 +1543,6 @@ $config['os'][$os]['icon'] = 'hp';
$config['os'][$os]['over'][0]['graph'] = 'device_toner';
$config['os'][$os]['over'][0]['text'] = 'Toner';
$os = 'richoh';
$config['os'][$os]['group'] = 'printer';
$config['os'][$os]['text'] = 'Ricoh Printer';
$config['os'][$os]['type'] = 'printer';
$config['os'][$os]['over'][0]['graph'] = 'device_toner';
$config['os'][$os]['over'][0]['text'] = 'Toner';
$os = 'okilan';
$config['os'][$os]['group'] = 'printer';
$config['os'][$os]['text'] = 'OKI Printer';

View File

@@ -0,0 +1,7 @@
<?php
if (!$os) {
if (strstr($sysDescr, 'LANIER')) {
$os = 'lanier';
}
}

View File

@@ -22,7 +22,7 @@ if ($device['os_group'] == 'printer') {
$index = $split_oid[(count($split_oid) - 1)];
if (is_numeric($role)) {
//ricoh using private oids to expose toner levels
if ($os == 'ricoh' || $os == 'nrg') {
if ($os == 'ricoh' || $os == 'nrg' || $os == 'lanier') {
$toner_oid = ".1.3.6.1.4.1.367.3.2.1.2.24.1.1.5.$index";
$descr_oid = ".1.3.6.1.4.1.367.3.2.1.2.24.1.1.3.$index";
} else {
@@ -37,14 +37,14 @@ if ($device['os_group'] == 'printer') {
$current = snmp_get($device, $toner_oid, '-Oqv');
//ricoh private mibs returns values as percent, no capacity is disclosed as it is not needed
if ($os == 'ricoh') {
if ($os == 'ricoh' || $os == 'lanier') {
$capacity = 100;
} else {
$capacity = snmp_get($device, $capacity_oid, '-Oqv');
}
//fix for ricoh devices returning garbage and devices returning percentage
if ($os == 'ricoh' || $os == 'nrg') {
if ($os == 'ricoh' || $os == 'nrg' || $os == 'lanier') {
if ($current == '-3') {
$current = 50;
} elseif ($current == '-100') {