[cups] Do not send jobs if printer is unhealthy (paper out/network/etc)

Robert Heller heller at deepsoft.com
Fri Jun 8 07:03:36 PDT 2018


At Fri, 08 Jun 2018 13:27:47 +0000 "The CUPS user discussion list." <cups at cups.org> wrote:

> 
> Hello,
> 
> We'd like to use highly available printing solution. 
> We have two LaserJets defined (hp_printer_1 and hp_printer_2) and a printing class (hp_printer_prod) which provides round-robin style load balancing.
> That works perfectly if both printers are online and ready to accept jobs (have paper and cartridge).
> 
> Imagine when the next available printer ("hp_printer_1") has a recent issue (paper is *just*out*).
> "Job #1" sent to "hp_printer_prod" will be forwarded to "hp_printer_1" (state=idle).
> In the tcpdump we see the job sent through port 9100. "Job #1" removed from hp_printer_1 queue (because cups handed over to the laserjet). But the paper doesn't come out (no paper in the printer). Job stucked in the printer's memory.
> 
> At this very moment, CUPS detects that there is something wrong with hp_printer_1, and marks unavailable.
> 
> "Job #2" sent to "hp_printer_prod" will be forwarded to "hp_printer_2" (because this is the only printer which is available).
> Subsequent jobs also will be forwarded to "hp_printer_2".
> 
> When "hp_printer_1" goes back in production, "job #1" is printed out on "hp_printer_1" (from memory).
> 
> We're looking for a method to check printer hardware status before printing.
> Printing jobs should only be sent to printer if it is healthy.

It *sounds* like you need a "paper low warning" (for some definiation of
"paper low"), and then divert on this warning. Basicly, you consider the
printer "dead", not when the paper is completely out, but when it is low. That
is, the printer *never* actually runs out of paper, since jobs get diverted
while there is still some paper in the printer. It is statistically unlikely
that the printer will run out of paper just as it is finishing a job. More
likely that it will run out of paper part way through a job.  I don't know if 
this condition can be tested for (I don't know if the printer can be asked 
about how much paper is left).

My only other thought would be to get secondary paper trays and have some 
process detect when the printer moves to the secondary paper tray, so an 
operator (human) can refill the primary paper tray.

> 
> Configuration goes like this:
> 
> <Class hp_printer_prod>
> Info
> Location
> State Idle
> StateTime 1528459526
> Accepting Yes
> Shared Yes
> JobSheets none none
> Printer hp_printer_1
> Printer hp_printer_2
> QuotaPeriod 0
> PageLimit 0
> KLimit 0
> OpPolicy default
> ErrorPolicy retry-current-job
> </Class>
> 
> <Printer hp_printer_1>
> Info hp_printer_1
> MakeModel HP LaserJet 600 M601 M602 M603 Postscript (recommended)
> DeviceURI hp:/net/HP_LaserJet_600_M602?ip=10.5.50.2
> State Idle
> StateTime 1528459608
> Type 8425668
> Filter application/vnd.cups-raw 0 -
> Filter application/vnd.cups-postscript 0 hpps
> Filter application/vnd.cups-command 0 commandtops
> Accepting Yes
> Shared Yes
> JobSheets none none
> QuotaPeriod 0
> PageLimit 0
> KLimit 0
> OpPolicy default
> ErrorPolicy stop-printer
> </Printer>
> <Printer hp_printer_2>
> Info hp_printer_2
> MakeModel HP LaserJet 600 M601 M602 M603 Postscript (recommended)
> DeviceURI hp:/net/HP_LaserJet_600_M602?ip=10.5.50.4
> State Idle
> StateTime 1528459601
> Type 8425668
> Filter application/vnd.cups-raw 0 -
> Filter application/vnd.cups-postscript 0 hpps
> Filter application/vnd.cups-command 0 commandtops
> Accepting Yes
> Shared Yes
> JobSheets none none
> QuotaPeriod 0
> PageLimit 0
> KLimit 0
> OpPolicy default
> ErrorPolicy stop-printer
> </Printer>
> 
> I know that the printer can tell its exact status via the web interface or the more standardized web interface:
> In fact there a lot of SNMP status changes when something goes wrong (diff between two snmpwalks):
> < HOST-RESOURCES-MIB::hrDeviceStatus.1 = INTEGER: running(2)
> > HOST-RESOURCES-MIB::hrDeviceStatus.1 = INTEGER: warning(3)
> < HOST-RESOURCES-MIB::hrPrinterDetectedErrorState.1 = Hex-STRING: 00
> > HOST-RESOURCES-MIB::hrPrinterDetectedErrorState.1 = Hex-STRING: 81
> < SNMPv2-SMI::enterprises.11.2.3.9.1.1.2.2.0 = INTEGER: 0
> > SNMPv2-SMI::enterprises.11.2.3.9.1.1.2.2.0 = INTEGER: 1
> < SNMPv2-SMI::enterprises.11.2.3.9.1.1.2.3.0 = INTEGER: 0
> > SNMPv2-SMI::enterprises.11.2.3.9.1.1.2.3.0 = INTEGER: 1
> < SNMPv2-SMI::enterprises.11.2.3.9.1.1.2.8.0 = INTEGER: 0
> > SNMPv2-SMI::enterprises.11.2.3.9.1.1.2.8.0 = INTEGER: 1
> < SNMPv2-SMI::enterprises.11.2.4.3.1.2.0 = STRING: "ready to print"
> > SNMPv2-SMI::enterprises.11.2.4.3.1.2.0 = STRING: "paper out"
> 
> Is there any method to detect printer issues before sending out jobs (health check before every print job)?
> I'd like to handle this in CUPS, if it is possible. Do not send jobs if paper is out/network issue/ etc.
> (Also I wouldn't want to do this with keepalived and custom check scripts :()
> 
> Thanks for your kind help in advance.
> 
> Best regards
>   Szabolcs Horvath
> _______________________________________________
> cups mailing list
> cups at cups.org
> https://lists.cups.org/mailman/listinfo/cups
> 
>                                                                                                       

-- 
Robert Heller             -- 978-544-6933
Deepwoods Software        -- Custom Software Services
http://www.deepsoft.com/  -- Linux Administration Services
heller at deepsoft.com       -- Webhosting Services
                                    


More information about the cups mailing list