mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-02 00:32:09 +02:00
only discover toner if it actually exists - HP LJ 4100 has 4 indexes but only one toner; should fix FS#46
git-svn-id: http://www.observium.org/svn/observer/trunk@1341 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -2,13 +2,6 @@
|
||||
|
||||
if ($config['enable_printers'])
|
||||
{
|
||||
|
||||
$id = $device['device_id'];
|
||||
$hostname = $device['hostname'];
|
||||
$community = $device['community'];
|
||||
$snmpver = $device['snmpver'];
|
||||
$port = $device['port'];
|
||||
|
||||
$valid_toner = array();
|
||||
|
||||
echo("Toner : ");
|
||||
@@ -32,6 +25,8 @@ if ($device['os'] == "dell-laser" || $device['os'] == "jetdirect")
|
||||
$descr_oid = ".1.3.6.1.2.1.43.11.1.1.6.1.$index";
|
||||
$capacity_oid = ".1.3.6.1.2.1.43.11.1.1.8.1.$index";
|
||||
$descr = trim(str_replace("\n","",str_replace('"','',snmp_get($device, $descr_oid, "-Oqv"))));
|
||||
if ($descr != "")
|
||||
{
|
||||
$current = snmp_get($device, $toner_oid, "-Oqv");
|
||||
$capacity = snmp_get($device, $capacity_oid, "-Oqv");
|
||||
$current = $current / $capacity * 100;
|
||||
@@ -42,9 +37,9 @@ if ($device['os'] == "dell-laser" || $device['os'] == "jetdirect")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
## Delete removed toners
|
||||
|
||||
if($debug) { echo("\n Checking ... \n"); print_r($valid_toner); }
|
||||
|
||||
$sql = "SELECT * FROM toner WHERE device_id = '".$device['device_id']."'";
|
||||
@@ -61,9 +56,8 @@ if ($query = mysql_query($sql))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
unset($valid_toner); echo("\n");
|
||||
|
||||
} # if ($config['enable_printers'])
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user