# M235LP.def: Collects Printing Devices Information # $Id: M235LP.def,v 1.6 2012/05/15 17:08:50 mschenke Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_4/src/scripting/lib/modules/M235LP.def,v 1.6 2012/05/15 17:08:50 mschenke Exp $ # # Change History # 20120515 LDE Fix the classes collection. =head1 NAME M235LP - 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 XPLRlib('lp') #------------------------------------------------------------------------------ # XPLR_lp section #------------------------------------------------------------------------------ section XPLR_lp # Validate the execution context if !${XPLR_GLOBAL:true} return call log_run('Processing LP sections ...') pretoc '2:Printing Devices' # Determine CUPS usage if expr('>=',get_osv(),11) {var ($ver) = grepCommand('/usr/bin/pkg list -H entire',\ '^[^\-]*\-[^\.\-]*\.(\d+)','f1') var $cup = expr('>=',$ver,173) } if !$cup var $cup = grepCommand('/usr/sbin/print-service -q 2>/dev/null',':\s*cups') =head2 lp_cups - Key CUPS File Gathers the following files when Common Unix Printing System (CUPS) is used: =over 2 =item o F (recursive) =item o F =back =cut if $cup {# Perform specific collection when using CUPS debug ' Inside LP collection, collecting key CUPS files' report lp_cups 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_dir('cups','/etc/cups',true) call do_collect_dir('cups/logs','/var/log/cups') if hasOutput(true) write $TOP if isCreated(true) toc '3:[[',getFile(),'][rda_report][Key CUPS Files]]' } =head2 lp_cmd - Overview Gathers the printing devices information using the following commands when Common Unix Printing System (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' # Determine the command to collect var @cmd = () if testDir('d','/var/spool/lp') call push(@cmd,\ ['lp/ls-l_var_spool_lp',\ '/usr/bin/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',\ '/usr/bin/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',\ '/usr/bin/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',\ '/usr/bin/ls','-lR /etc/lp/classes',\ '---+ Printer Classes']) if testDir('d','/etc/lp/interfaces') call push(@cmd,\ ['lp/ls-l_interfaces',\ '/usr/bin/ls','-l /etc/lp/interfaces',\ '---+ Printer Interfaces']) if testDir('d','/etc/lp/printers') call push(@cmd,\ ['lp/ls-lR_printers',\ '/usr/bin/ls','-lR /etc/lp/printers',\ '---+ Printers List']) if testDir('d','/var/lp/logs') call push(@cmd,\ ['lp/ls-ld_var_lp_logs',\ '/usr/bin/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',\ '/usr/bin/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',\ '/usr/bin/ls','-ld /var/lp/logs/lpsched',\ '---+ Print Scheduler Logs']) # Collect the command outputs report lp_cmd title '---+!! Printing Devices Commands' title $TOC call do_exec(@cmd) if isCreated(true) toc '3:[[',getFile(),'][rda_report][Overview]]' =head2 lp_files - Key Files Gathers the following files when Common Unix Printing System (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' report lp_files 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_fil(\ ['lp/printers.conf', '/etc/printers.conf'],\ ['lp/classes', '/etc/lp/classes','','','^\.+$','drv'],\ ['lp/filter.table', '/etc/lp/filter.table'],\ ['lp/printers', '/etc/lp/printers','','','^\.+$','drv'],\ ['lp/logs/ipp-errors','/etc/lp/logs/ipp-errors'],\ ['lp/logs', '/var/lp/logs','','','^(lpsched|requests)']) if isCreated(true) {write $TOP toc '3:[[',getFile(),'][rda_report][Key Files]]' } } unpretoc =head1 SEE ALSO L, L =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2012, 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