# MClp.ctl:235: Collects Printing Devices Information # $Id: MClp.ctl,v 1.10 2015/10/13 14:03:27 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/EXPLORER/MClp.ctl,v 1.10 2015/10/13 14:03:27 RDA Exp $ # # Change History # 20151013 JGS Improve CUPS availability checks and documentation. =head1 NAME EXPLORER:MClp - Collects Printing Devices Information =head1 DESCRIPTION This module collects printing devices information. =cut use Mrc # Initialization var $VALIDATE = true keep $VALIDATE section begin var $ERR = '---## Associated Errors' var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' run EXPLORER:XPLRlib('lp') #------------------------------------------------------------------------------ # XPLR_lp section #------------------------------------------------------------------------------ section XPLR_lp # Validate the execution context call log_run('Processing LP sections ...') pretoc '2:Printing Devices' loop $rec (get_zones(false)) {if $loc = defined($nam = $rec->[0]) {var ($ttl,$pre,$exe) = (concat('From Zone ',$nam),\ concat('zones/',$nam),\ concat('/usr/sbin/zlogin ',$nam)) call log_info(concat('lp: RUNNING: zone ',$nam),\ concat(' Inside LP collection, collecting from zone ',$nam)) } else var ($ttl,$pre,$exe) = ('From Global Zone') var $top = $rec->[1] var $ver = $rec->[2] pretoc '3:',$ttl if and(compare('VALID',$ver,'5.11'),\ or(compare('VALID',$ver,'5.11.1'),\ expr('>=',\ first(grepCommand(join(' ',$exe,'/usr/bin/pkg list -H entire'),\ '^[^\-]*\-[^\.\-]*\.(\d+)','f1')),\ 173),\ grepCommand('/usr/sbin/print-service -q 2>/dev/null',\ ':\s*cups','f'))) {debug ' Inside LP collection, gathering CUPS information from ',\ nvl($nam,'global'),' zone' =head2 lp_cups_cmd - CUPS Overview Gathers the printing devices information using the following commands when Common Unix Printing System (CUPS) is available: =over 2 =item o C (Oracle Solaris 11 and later) =item o C (Oracle Solaris 11 and later) =back =cut report concat('lp_cups_cmd_z_',nvl($nam,'global')) title '---+!! CUPs Commands' title $TOC call do_remote($pre,$exe,$top,\ ['cups/cupsctl',\ '/usr/sbin/cupsctl',undef,\ '---+ CUPS Settings'],\ ['cups/lpstat-ta',\ '/usr/bin/lpstat','-ta',\ '---+ Printers Status Information']) if isCreated(true) toc '4:[[',getFile(),'][rda_report][CUPS Overview]]' =head2 lp_cups - Key CUPS Files Gathers the following files when CUPS is available: =over 2 =item o F (recursive) =item o F =back =cut debug ' Inside LP collection, collecting key CUPS files from ',\ nvl($nam,'global'),' zone' report concat('lp_cups_z_',nvl($nam,'global')) prefix {write '---+ CUPS Key Collected files' write ' * Links point to files that have been collected in their original \ format. Opening them directly in your browser can present \ risks. To prevent them, access the file outside the browser or \ use the link to save them and use an adequate viewer.' write '|*File Path*| *Size*|*Last Modified Date*|' } call do_collect_rem($pre,$top,\ ['B','cups','/etc/cups',true],\ ['B','cups/logs','/var/log/cups']) if hasOutput(true) write $TOP if isCreated(true) toc '4:[[',getFile(),'][rda_report][Key CUPS Files]]' } =head2 lp_cmd - Overview Gathers the printing devices information using the following commands when CUPS is not used: =over 2 =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =back =cut else {# Perform alternative collection when not using CUPS debug ' Inside LP collection, gathering LP information from ',\ nvl($nam,'global'),' zone' # Determine the command to collect var @cmd = () if ?testDir('d','/var/spool/lp') call push(@cmd,\ ['lp/ls-l_var_spool_lp',\ ${CMD.LS:'ls'},'-l /var/spool/lp',\ '---+ Current Print Requests in the Print Queue']) call push(@cmd,\ ['lp/fnselect',\ '/usr/sbin/fnselect',undef,\ '---+ Initial Context Service']) if ?testDir('d','/var/spool/print') call push(@cmd,\ ['lp/ls-l_var_spool_print',\ ${CMD.LS:'ls'},'-l /var/spool/print',\ '---+ LP Print Service Client-Side Request Staging Area']) call push(@cmd,\ ['lp/lpfilter-fall-l',\ '/usr/sbin/lpfilter','-fall -l',\ '---+ LP Print Service Filters']) if ?testDir('d','/usr/bin/lp') call push(@cmd,\ ['lp/ls-ld_usr_bin_lp',\ ${CMD.LS:'ls'},'-ld /usr/bin/lp',\ '---+ LP Print Service User Commands']) call push(@cmd,\ ['lp/fnlist',\ '/usr/bin/fnlist','thisorgunit/service/printer',\ '---+ Names and References Bound']) if ?testDir('d','/etc/lp/classes') call push(@cmd,\ ['lp/ls-lR_classes',\ ${CMD.LS:'ls'},'-lR /etc/lp/classes',\ '---+ Printer Classes']) if ?testDir('d','/etc/lp/interfaces') call push(@cmd,\ ['lp/ls-l_interfaces',\ ${CMD.LS:'ls'},'-l /etc/lp/interfaces',\ '---+ Printer Interfaces']) if ?testDir('d','/etc/lp/printers') call push(@cmd,\ ['lp/ls-lR_printers',\ ${CMD.LS:'ls'},'-lR /etc/lp/printers',\ '---+ Printers List']) if ?testDir('d','/var/lp/logs') call push(@cmd,\ ['lp/ls-ld_var_lp_logs',\ ${CMD.LS:'ls'},'-ld /var/lp/logs',\ '---+ Print Requests Log History']) if ?testDir('d','/var/lp/logs/requests') call push(@cmd,\ ['lp/ls-ld_var_lp_logs_requests',\ ${CMD.LS:'ls'},'-ld /var/lp/logs/requests',\ '---+ Print Requests Ongoing History']) if ?testDir('d','/var/lp/logs/lpsched') call push(@cmd,\ ['lp/ls-ld_var_lp_logs_lpsched',\ ${CMD.LS:'ls'},'-ld /var/lp/logs/lpsched',\ '---+ Print Scheduler Logs']) # Collect the command outputs report concat('lp_cmd_z_',nvl($nam,'global')) title '---+!! Printing Devices Commands' title $TOC call do_remote($pre,$exe,$top,@cmd) if isCreated(true) toc '4:[[',getFile(),'][rda_report][Overview]]' =head2 lp_files - Key Files Gathers the following files when CUPS is not used: =over 2 =item o F =item o F (recursive) =item o F =item o F (recursive) =item o F =item o F =item o F =back =cut debug ' Inside LP collection, collecting key files from ',nvl($nam,'global'),\ ' zone' report concat('lp_files_z_',nvl($nam,'global')) prefix {write '---+!! Printing Devices Files' write ' * Links point to files that have been collected in their original \ format. Opening them directly in your browser can present \ risks. To prevent them, access the file outside the browser or \ use the link to save them and use an adequate viewer.' write '|*File Path*| *Size*|*Last Modified Date*|' } call do_collect_rem($pre,$top,\ ['B','lp/printers.conf', '/etc/printers.conf'],\ ['B','lp/classes', '/etc/lp/classes','','','^\.+$','drv'],\ ['B','lp/filter.table', '/etc/lp/filter.table'],\ ['B','lp/printers', '/etc/lp/printers','','','^\.+$','drv'],\ ['B','lp/logs/ipp-errors','/etc/lp/logs/ipp-errors'],\ ['B','lp/logs', '/var/lp/logs','','','^(lpsched|requests)']) if isCreated(true) {write $TOP toc '4:[[',getFile(),'][rda_report][Key Files]]' } } # Adjust the table of content unpretoc } # Adjust the table of content unpretoc =head2 Zones =for zone begin lp By default, collects information from the global zone only. When local zone collections are requested explicitly, and CUPS is available collects CUPS related information from the selected local zones using the following commands: =over 2 =item o C (Oracle Solaris 11 and later) =item o C (Oracle Solaris 11 and later) =back and the following files from the selected local zones: =over 2 =item o F (recursive) =item o F =back When local zone collections are requested explicitly, and CUPS is not available collects printing devices information from the selected local zones using the following commands: =over 2 =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =back and the following files from the selected local zones: =over 2 =item o F =item o F (recursive) =item o F =item o F (recursive) =item o F =item o F =item o F =back =for zone end =head1 SEE ALSO L, L, L =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. =head1 TRADEMARK NOTICE Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. =cut