![](https://secure.gravatar.com/avatar/21caf0a08d095be7196a1648d20942be.jpg?s=120&d=mm&r=g)
22 Jan
2016
22 Jan
'16
3:47 a.m.
Valid for many code blocks in Observium:
http://www.commitstrip.com/en/2016/01/18/what-idiot-wrote-this-code/
On 2016-01-22 09:34, Adam Armstrong wrote:
I was thinking that when I was patching it.
Adam.
Sent from BlueMail http://www.bluemail.me/r
On 22 Jan 2016, at 08:33, Tom Laermans <tom.laermans@powersource.cx mailto:tom.laermans@powersource.cx> wrote:
Yup, but the code that was there was fairly retarded, the new one looks nothing like it =) On 22/01/2016 09:23, Adam Armstrong wrote:
It's just a couple of extra matches and a couple of extra stats being tracked. Nothing complex :> the patch didn't even apply right, so i did it manually. that's how easy it was :D adam.
On 22/01/2016 08:17:22, Tom Laermans <tom.laermans@powersource.cx> wrote: And will be likely fully undone when I commit my total rewrite of the printer module soon... I'm fairly sure with the way the new code is written things will still work, but you may need to re-tune it. I'll see if I can trace what you changed into the new code, though - but I won't have a printer to test it against. Tom On 22/01/2016 07:22, Adam Armstrong wrote:
This is now committed! Thanks, adam.
On 21/01/2016 18:12:23, Dirk-Willem van Gulik <dirkx@webweaving.org> wrote: Minor diff to make things work with an older type of printer. Dw --- toner.inc.php.orig 2016-01-21 19:49:49.528405666 +0100 +++ toner.inc.php 2016-01-21 20:06:36.382527604 +0100 @@ -39,10 +39,11 @@ $index = $split_oid[count($split_oid)-1]; if (is_numeric($role)) { - $type_oid = ".1.3.6.1.2.1.43.11.1.1.5.1.$index"; - $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"; - $toner_oid = ".1.3.6.1.2.1.43.11.1.1.9.1.$index"; + $class_oid = ".1.3.6.1.2.1.43.11.1.1.4.1.$index"; // prtMarkerSuppliesClass (supplyThatIsConsumed(3), receptacleThatIsFilled(4)) + $type_oid = ".1.3.6.1.2.1.43.11.1.1.5.1.$index"; // prtMarkerSuppliesType + $descr_oid = ".1.3.6.1.2.1.43.11.1.1.6.1.$index"; // prtMarkerSuppliesDescription + $capacity_oid = ".1.3.6.1.2.1.43.11.1.1.8.1.$index"; // prtMarkerSuppliesMaxCapacity + $toner_oid = ".1.3.6.1.2.1.43.11.1.1.9.1.$index"; // prtMarkerSuppliesLevel $classtype = snmp_get($device, $class_oid, "-Oqv"); $resourcetype = snmp_get($device, $type_oid, "-Oqv"); @@ -52,8 +53,10 @@ { switch ($resourcetype) { - case 3: - case 21: + case 3: // Toner + case 5: // Ink or particulate + case 6: // InkCardridge + case 21: // Toner Cardridge /* .1.3.6.1.2.1.43.11.1.1.8 prtMarkerSuppliesMaxCapacity * The value (-1) means other and specifically indicates that the sub-unit places * no restrictions on this parameter. The value (-2) means unknown. @@ -133,8 +136,11 @@ set_dev_attrib($device, "transferroller_cap_oid", $capacity_oid); } break; - case 4: - if (stristr($descr, 'waste') !== FALSE) + case 4: // Waste Toner + case 8: // Waste Ink or toner + case 24: // Waste liquid or Ink + if (stristr($descr, 'waste') !== FALSE || stristr($descr, 'absorber') == FALSE || $classtype == 3) { echo(" WasteTonerBox"); set_dev_attrib($device, "wastebox_oid", $toner_oid); _______________________________________________ observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
_______________________________________________ observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
_______________________________________________ observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
------------------------------------------------------------------------ observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium