1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> |
---|
2 | <HTML> |
---|
3 | <HEAD> |
---|
4 | <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9"> |
---|
5 | <TITLE> LPRng-HOWTO: Status Monitoring and Logging</TITLE> |
---|
6 | <LINK HREF="LPRng-HOWTO-18.html" REL=next> |
---|
7 | <LINK HREF="LPRng-HOWTO-16.html" REL=previous> |
---|
8 | <LINK HREF="LPRng-HOWTO.html#toc17" REL=contents> |
---|
9 | </HEAD> |
---|
10 | <BODY> |
---|
11 | <A HREF="LPRng-HOWTO-18.html">Next</A> |
---|
12 | <A HREF="LPRng-HOWTO-16.html">Previous</A> |
---|
13 | <A HREF="LPRng-HOWTO.html#toc17">Contents</A> |
---|
14 | <HR> |
---|
15 | <H2><A NAME="stalledtime"></A> <A NAME="statusref"></A> <A NAME="s17">17. Status Monitoring and Logging</A></H2> |
---|
16 | |
---|
17 | <P>Options used: |
---|
18 | <UL> |
---|
19 | <LI><CODE>stalled_time#</CODE><EM>time after which to report a stalled active job</EM></LI> |
---|
20 | </UL> |
---|
21 | <P>The most commonly used tool for LPRng status is LPQ. |
---|
22 | However, |
---|
23 | the LPC command can be used, |
---|
24 | and you can also get real time logging of status to a remote host. |
---|
25 | <P> |
---|
26 | <H2><A NAME="ss17.1">17.1 LPQ status reporting</A> |
---|
27 | </H2> |
---|
28 | |
---|
29 | <P>The LPQ status display produced by LPRng has three formats. |
---|
30 | <H2><A NAME="ss17.2">17.2 LPQ Short Format (lpq -s)</A> |
---|
31 | </H2> |
---|
32 | |
---|
33 | <P>This is one line per spool queue: |
---|
34 | <BLOCKQUOTE><CODE> |
---|
35 | <PRE> |
---|
36 | % lpq -sa |
---|
37 | t1@astart110 (printing disabled) 1 job |
---|
38 | t2@astart110 (routed/bounce to t1@astart110.astart.com) 0 jobs |
---|
39 | t3@astart110 (forwarding to t3a@astart110.astart.com) |
---|
40 | t3a@astart110 (forwarding to t2@astart110.astart.com) |
---|
41 | t4@astart110 (subservers t5, t6) 0 jobs |
---|
42 | t5@astart110 (serving t4) 0 jobs |
---|
43 | t6@astart110 (serving t4) 0 jobs |
---|
44 | </PRE> |
---|
45 | </CODE></BLOCKQUOTE> |
---|
46 | <P>Note that the name of the printer/host is first, |
---|
47 | followed by optional status information, followed by |
---|
48 | the number of jobs. Only printcap entries with |
---|
49 | spool queues have a jobs word in the last position. |
---|
50 | The |
---|
51 | <CODE>-a</CODE> option forces status for all queues or the |
---|
52 | queues in the <CODE>all</CODE> printcap entry to be returned. |
---|
53 | <P>The <CODE>stalled_time</CODE> (default 120 seconds) printcap option can be used to set a |
---|
54 | time after which active jobs will be reported as stalled. |
---|
55 | <H2><A NAME="ss17.3">17.3 LPQ Long Format (lpq default, lpq -l, lpq -L)</A> |
---|
56 | </H2> |
---|
57 | |
---|
58 | <P>This is the default status display. |
---|
59 | It is a nicely formatted, extremely verbose format |
---|
60 | that is suitable for humble human interpretation. For example: |
---|
61 | <BLOCKQUOTE><CODE> |
---|
62 | <PRE> |
---|
63 | % lpq -a |
---|
64 | Printer: t1@astart110 'Test Printer 1' (printing disabled) |
---|
65 | Queue: 1 printable job |
---|
66 | Server: no server active |
---|
67 | Status: finished operations at 09:44:00 |
---|
68 | Rank Owner/ID Class Job Files Size Time |
---|
69 | 1 papowell@astart110+202228663 A 10663 /tmp/hi 3 20:22:29 |
---|
70 | Printer: t2@astart110 'Test Printer 2' (routed/bounce to t1@astart110.astart.com) |
---|
71 | Queue: no printable jobs in queue |
---|
72 | Status: finished operations at 16:30:08 |
---|
73 | Printer: t3@astart110 (forwarding to t3a@astart110.astart.com) |
---|
74 | Printer: t3a@astart110 (forwarding to t2@astart110.astart.com) |
---|
75 | Printer: t4@astart110 (subservers t5, t6) |
---|
76 | Queue: no printable jobs in queue |
---|
77 | Status: finished operations at 09:44:06 |
---|
78 | Server Printer: t5@astart110 (serving t4) |
---|
79 | Queue: no printable jobs in queue |
---|
80 | Status: finished operations at 09:44:06 |
---|
81 | Server Printer: t6@astart110 (serving t4) |
---|
82 | Queue: no printable jobs in queue |
---|
83 | Status: finished operations at 09:10:00 |
---|
84 | </PRE> |
---|
85 | </CODE></BLOCKQUOTE> |
---|
86 | <P>The <CODE>lpq -l</CODE> (longer information) |
---|
87 | option causes more of the status information to be printed. |
---|
88 | You can use increasing numbers of <CODE>lpq -l</CODE> options |
---|
89 | (<CODE> lpq -ll</CODE> also works) to get more status. |
---|
90 | Use <CODE> lpq -L</CODE> for the maximum amount of status information. |
---|
91 | <H2><A NAME="ss17.4">17.4 LPQ Verbose Format (lpq -v)</A> |
---|
92 | </H2> |
---|
93 | |
---|
94 | <P>This uses an extension to the RFC1179 protocol, |
---|
95 | and is supported only by LPRng. |
---|
96 | The amount of information displayed is the brutal, |
---|
97 | and in effect does a total database dump |
---|
98 | of the LPD. |
---|
99 | This has been developed in order to provide diagnostic |
---|
100 | and status information for databases that need to keep track of |
---|
101 | job progress through a spool queue. |
---|
102 | <BLOCKQUOTE><CODE> |
---|
103 | <PRE> |
---|
104 | % lpq -v |
---|
105 | Printer: t1@astart110 |
---|
106 | Comment: Test Printer 1 |
---|
107 | Printing: no |
---|
108 | Spooling: yes |
---|
109 | Queue: 1 printable job |
---|
110 | Server: no server active |
---|
111 | Status: accounting at end 'papowell@astart110+094352860' at 09:44:00 |
---|
112 | Status: printing 'papowell@astart110+094352860', closing device at 09:44:00 |
---|
113 | Status: printing 'papowell@astart110+094352860', finished at 09:44:00 |
---|
114 | Status: subserver status 'JSUCC' for 'papowell@astart110+094352860' \ |
---|
115 | on attempt 1 at 09:44:00 |
---|
116 | Status: finished operations at 09:44:00 |
---|
117 | Job: papowell@astart110+202228663 status= 1 |
---|
118 | Job: papowell@astart110+202228663 CONTROL= |
---|
119 | - Hastart110.astart.com |
---|
120 | - Ppapowell |
---|
121 | - J/tmp/hi |
---|
122 | - CA |
---|
123 | - Lpapowell |
---|
124 | - Apapowell@astart110+202228663 |
---|
125 | - Qt1 |
---|
126 | - fdfA010663astart110.astart.com |
---|
127 | - N/tmp/hi |
---|
128 | - UdfA010663astart110.astart.com |
---|
129 | Job: papowell@astart110+202228663 HOLDFILE= |
---|
130 | - active 0 |
---|
131 | - done 0 |
---|
132 | - hold 0 |
---|
133 | - move 0 |
---|
134 | .... |
---|
135 | </PRE> |
---|
136 | </CODE></BLOCKQUOTE> |
---|
137 | <H2><A NAME="ss17.5">17.5 lpc status</A> |
---|
138 | </H2> |
---|
139 | |
---|
140 | <P>The LPC status command is used to show the status of the queues |
---|
141 | currently being managed by the LPRng server. |
---|
142 | Note that this form of the command is supported only by LPRng, |
---|
143 | and is not backwards compatible with BSD LPR implementations. |
---|
144 | <BLOCKQUOTE><CODE> |
---|
145 | <PRE> |
---|
146 | %lpc status all |
---|
147 | Printer Printing Spooling Jobs Server Slave Redirect Status/Debug |
---|
148 | lw4@astart4 enabled enabled 0 none none |
---|
149 | lw5@astart4 enabled enabled 0 none none |
---|
150 | </PRE> |
---|
151 | </CODE></BLOCKQUOTE> |
---|
152 | <P>The status display has a heading line and summary of the server status. |
---|
153 | <H2><A NAME="ss17.6">17.6 Remote Logger Operation</A> |
---|
154 | </H2> |
---|
155 | |
---|
156 | <P>Several sites have wanted a way to provide central logging of job |
---|
157 | status and/or information. In order to do this, the following functionality |
---|
158 | is provided with LPRng. |
---|
159 | <H3><A NAME="loggermaxsize"></A> <A NAME="loggertimeout"></A> <A NAME="loggerpathname"></A> <A NAME="loggerdestination"></A> Logger Network Communication</H3> |
---|
160 | |
---|
161 | <P>Options used: |
---|
162 | <UL> |
---|
163 | <LI><CODE>logger_destination=</CODE><EM>logger information destination</EM></LI> |
---|
164 | <LI><CODE>logger_pathname=</CODE><EM>pathname of temp file for log information</EM></LI> |
---|
165 | <LI><CODE>logger_max_size=</CODE><EM>max size in K of temp file for log information</EM></LI> |
---|
166 | <LI><CODE>logger_timeout=</CODE><EM>time between connection attempts</EM></LI> |
---|
167 | </UL> |
---|
168 | <P>The printcap/configuration variable <CODE>logger_destination</CODE> specifies |
---|
169 | a destination in the standard |
---|
170 | <CODE>host%port</CODE> |
---|
171 | notation used by LPRng. |
---|
172 | Host is the destination host, and can be a name or IP address. |
---|
173 | Port is the port on the destination host. |
---|
174 | A TCP/IP connection is made to the indicated port. |
---|
175 | <P>Log information is save in a temporary file specified by |
---|
176 | <CODE>logger_path</CODE>, |
---|
177 | and up to |
---|
178 | <CODE>logger_max_size</CODE> K bytes of data will be saved. |
---|
179 | <P>If a connection cannot be made to the |
---|
180 | <CODE>logger_destination</CODE>, |
---|
181 | then every |
---|
182 | <CODE>logger_timeout</CODE> seconds a new connection attempt will be made. |
---|
183 | If <CODE>logger_timeout</CODE> is 0, |
---|
184 | then a connection attempt will be made every time new data arrives to be logged. |
---|
185 | <H3>Logger Messages</H3> |
---|
186 | |
---|
187 | <P>Log messages consist of a single line |
---|
188 | terminated with a newline (<CODE>\n</CODE>) character. |
---|
189 | <P>Each log message reports a system event or status change of the |
---|
190 | LPD server. |
---|
191 | When the connection is first established, |
---|
192 | a complete dump of the status of the LPD server is sent. |
---|
193 | After this, |
---|
194 | only status update messages are sent. |
---|
195 | The remote monitor can force a status dump by simply closing and |
---|
196 | reopening the connection. |
---|
197 | <H3>Message Format</H3> |
---|
198 | |
---|
199 | <P>Each message is encoded as a URI escaped string. |
---|
200 | That is, non-alphanumeric characters are encoded as the 3 character |
---|
201 | sequence <CODE>%xx</CODE>, where <CODE>xx</CODE> is the hexadecimal value of the character. |
---|
202 | The message has the format <CODE>key=value</CODE>, |
---|
203 | where <CODE>key</CODE> indicates the message type. |
---|
204 | For example: |
---|
205 | <BLOCKQUOTE><CODE> |
---|
206 | <PRE> |
---|
207 | dump=host=astart4.astart.com%0aprinter=t1%0aprocess=1613%0aupdate_time=1999-03-2 |
---|
208 | 3-20:32:17.148%0avalue=queue=holdall 0%25250aprinting_aborted=0x0%25250aprinting |
---|
209 | _disabled=0x0%25250aspooling_disabled=0x0%25250a%250a%0a |
---|
210 | </PRE> |
---|
211 | </CODE></BLOCKQUOTE> |
---|
212 | <P>The following keys are used: |
---|
213 | <OL> |
---|
214 | <LI>dump<BR> |
---|
215 | A status dump of the current contents of a print queue.</LI> |
---|
216 | </OL> |
---|
217 | <P>Each message has a set of headers and a value. |
---|
218 | For example, |
---|
219 | the decoded dump message from the previous section would be: |
---|
220 | <BLOCKQUOTE><CODE> |
---|
221 | <PRE> |
---|
222 | host=astart4.astart.com |
---|
223 | printer=t1 |
---|
224 | process=1613 |
---|
225 | update_time=1999-03-23-20:32:17.148 |
---|
226 | value=queue=holdall 0%250aprinting_aborted=0x0%250aprinting_disabled=0x0%250aspo |
---|
227 | oling_disabled=0x0%250a%0a |
---|
228 | </PRE> |
---|
229 | </CODE></BLOCKQUOTE> |
---|
230 | <P>Each line consists of a key and a value. |
---|
231 | The |
---|
232 | <CODE>host</CODE> key indicates the host name, |
---|
233 | <CODE>printer</CODE> is the print queue, |
---|
234 | <CODE>process</CODE> is the process which generated the report or action, |
---|
235 | <CODE>update_time</CODE> is the time at which the report was generated, |
---|
236 | and |
---|
237 | <CODE>value</CODE> is the value of the report. |
---|
238 | <P>The decoded <CODE>value</CODE> of the above report is: |
---|
239 | <BLOCKQUOTE><CODE> |
---|
240 | <PRE> |
---|
241 | queue='holdall 0%0aprinting_aborted=0x0%0aprinting_disabled=0x0%0aspooling_dis |
---|
242 | abled=0x0%0a |
---|
243 | </PRE> |
---|
244 | </CODE></BLOCKQUOTE> |
---|
245 | <P>The <CODE>queue</CODE> key provides the current value of the queue control file. |
---|
246 | <H3>Dump Messages</H3> |
---|
247 | |
---|
248 | <P>Dump messages are generated at the start of operations, |
---|
249 | and consist of a list of queue status messages. |
---|
250 | <H3>LPD Messages</H3> |
---|
251 | |
---|
252 | <P>These are used to indicate LPD startup or change in operation. |
---|
253 | <BLOCKQUOTE><CODE> |
---|
254 | <PRE> |
---|
255 | Decode: lpd=host=astart4.astart.com%0aprocess=1672%0aupdate_time=1999-03-23-20:5 |
---|
256 | 1:10.507%0avalue=Starting%0a |
---|
257 | host=astart4.astart.com |
---|
258 | process=1672 |
---|
259 | update_time=1999-03-23-20:51:10.507 |
---|
260 | value=Starting |
---|
261 | lpd: 'Starting' |
---|
262 | </PRE> |
---|
263 | </CODE></BLOCKQUOTE> |
---|
264 | <H3>Job Status Messages - UPDATE</H3> |
---|
265 | |
---|
266 | <P>Update messages are used to report changes in the queue contents, |
---|
267 | such as job arrival. |
---|
268 | <BLOCKQUOTE><CODE> |
---|
269 | <PRE> |
---|
270 | Decode: update=host=astart4.astart.com%0aidentifier=papowell@astart4+676%0anumbe |
---|
271 | ... |
---|
272 | host=astart4.astart.com |
---|
273 | identifier=papowell@astart4+676 |
---|
274 | number=676 |
---|
275 | printer=t1 |
---|
276 | process=1677 |
---|
277 | update_time=1999-03-23-20:51:17.197 |
---|
278 | value=bnrname=papowell%0acf_esc_image=Apapowell@astart4+676%250aCA%250aD1999-03- |
---|
279 | ... |
---|
280 | </PRE> |
---|
281 | </CODE></BLOCKQUOTE> |
---|
282 | <P>This update message reports the arrival of a new job at the queue. |
---|
283 | The <CODE>value</CODE> field reports the control file contents: |
---|
284 | <BLOCKQUOTE><CODE> |
---|
285 | <PRE> |
---|
286 | cf_esc_image=Apapowell@astart4+676%0aCA%0aD1999-03-23-20:51:17.151%0aHastart4.as |
---|
287 | tart.com%0aJ/tmp/hi%0aLpapowell%0aPpapowell%0aQt1%0aN/tmp/hi%0afdfA676astart4.as |
---|
288 | tart.com%0aUdfA676astart4.astart.com%0a |
---|
289 | class=A |
---|
290 | date=1999-03-23-20:51:17.151 |
---|
291 | file_hostname=astart4.astart.com |
---|
292 | fromhost=astart4.astart.com |
---|
293 | held=0x0 |
---|
294 | hf_name=/var/tmp/LPD/t1/hfA676 |
---|
295 | hold_class=0x0 |
---|
296 | hold_time=0x0 |
---|
297 | identifier=papowell@astart4+676 |
---|
298 | job_time=0x36f86f45 |
---|
299 | jobname=/tmp/hi |
---|
300 | logname=papowell |
---|
301 | number=676 |
---|
302 | priority=A |
---|
303 | queuename=t1 |
---|
304 | size=3 |
---|
305 | transfername=cfA676astart4.astart.com |
---|
306 | update_time=1999-03-23-20:51:17.187 |
---|
307 | </PRE> |
---|
308 | </CODE></BLOCKQUOTE> |
---|
309 | <P>The <CODE>update_time</CODE> field in the section above is the time that the |
---|
310 | job information was last updated. |
---|
311 | The <CODE>cf_esc_image</CODE> value is the URL escaped control file information. |
---|
312 | <H3>Printer Status Messages - PRSTATUS </H3> |
---|
313 | |
---|
314 | <P>These messages report printing or other activity related to a job. |
---|
315 | <BLOCKQUOTE><CODE> |
---|
316 | <PRE> |
---|
317 | Decode: prstatus=host=astart4.astart.com%0aidentifier=papowell@astart4+676%0anum |
---|
318 | ber=676%0aprinter=t1%0aprocess=1692%0aupdate_time=1999-03-23-21:02:04.855%0avalu |
---|
319 | e=finished 'papowell@astart4+676'%252c status 'JSUCC'%0a |
---|
320 | |
---|
321 | host=astart4.astart.com |
---|
322 | identifier=papowell@astart4+676 |
---|
323 | number=676 |
---|
324 | printer=t1 |
---|
325 | process=1692 |
---|
326 | update_time=1999-03-23-21:02:04.855 |
---|
327 | value=finished 'papowell@astart4+676'%2c status 'JSUCC' |
---|
328 | PRSTATUS: 'finished 'papowell@astart4+676', status 'JSUCC'' |
---|
329 | </PRE> |
---|
330 | </CODE></BLOCKQUOTE> |
---|
331 | <H2><A NAME="mail"></A> <A NAME="allowuserlogging"></A> <A NAME="ss17.7">17.7 LPR -mhost%port and user logging support</A> |
---|
332 | </H2> |
---|
333 | |
---|
334 | <P>The <CODE>lpr -m</CODE> option is used to request that <CODE>lpd</CODE> |
---|
335 | send mail to the user when a job has completed. |
---|
336 | LPRng extends this to allow mail addresses of the form |
---|
337 | <CODE> host[%port][/(TCP|UPD)]</CODE> to request that logging information |
---|
338 | be sent to the user as well. |
---|
339 | <P>The administrator should be aware that this is a possible security loophole, |
---|
340 | and that the |
---|
341 | <CODE>allow_user_logging</CODE> |
---|
342 | flag must be enabled to |
---|
343 | allow this operation. |
---|
344 | <HR> |
---|
345 | <A HREF="LPRng-HOWTO-18.html">Next</A> |
---|
346 | <A HREF="LPRng-HOWTO-16.html">Previous</A> |
---|
347 | <A HREF="LPRng-HOWTO.html#toc17">Contents</A> |
---|
348 | </BODY> |
---|
349 | </HTML> |
---|