My RHEL print server is sending SNMP queries to the printers. Why? Can I prevent this?
Environment
- Red Hat Enterprise Linux (RHEL) 5, 6, 7, and 8
- Common Unix Printing System (CUPS)
Issue
- SNMP queries are sent to printers when we print something by lpr like "
lpr -P laserpr text.txt". Is the sending of SNMP queries when printing a implementation of CUPS? Can we disable this function? - SNMP queries are causing delays in printing because the printer is taking several seconds to respond to the queries.
Resolution
To prevent CUPS from sending SNMP queries to printers, you can either:
- modify the PPD (PostScript Printer Definition) file for the print queue, or
- add an option to the Device URI for the queue.
To modify the PPD file, add the following line to the file for the appropriate print queue:
*cupsSNMPSupplies: False
To do this:
-
copy the PPD file from
/etc/cups/ppd/<print-queue>.ppdto the/tmpdirectory, where<print-queue>is the name of the print queue for which you would like to disable SNMP queries. For example, if the print queue was named "laserpr" then the command would be:cp /etc/cups/ppd/laserpr.ppd /tmp/laserpr-mod.ppd -
Use your favorite editor to add the following line to the PPD file near the top of the file before any "
*OpenUI" statements:*cupsSNMPSupplies: FalseSave the file back to the PPD file in the
/tmpdirectory. -
Re-install the PPD file with an lpadmin command like the following:
lpadmin -p laserpr -P /tmp/laserpr-mod.ppd
To add an option to the Device URI, add the "snmp=false" option to the end of the Device URI for the printer. To do this:
-
Retrieve the existing Device URI using the
lpstatcommand. For example:$ lpstat -v laserpr device for laserpr: socket://10.1.2.3/ -
Run the
lpadmincommand with the-voption addingsnmp=falseto the end of the Device URI:lpadmin -p laserpr -v socket://10.1.2.3?snmp=falseAs with all URIs, the option is separated from the hostname (and optionally the port) with a question mark (
?). If the Device URI already has an option, then the options are separated with ampersands (&). For example:$ lpstat -v laserpr device for laserpr: socket://10.1.2.3?waiteof=falsethen
lpadmin -p laserpr -v 'socket://10.1.2.3?waiteof=false&snmp=false'If
&is used, then the Device URI needs to be quoted to avoid special-character interpretation of&by the shell.The
lpd://backend should also accept thesnmp=falseoption. For example:$ lpstat -v lpdprinter device for lpdprinter: lpd://10.1.2.3/lpdprinter $ lpadmin -p lpdprinter -v lpd://10.1.2.3/lpdprinter?snmp=false
Root Cause
Many of the CUPS "backend" programs send SNMP queries to the printers to get supply (ink, toner, paper, etc.) levels. The CUPS backend programs are the ones that communicate directly with the printers, and they reside in the /usr/lib/cups/backend directory. Currently, the ipp, lpd, and socket backend programs issue SNMP queries to retrieve supply information from the printer.
CUPS also sends SNMP broadcast queries to discover new printers. For more information about how CUPS does this and how to prevent it, please see the following Knowledgebase Solution:
Why is CUPS running on RHEL broadcasting SNMP requests? Can I stop it?
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.