Debian Codegraph @

debian/patches/extra_innreport

raw
1 --- /dev/null
2 +++ b/extra/etc/innreport.conf
3 @@ -0,0 +1,2458 @@
4 +##########################################################
5 +# Configuration file for innreport (3.*).
6 +#
7 +# Sample file for INN.
8 +# Tested with INN 2.3, 2.1, 1.7.2 and 1.5.1.
9 +#
10 +# (c) 1997, 1998, 1999 by Fabien Tassin <[email protected]>
11 +# version 3.0.2
12 +##########################################################
13 +
14 +# Default parameters
15 +section default {
16 + libpath "/usr/lib/news";
17 + logpath "/var/log/news";
18 + unknown true; # want unknown entries.
19 + max_unknown 50; # max unknown entries to display.
20 + casesensitive true;
21 + module "innreport_inn"; # ${libpath}/${module}.pm
22 + unwanted_log "unwanted.log"; # ${logpath}/${unwanted_log}
23 + text true;
24 + html false;
25 + graph true; # need 'html'
26 + archive true; # use false to keep only the latest HTML report.
27 + index "index.html"; # name of the HTML index file.
28 + # html_dir "/var/www/News/stats";
29 + img_dir "pics"; # images will go to ${html_dir}/${img_dir}
30 + cycle 30; # use a number or 'none'.
31 + separator "."; # use a valid filename character.
32 + title "Daily Usenet report";
33 + # title "Daily Usenet report for <A HREF=\"/stat/\">news.y.z</A>";
34 + # footer "Local contact: <A HREF=\"mailto:[email protected]\">[email protected]</A>";
35 + # html_body "BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"";
36 + # html_header_file "header.html"; # ${html_dir}/${html_header_file}
37 + # html_footer_file "footer.html"; # ${html_dir}/${html_footer_file}
38 + graph_width 550; # graph width (in pixels)
39 + transparent true; # graph background transparent ?
40 + graph_fg "#000000"; # graph foreground color.
41 + graph_bg "#FFFFFF"; # graph background color.
42 +};
43 +
44 +###########################################################################
45 +# Index page
46 +section index {
47 + column {
48 + title "Dates";
49 + value "date";
50 + };
51 + column {
52 + title "Incoming feeds";
53 + name "Offered|Accepted|Volume";
54 + value "total(%innd_offered) | total(%innd_accepted) |
55 + bytes(total(%inn_flow_size))";
56 + };
57 + column {
58 + title "Outgoing feeds";
59 + name "Offered|Accepted|Volume";
60 + value "total(%innfeed_offered) + total(%nntplink_offered) +
61 + total(%innxmit_offered) | total(%innfeed_accepted) +
62 + total(%nntplink_accepted) + total(%innxmit_accepted) |
63 + bytes(total(%innfeed_accepted_size) +
64 + total(%innfeed_rejected_size) +
65 + total(%innxmit_bytes) +
66 + total(%innxmit_accepted_size) +
67 + total(%innxmit_rejected_size))";
68 + };
69 + graph {
70 + title "Incoming feeds";
71 + value val1;
72 + color "#FFFFCE";
73 + unit "art";
74 + data {
75 + name "Offered";
76 + color "#50A0D0";
77 + value "val2"; # Incoming feeds: Offered
78 + };
79 + data {
80 + name "Accepted";
81 + color "#0000FF";
82 + value "val3"; # Incoming feeds: Accepted
83 + };
84 + };
85 + graph {
86 + title "Outgoing feeds";
87 + value val1;
88 + color "#FFFFCE";
89 + unit "art";
90 + data {
91 + name "Offered";
92 + color "#50A0D0";
93 + value "val5"; # Outgoing feeds: Offered
94 + };
95 + data {
96 + name "Accepted";
97 + color "#0000FF";
98 + value "val6"; # Outgoing feeds: Accepted
99 + };
100 + };
101 + graph {
102 + title "Bandwidth";
103 + value val1;
104 + color "#FFFFCE";
105 + unit "Kb";
106 + data {
107 + name "Incoming";
108 + color "#50A0D0";
109 + value "byte(val4)"; # Incoming feeds: Volume
110 + };
111 + data {
112 + name "Outgoing";
113 + color "#0000FF";
114 + value "byte(val7)"; # Outgoing feeds: Volume
115 + };
116 + };
117 +};
118 +
119 +###########################################################################
120 +# Report
121 +
122 +section prog_type {
123 + # skip true; # used to skip a section.
124 + title "Log entries by program:";
125 + data "%prog_type";
126 + sort "$prog_type{$b} <=> $prog_type{$a}";
127 + # text false; # to skip this section in the text report
128 + # html false; # to skip this section in the HTML report
129 + column {
130 + name "Program name";
131 + format "%-46.46s";
132 + value "$key";
133 + format_total "TOTAL: %-39.39s";
134 + total "$num";
135 + };
136 + column {
137 + name "Lines";
138 + format_name "%7s";
139 + format "%7d";
140 + # text false; # to skip this column in the text report
141 + value "$prog_type{$key}";
142 + total "total(%prog_type)";
143 + };
144 + column {
145 + name "%Lines";
146 + format_name "%7s";
147 + format "%6.1f%%";
148 + # html false; # to skip this column in the HTML report
149 + value "$prog_type{$key} / total(%prog_type) * 100";
150 + total "100";
151 + };
152 + column {
153 + name "Size";
154 + format "%9s";
155 + value "bytes($prog_size{$key})";
156 + total "bytes(total(%prog_size))";
157 + };
158 + column {
159 + name "%Size";
160 + format_name "%6s";
161 + format "%5.1f%%";
162 + value "$prog_size{$key} / total(%prog_size) * 100";
163 + total "100";
164 + };
165 +};
166 +
167 +# INN 2.*
168 +section innd_his {
169 + title "History cache:";
170 + data "%innd_his";
171 + sort "$innd_his{$b} <=> $innd_his{$a}";
172 + column {
173 + name "Reason";
174 + format "%-57.57s";
175 + value "$key";
176 + format_total "TOTAL: %-50.50s";
177 + total "$num";
178 + };
179 + column {
180 + name "Count";
181 + format_name "%10s";
182 + format "%10d";
183 + value "$innd_his{$key}";
184 + total "total(%innd_his)";
185 + };
186 + column {
187 + name "%Count";
188 + format_name "%10s";
189 + format "%9.1f%%";
190 + value "100 * $innd_his{$key} / total(%innd_his)";
191 + total "100";
192 + };
193 +};
194 +
195 +# INN 1.*
196 +section innd_cache {
197 + title "History cache:";
198 + data "%innd_cache";
199 + sort "$innd_cache{$b} <=> $innd_cache{$a}";
200 + column {
201 + name "Reason";
202 + format "%-57.57s";
203 + value "$key";
204 + format_total "TOTAL: %-50.50s";
205 + total "$num";
206 + };
207 + column {
208 + name "Count";
209 + format_name "%10s";
210 + format "%10d";
211 + value "$innd_cache{$key}";
212 + total "total(%innd_cache)";
213 + };
214 + column {
215 + name "%Count";
216 + format_name "%10s";
217 + format "%9.1f%%";
218 + value "100 * $innd_cache{$key} / total(%innd_cache)";
219 + total "100";
220 + };
221 +};
222 +
223 +section innd_timer {
224 + title "INND timer:";
225 + data "%innd_time_time";
226 + column {
227 + name "Code region";
228 + format "%-15.15s";
229 + value "$key";
230 + format_total "TOTAL: %-8.8s";
231 + total "time_ms($innd_time_times)";
232 + };
233 + column {
234 + name "Time";
235 + format "%13s";
236 + value "time_ms($innd_time_time{$key})";
237 + total "time_ms(total(%innd_time_time))";
238 + };
239 + column {
240 + name "Pct";
241 + format_name "%6s";
242 + format "%5.1f%%";
243 + value "100 * $innd_time_time{$key} / $innd_time_times";
244 + total "100 * total(%innd_time_time) /
245 + $innd_time_times";
246 + };
247 + column {
248 + name "Invoked";
249 + format "%10s";
250 + value "$innd_time_num{$key}";
251 + format_total "%9s-";
252 + total "";
253 + };
254 + column {
255 + name "Min(ms)";
256 + format_name "%9s";
257 + format "%9.3f";
258 + value "$innd_time_min{$key}";
259 + format_total "%8s-";
260 + total "";
261 + };
262 + column {
263 + name "Avg(ms)";
264 + format_name "%10s";
265 + format "%10.3f";
266 + value "$innd_time_time{$key} /
267 + ($innd_time_num{$key} ? $innd_time_num{$key} : 1)";
268 + format_total "%9s-";
269 + total "";
270 + };
271 + column {
272 + name "Max(ms)";
273 + format_name "%10s";
274 + format "%10.3f";
275 + value "$innd_time_max{$key}";
276 + format_total "%9s-";
277 + total "";
278 + };
279 +};
280 +
281 +section innfeed_timer {
282 + title "INNfeed timer:";
283 + data "%innfeed_time_time";
284 + column {
285 + name "Code region";
286 + format "%-15.15s";
287 + value "$key";
288 + format_total "TOTAL: %-8.8s";
289 + total "time_ms($innfeed_time_times)";
290 + };
291 + column {
292 + name "Time";
293 + format "%13s";
294 + value "time_ms($innfeed_time_time{$key})";
295 + total "time_ms(total(%innfeed_time_time))";
296 + };
297 + column {
298 + name "Pct";
299 + format_name "%6s";
300 + format "%5.1f%%";
301 + value "100 * $innfeed_time_time{$key} / $innfeed_time_times";
302 + total "100 * total(%innfeed_time_time) /
303 + $innfeed_time_times";
304 + };
305 + column {
306 + name "Invoked";
307 + format "%10s";
308 + value "$innfeed_time_num{$key}";
309 + format_total "%9s-";
310 + total "";
311 + };
312 + column {
313 + name "Min(ms)";
314 + format_name "%9s";
315 + format "%9.3f";
316 + value "$innfeed_time_min{$key}";
317 + format_total "%8s-";
318 + total "";
319 + };
320 + column {
321 + name "Avg(ms)";
322 + format_name "%10s";
323 + format "%10.3f";
324 + value "$innfeed_time_time{$key} /
325 + ($innfeed_time_num{$key} ? $innfeed_time_num{$key} : 1)";
326 + format_total "%9s-";
327 + total "";
328 + };
329 + column {
330 + name "Max(ms)";
331 + format_name "%10s";
332 + format "%10.3f";
333 + value "$innfeed_time_max{$key}";
334 + format_total "%9s-";
335 + total "";
336 + };
337 +};
338 +
339 +section nnrpd_timer {
340 + title "nnrpd timer:";
341 + data "%nnrpd_time_time";
342 + column {
343 + name "Code region";
344 + format "%-15.15s";
345 + value "$key";
346 + format_total "TOTAL: %-8.8s";
347 + total "time_ms($nnrpd_time_times)";
348 + };
349 + column {
350 + name "Time";
351 + format "%13s";
352 + value "time_ms($nnrpd_time_time{$key})";
353 + total "time_ms(total(%nnrpd_time_time))";
354 + };
355 + column {
356 + name "Pct";
357 + format_name "%6s";
358 + format "%5.1f%%";
359 + value "100 * $nnrpd_time_time{$key} / $nnrpd_time_times";
360 + total "100 * total(%nnrpd_time_time) /
361 + $nnrpd_time_times";
362 + };
363 + column {
364 + name "Invoked";
365 + format "%10s";
366 + value "$nnrpd_time_num{$key}";
367 + format_total "%9s-";
368 + total "";
369 + };
370 + column {
371 + name "Min(ms)";
372 + format_name "%9s";
373 + format "%9.3f";
374 + value "$nnrpd_time_min{$key}";
375 + format_total "%8s-";
376 + total "";
377 + };
378 + column {
379 + name "Avg(ms)";
380 + format_name "%10s";
381 + format "%10.3f";
382 + value "$nnrpd_time_time{$key} /
383 + ($nnrpd_time_num{$key} ? $nnrpd_time_num{$key} : 1)";
384 + format_total "%9s-";
385 + total "";
386 + };
387 + column {
388 + name "Max(ms)";
389 + format_name "%10s";
390 + format "%10.3f";
391 + value "$nnrpd_time_max{$key}";
392 + format_total "%9s-";
393 + total "";
394 + };
395 +};
396 +
397 +section innd_control {
398 + title "Control commands to INND:";
399 + data "%innd_control";
400 + column {
401 + name "Command";
402 + format "%-71.71s";
403 + value "$key";
404 + format_total "TOTAL: %-64.64s";
405 + total "$num";
406 + };
407 + column {
408 + name "Number";
409 + format_name "%7s";
410 + value "$innd_control{$key}";
411 + format "%7d";
412 + total "total(%innd_control)";
413 + };
414 +};
415 +
416 +section innd_newgroup {
417 + title "Newsgroups created:";
418 + data "%innd_newgroup";
419 + column {
420 + name "Group";
421 + format "%-71.71s";
422 + value "$key";
423 + format_total "TOTAL%-66.66s";
424 + total "";
425 + };
426 + column {
427 + name "Mode";
428 + value "$innd_newgroup{$key}";
429 + format "%7s";
430 + total "$num";
431 + };
432 +};
433 +
434 +section innd_changegroup {
435 + title "Newsgroups changed:";
436 + data "%innd_changegroup";
437 + column {
438 + name "Group";
439 + format "%-68.68s";
440 + value "$key";
441 + format_total "TOTAL%-63.63s";
442 + total "";
443 + };
444 + column {
445 + name "New mode";
446 + format "%10s";
447 + value "$innd_changegroup{$key}";
448 + total "$num";
449 + };
450 +};
451 +
452 +section innd_rmgroup {
453 + title "Newsgroups removed:";
454 + data "%innd_rmgroup";
455 + column {
456 + name "Group";
457 + format "%-78.78s";
458 + value "$key";
459 + format_total "TOTAL: %-71.71s";
460 + total "$num";
461 + };
462 +};
463 +
464 +section controlchan {
465 + title "Control Channel:";
466 + data "%controlchan_who";
467 + column {
468 + name "Sender";
469 + format "%-25.25s";
470 + value "$key";
471 + format_total "TOTAL%-20.20s";
472 + total "";
473 + };
474 + column {
475 + name "newgroup";
476 + value "$controlchan_new{$key}";
477 + format "%8s";
478 + total "total(%controlchan_new)";
479 + };
480 + column {
481 + name "rmgroup";
482 + value "$controlchan_rm{$key}";
483 + format "%8s";
484 + total "total(%controlchan_rm)";
485 + };
486 + column {
487 + name "Other";
488 + value "$controlchan_other{$key}";
489 + format "%8s";
490 + total "total(%controlchan_other)";
491 + };
492 + column {
493 + name "Bad PGP";
494 + value "$controlchan_skippgp{$key}";
495 + format "%8s";
496 + total "total(%controlchan_skippgp)";
497 + };
498 + column {
499 + name "DoIt";
500 + value "$controlchan_doit{$key}";
501 + format "%8s";
502 + total "total(%controlchan_doit)";
503 + };
504 + column {
505 + name "OK";
506 + value "$controlchan_ok{$key}";
507 + format "%8s";
508 + total "total(%controlchan_ok)";
509 + };
510 +};
511 +
512 +section innd_connect {
513 + title "Incoming Feeds (INN):";
514 + data "%innd_seconds";
515 + sort "$innd_accepted{$b} <=> $innd_accepted{$a}";
516 + numbering true;
517 + column {
518 + name "Server";
519 + format_name "%-21.21s";
520 + format "%-24.24s";
521 + value "$key";
522 + format_total "TOTAL: %-17.17s";
523 + total "$num";
524 + };
525 + column {
526 + name "Connects";
527 + format_name "%5s";
528 + format "%5d";
529 + value "$innd_connect{$key}";
530 + total "total(%innd_connect)";
531 + };
532 + column {
533 + name "Offered";
534 + format_name "%8s";
535 + format "%8d";
536 + value "$innd_offered{$key}";
537 + total "total(%innd_offered)";
538 + };
539 + column {
540 + name "Taken";
541 + format_name "%7s";
542 + format "%7d";
543 + value "$innd_accepted{$key}";
544 + total "total(%innd_accepted)";
545 + };
546 + column {
547 + name "Refused";
548 + format_name "%7s";
549 + format "%7d";
550 + value "$innd_refused{$key}";
551 + total "total(%innd_refused)";
552 + };
553 + column {
554 + name "Reject";
555 + format_name "%7s";
556 + format "%7d";
557 + value "$innd_rejected{$key}";
558 + total "total(%innd_rejected)";
559 + };
560 + column {
561 + name "%Accpt";
562 + format_name "%6s";
563 + format "%4d%%";
564 + value "$innd_offered{$key} == 0 ? 0 :
565 + $innd_accepted{$key} / $innd_offered{$key} * 100";
566 + total "total(%innd_offered) == 0 ? 0 :
567 + total(%innd_accepted) / total(%innd_offered) * 100";
568 + };
569 + column {
570 + name "Elapsed";
571 + format_name "%8s";
572 + format "%9s";
573 + value "time($innd_seconds{$key})";
574 + total "time(total(%innd_seconds))";
575 + };
576 + graph {
577 + title "Articles received by server";
578 + type histo3d;
579 + sort "%innd_accepted";
580 + data {
581 + name "Articles accepted";
582 + color "#0000FF";
583 + value "%innd_accepted";
584 + };
585 + data {
586 + name "Articles refused";
587 + color "#FFAF00";
588 + value "%innd_refused";
589 + };
590 + data {
591 + name "Articles rejected";
592 + color "#FF0000";
593 + value "%innd_rejected";
594 + };
595 + };
596 +};
597 +
598 +section innd_incoming_vol {
599 + title "Incoming Volume (INN):";
600 + data "%innd_seconds";
601 + sort "$innd_stored_size{$b} <=> $innd_stored_size{$a}";
602 + numbering true;
603 + column {
604 + name "Server";
605 + format "%-24.24s";
606 + value "$key";
607 + format_total "TOTAL: %-17.17s";
608 + total "$num";
609 + };
610 + column {
611 + name "AcceptVol";
612 + format "%9s";
613 + value "bytes($innd_stored_size{$key})";
614 + total "bytes(total(%innd_stored_size))";
615 + };
616 + column {
617 + name "DupVol";
618 + format "%9s";
619 + value "bytes($innd_duplicated_size{$key})";
620 + total "bytes(total(%innd_duplicated_size))";
621 + };
622 + column {
623 + name "TotalVol";
624 + format "%9s";
625 + value "bytes($innd_stored_size{$key} +
626 + $innd_duplicated_size{$key})";
627 + total "bytes(total(%innd_stored_size) +
628 + total(%innd_duplicated_size))";
629 + };
630 + column {
631 + name "%Acc";
632 + format_name "%4s";
633 + format "%3d%%";
634 + value "$innd_offered_size{$key} == 0 ? 0 :
635 + $innd_stored_size{$key} / $innd_offered_size{$key} * 100";
636 + total "total(%innd_offered_size) == 0 ? 0 :
637 + total(%innd_stored_size) / total(%innd_offered_size) * 100";
638 + };
639 + column {
640 + name "Vol/Art";
641 + format "%9s";
642 + value "bytes(($innd_stored_size{$key} +
643 + $innd_duplicated_size{$key}) /
644 + ($innd_accepted{$key} +
645 + $innd_rejected{$key}))";
646 + total "bytes((total(%innd_stored_size) +
647 + total(%innd_duplicated_size)) /
648 + (total(%innd_accepted) +
649 + total(%innd_rejected)))";
650 + };
651 + column {
652 + name "Elapsed";
653 + format "%9s";
654 + value "time($innd_seconds{$key})";
655 + total "time(total(%innd_seconds))";
656 + };
657 + graph {
658 + title "Incoming Volume received by server";
659 + type histo3d;
660 + sort "%innd_stored_size";
661 + data {
662 + name "Accepted Volume";
663 + color "#0000FF";
664 + value "%innd_stored_size";
665 + };
666 + data {
667 + name "Duplicated Volume";
668 + color "#FFAF00";
669 + value "%innd_duplicated_size";
670 + };
671 + };
672 +};
673 +
674 +section inn_flow {
675 + title "Incoming articles:";
676 + data "%inn_flow";
677 + sort "&DateCompare";
678 + column {
679 + name "Date";
680 + format "%-27.27s";
681 + value "$key";
682 + format_total "TOTAL: %-20.20s";
683 + total "time(total(%inn_flow_time))";
684 + };
685 + column {
686 + name "Articles";
687 + format_name "%8s";
688 + value "$inn_flow{$key}";
689 + format "%8d";
690 + total "total(%inn_flow)";
691 + };
692 + column {
693 + name "%Arts";
694 + format_name "%8s";
695 + value "$inn_flow{$key} / $inn_flow_total * 100";
696 + format "%7.1f%%";
697 + total "100";
698 + };
699 + column {
700 + name "Art/sec";
701 + format_name "%7s";
702 + value "$inn_flow{$key} / $inn_flow_time{$key}";
703 + format "%7.2f";
704 + total "total(%inn_flow) / total(%inn_flow_time)";
705 + };
706 + column {
707 + name "Size";
708 + value "bytes($inn_flow_size{$key})";
709 + format "%9s";
710 + total "bytes(total(%inn_flow_size))";
711 + };
712 + column {
713 + name "%Size";
714 + format_name "%7s";
715 + value "$inn_flow_size{$key} /
716 + total(%inn_flow_size) * 100";
717 + format "%6.1f%%";
718 + total "100";
719 + };
720 + column {
721 + name "KB/sec";
722 + format_name "%7s";
723 + value "$inn_flow_size{$key} /
724 + $inn_flow_time{$key} / 1024";
725 + format "%7.2f";
726 + total "total(%inn_flow_size) /
727 + total(%inn_flow_time) / 1024";
728 + };
729 + graph {
730 + title "Incoming articles";
731 + type histo;
732 + data {
733 + name "Hours";
734 + value "%inn_flow_labels";
735 + };
736 + data {
737 + name "Art/sec";
738 + factor 3600;
739 + value "%inn_flow";
740 + };
741 + };
742 + graph {
743 + title "Incoming articles (size)";
744 + type histo;
745 + data {
746 + name "Hours";
747 + value "%inn_flow_labels";
748 + };
749 + data {
750 + name "Kb/sec";
751 + factor 3686400; # 3600 * 1024
752 + value "%inn_flow_size";
753 + };
754 + };
755 +};
756 +
757 +section cnfsstat {
758 + title "CNFS buffer status:";
759 + data "%cnfsstat";
760 + column {
761 + name "Buffer";
762 + format "%-13.13s";
763 + value "$key";
764 + format_total "TOTAL: %-6.6s";
765 + total "$num";
766 + };
767 + column {
768 + name "Class";
769 + format "%-13.13s";
770 + value "$cnfsstat{$key}";
771 + format_total "-%12s";
772 + total "";
773 + };
774 + column {
775 + name "Size";
776 + format "%9s";
777 + value "bytes($cnfsstat_size{$key})";
778 + total "bytes(total(%cnfsstat_size))";
779 + };
780 + column {
781 + name "Used";
782 + format "%9s";
783 + value "bytes($cnfsstat_used{$key})";
784 + total "bytes(total(%cnfsstat_used))";
785 + };
786 + column {
787 + name "%Used";
788 + format_name "%7s";
789 + value "$cnfsstat_used{$key} /
790 + $cnfsstat_size{$key} * 100";
791 + format "%6.1f%%";
792 + total "total(%cnfsstat_used) /
793 + total(%cnfsstat_size) * 100";
794 + };
795 + column {
796 + name "Cycles";
797 + format_name "%6s";
798 + format "%6d";
799 + value "$cnfsstat_cycles{$key}";
800 + total "total(%cnfsstat_cycles)";
801 + };
802 + column {
803 + name "KB/sec";
804 + format_name "%7s";
805 + value "$cnfsstat_rate{$key} /
806 + $cnfsstat_samples{$key} / 1024";
807 + format "%7.2f";
808 + total "total(%cnfsstat_rate) /
809 + total(%cnfsstat_samples) / 1024";
810 + };
811 + column {
812 + name "Days";
813 + format_name "%8s";
814 + value "$cnfsstat_size{$key} /
815 + ($cnfsstat_rate{$key} /
816 + $cnfsstat_samples{$key}) / 86400";
817 + format "%8.2f";
818 + format_total "%7s-";
819 + total "";
820 + };
821 +};
822 +
823 +section inn_unwanted {
824 + title "Sites sending bad articles:";
825 + data "%inn_badart";
826 + sort "$inn_badart{$b} <=> $inn_badart{$a}";
827 + numbering true;
828 + column {
829 + name "Server";
830 + format "%-23.23s";
831 + value "$key";
832 + format_total "TOTAL: %-16.16s";
833 + total "$num";
834 + };
835 + column {
836 + name "Total";
837 + format_name "%6s";
838 + format "%6d";
839 + value "$inn_badart{$key}";
840 + total "total(%inn_badart)";
841 + };
842 + column {
843 + name "Group";
844 + format_name "%6s";
845 + format "%6d";
846 + value "$inn_uw_ng_s{$key}";
847 + total "total(%inn_uw_ng_s)";
848 + };
849 + column {
850 + name "Dist";
851 + format_name "%5s";
852 + format "%5d";
853 + value "$inn_uw_dist_s{$key}";
854 + total "total(%inn_uw_dist_s)";
855 + };
856 + column {
857 + name "Duplic";
858 + format_name "%6s";
859 + format "%6d";
860 + value "$inn_duplicate{$key}";
861 + total "total(%inn_duplicate)";
862 + };
863 + column {
864 + name "Unapp";
865 + format_name "%5s";
866 + format "%5d";
867 + value "$inn_unapproved{$key}";
868 + total "total(%inn_unapproved)";
869 + };
870 + column {
871 + name "TooOld";
872 + format_name "%6s";
873 + format "%6d";
874 + value "$inn_tooold{$key}";
875 + total "total(%inn_tooold)";
876 + };
877 + column {
878 + name "Site";
879 + format_name "%4s";
880 + format "%4d";
881 + value "$inn_uw_site{$key}";
882 + total "total(%inn_uw_site)";
883 + };
884 + column {
885 + name "Line";
886 + format_name "%4s";
887 + format "%4d";
888 + value "$inn_linecount{$key}";
889 + total "total(%inn_linecount)";
890 + };
891 + column {
892 + name "Other";
893 + format_name "%5s";
894 + format "%5d";
895 + value "$innd_others{$key}";
896 + total "total(%innd_others)";
897 + };
898 +};
899 +
900 +section inn_unwanted_group {
901 + title "Unwanted newsgroups:";
902 + top 20; # default 'top' value or use 'top_text' and 'top_html'
903 + # to specify different values for text and HTML reports.
904 + data "%inn_uw_ng";
905 + sort "$inn_uw_ng{$b} <=> $inn_uw_ng{$a}";
906 + column {
907 + name "Newsgroup";
908 + format "%-71.71s";
909 + value "$key";
910 + format_total "TOTAL: %-64.64s";
911 + total "$num";
912 + };
913 + column {
914 + name "Count";
915 + format_name "%7s";
916 + format "%7d";
917 + value "$inn_uw_ng{$key}";
918 + total "total(%inn_uw_ng)";
919 + };
920 +};
921 +
922 +section inn_unwanted_dist {
923 + title "Unwanted distributions:";
924 + top 20;
925 + data "%inn_uw_dist";
926 + sort "$inn_uw_dist{$b} <=> $inn_uw_dist{$a}";
927 + column {
928 + name "Distribution";
929 + format "%-71.71s";
930 + value "$key";
931 + format_total "TOTAL: %-64.64s";
932 + total "$num";
933 + };
934 + column {
935 + name "Count";
936 + format_name "%7s";
937 + format "%7d";
938 + value "$inn_uw_dist{$key}";
939 + total "total(%inn_uw_dist)";
940 + };
941 +};
942 +
943 +section inn_unwanted_unapp {
944 + title "Supposedly-moderated groups with unmoderated postings:";
945 + top 20;
946 + data "%inn_unapproved_g";
947 + sort "$inn_unapproved_g{$b} <=> $inn_unapproved_g{$a}";
948 + column {
949 + name "Groups";
950 + format "%-71.71s";
951 + value "$key";
952 + format_total "TOTAL: %-64.64s";
953 + total "$num";
954 + };
955 + column {
956 + name "Count";
957 + format_name "%7s";
958 + format "%7d";
959 + value "$inn_unapproved_g{$key}";
960 + total "total(%inn_unapproved_g)";
961 + };
962 +};
963 +
964 +section inn_unwanted_path {
965 + title "Unwanted sites in Path:";
966 + top 20;
967 + data "%inn_site_path";
968 + sort "$inn_site_path{$b} <=> $inn_site_path{$a}";
969 + column {
970 + name "Site";
971 + format "%-71.71s";
972 + value "$key";
973 + format_total "TOTAL: %-64.64s";
974 + total "$num";
975 + };
976 + column {
977 + name "Count";
978 + format_name "%7s";
979 + format "%7d";
980 + value "$inn_site_path{$key}";
981 + total "total(%inn_site_path)";
982 + };
983 +};
984 +
985 +section innd_perl {
986 + title "INND perl filter:";
987 + top 20;
988 + data "%innd_filter_perl";
989 + sort "$innd_filter_perl{$b} <=> $innd_filter_perl{$a}";
990 + column {
991 + name "Reason";
992 + format "%-71.71s";
993 + value "$key";
994 + format_total "TOTAL: %-64.64s";
995 + total "$num";
996 + };
997 + column {
998 + name "Count";
999 + format_name "%7s";
1000 + format "%7d";
1001 + value "$innd_filter_perl{$key}";
1002 + total "total(%innd_filter_perl)";
1003 + };
1004 +};
1005 +
1006 +section nocem {
1007 + title "NoCeM on Spool:";
1008 + data "%nocem_goodsigs";
1009 + sort "$nocem_ids{$b} <=> $nocem_ids{$a}";
1010 + column {
1011 + name "Id";
1012 + format "%-47.47s";
1013 + value "$key";
1014 + format_total "TOTAL: %-40.40s";
1015 + total "$num";
1016 + };
1017 + column {
1018 + name "Good";
1019 + format "%7s";
1020 + value "$nocem_goodsigs{$key}";
1021 + total "total(%nocem_goodsigs)";
1022 + };
1023 + column {
1024 + name "Bad";
1025 + format "%7s";
1026 + value "$nocem_badsigs{$key}";
1027 + total "total(%nocem_badsigs)";
1028 + };
1029 + column {
1030 + name "Unique";
1031 + format "%7s";
1032 + value "$nocem_newids{$key}";
1033 + total "total(%nocem_newids)";
1034 + };
1035 + column {
1036 + name "Total";
1037 + format "%7s";
1038 + value "$nocem_totalids{$key}";
1039 + total "total(%nocem_totalids)";
1040 + };
1041 +};
1042 +
1043 +section innd_no_permission {
1044 + title "INND no permission servers:";
1045 + data "%innd_no_permission";
1046 + sort "$innd_no_permission{$b} <=> $innd_no_permission{$a}";
1047 + column {
1048 + name "System";
1049 + format "%-71.71s";
1050 + value "$key";
1051 + format_total "TOTAL: %-64.64s";
1052 + total "$num";
1053 + };
1054 + column {
1055 + name "Conn";
1056 + format_name "%7s";
1057 + format "%7d";
1058 + value "$innd_no_permission{$key}";
1059 + total "total(%innd_no_permission)";
1060 + };
1061 +};
1062 +
1063 +section innd_max_conn {
1064 + title "Too many incoming connections (innd):";
1065 + data "%innd_max_conn";
1066 + sort "$innd_max_conn{$b} <=> $innd_max_conn{$a}";
1067 + column {
1068 + name "Server";
1069 + format "%-70.70s";
1070 + value "$key";
1071 + format_total "TOTAL: %-63.63s";
1072 + total "$num";
1073 + };
1074 + column {
1075 + name "Conn";
1076 + format_name "%8s";
1077 + format "%8d";
1078 + value "$innd_max_conn{$key}";
1079 + total "total(%innd_max_conn)";
1080 + };
1081 +};
1082 +
1083 +section innd_too_many_connects_per_minute {
1084 + title "INND too many connects per minute:";
1085 + data "%innd_too_many_connects_per_minute";
1086 + sort "$innd_too_many_connects_per_minute{$b} <=>
1087 + $innd_too_many_connects_per_minute{$a}";
1088 + column {
1089 + name "System";
1090 + format "%-71.71s";
1091 + value "$key";
1092 + format_total "TOTAL: %-64.64s";
1093 + total "$num";
1094 + };
1095 + column {
1096 + name "Conn";
1097 + format_name "%7s";
1098 + format "%7d";
1099 + value "$innd_too_many_connects_per_minute{$key}";
1100 + total "total(%innd_too_many_connects_per_minute)";
1101 + };
1102 +};
1103 +
1104 +section innd_misc {
1105 + title "INND misc events:";
1106 + data "%innd_misc";
1107 + sort "$innd_misc{$b} <=> $innd_misc{$a}";
1108 + column {
1109 + name "Events";
1110 + format "%-71.71s";
1111 + value "$key";
1112 + format_total "TOTAL: %-64.64s";
1113 + total "$num";
1114 + };
1115 + column {
1116 + name "Count";
1117 + format_name "%7s";
1118 + format "%7d";
1119 + value "$innd_misc{$key}";
1120 + total "total(%innd_misc)";
1121 + };
1122 +};
1123 +
1124 +section innd_misc_stat {
1125 + title "Miscellaneous innd statistics:";
1126 + data "%innd_misc_stat";
1127 + sort "$innd_misc_stat{$b} <=> $innd_misc_stat{$a}";
1128 + double true;
1129 + top 10;
1130 + #numbering true;
1131 + column {
1132 + primary true;
1133 + name "Event";
1134 + format "%-69.69s";
1135 + value "$key1";
1136 + format_total "TOTAL: %-62.62s";
1137 + total "$num";
1138 + };
1139 + column {
1140 + name "Server";
1141 + format " %-67.67s";
1142 + value "$key2";
1143 + total "$num";
1144 + format_total "TOTAL: %-60.60s";
1145 + };
1146 + column {
1147 + name "Number";
1148 + format_name "%9s";
1149 + format "%9d";
1150 + value "$innd_misc_stat{$key1}{$key2}";
1151 + total "total(%innd_misc_stat)";
1152 + };
1153 +};
1154 +
1155 +section innfeed_connect {
1156 + title "Outgoing Feeds (innfeed) by Articles:";
1157 + data "%innfeed_offered";
1158 + sort "$innfeed_accepted{$b} <=> $innfeed_accepted{$a}";
1159 + numbering true;
1160 + column {
1161 + name "Server";
1162 + format "%-18.18s";
1163 + value "$key";
1164 + format_total "TOTAL: %-11.11s";
1165 + total "$num";
1166 + };
1167 + column {
1168 + name "Offered";
1169 + format_name "%7s";
1170 + format "%7d";
1171 + value "$innfeed_offered{$key}";
1172 + total "total(%innfeed_offered)";
1173 + };
1174 + column {
1175 + name "Taken";
1176 + format_name "%7s";
1177 + format "%7d";
1178 + value "$innfeed_accepted{$key}";
1179 + total "total(%innfeed_accepted)";
1180 + };
1181 + column {
1182 + name "Refused";
1183 + format_name "%7s";
1184 + format "%7d";
1185 + value "$innfeed_refused{$key}";
1186 + total "total(%innfeed_refused)";
1187 + };
1188 + column {
1189 + name "Reject";
1190 + format_name "%6s";
1191 + format "%6d";
1192 + value "$innfeed_rejected{$key}";
1193 + total "total(%innfeed_rejected)";
1194 + };
1195 + column {
1196 + name "Miss";
1197 + format_name "%6s";
1198 + format "%6d";
1199 + value "$innfeed_missing{$key}";
1200 + total "total(%innfeed_missing)";
1201 + };
1202 + column {
1203 + name "Spool";
1204 + format_name "%7s";
1205 + format "%7d";
1206 + value "$innfeed_spooled{$key}";
1207 + total "total(%innfeed_spooled)";
1208 + };
1209 + column {
1210 + name "%Took";
1211 + format_name "%5s";
1212 + format "%3d%%";
1213 + value "$innfeed_offered{$key} == 0 ? 0 :
1214 + $innfeed_accepted{$key} / $innfeed_offered{$key} * 100";
1215 + total "total(%innfeed_offered) == 0 ? 0 :
1216 + total(%innfeed_accepted) / total(%innfeed_offered) * 100";
1217 + };
1218 + column {
1219 + name "Elapsed";
1220 + format_name "%8s";
1221 + format "%9s";
1222 + value "time($innfeed_seconds{$key})";
1223 + total "time(total(%innfeed_seconds))";
1224 + };
1225 + graph {
1226 + title "Outgoing feeds (innfeed) by Articles";
1227 + type histo3d;
1228 + sort "%innfeed_accepted";
1229 + data {
1230 + name "Accepted";
1231 + color "#0000FF";
1232 + value "%innfeed_accepted";
1233 + };
1234 + data {
1235 + name "Refused";
1236 + color "#FFAF00";
1237 + value "%innfeed_refused";
1238 + };
1239 + data {
1240 + name "Rejected";
1241 + color "#FF0000";
1242 + value "%innfeed_rejected";
1243 + };
1244 + data {
1245 + name "Missing";
1246 + color "#00FF00";
1247 + value "%innfeed_missing";
1248 + };
1249 + data {
1250 + name "Spooled";
1251 + color "#AF00FF";
1252 + value "%innfeed_spooled,";
1253 + };
1254 + };
1255 +};
1256 +
1257 +section innfeed_volume {
1258 + title "Outgoing Feeds (innfeed) by Volume:";
1259 + data "%innfeed_offered";
1260 + sort "$innfeed_accepted_size{$b} <=> $innfeed_accepted_size{$a}";
1261 + numbering true;
1262 + column {
1263 + name "Server";
1264 + format "%-17.17s";
1265 + value "$key";
1266 + format_total "TOTAL: %-10.10s";
1267 + total "$num";
1268 + };
1269 + column {
1270 + name "AcceptVol";
1271 + format "%9s";
1272 + value "bytes($innfeed_accepted_size{$key})";
1273 + total "bytes(total(%innfeed_accepted_size))";
1274 + };
1275 + column {
1276 + name "RejectVol";
1277 + format "%9s";
1278 + value "bytes($innfeed_rejected_size{$key})";
1279 + total "bytes(total(%innfeed_rejected_size))";
1280 + };
1281 + column {
1282 + name "TotalVol";
1283 + format "%9s";
1284 + value "bytes($innfeed_accepted_size{$key} +
1285 + $innfeed_rejected_size{$key})";
1286 + total "bytes(total(%innfeed_accepted_size) +
1287 + total(%innfeed_rejected_size))";
1288 + };
1289 + column {
1290 + name "Volume/sec";
1291 + format_name "%11s";
1292 + format "%9s/s";
1293 + value "bytes(($innfeed_accepted_size{$key} +
1294 + $innfeed_rejected_size{$key}) /
1295 + $innfeed_seconds{$key})";
1296 + total "bytes((total(%innfeed_accepted_size) +
1297 + total(%innfeed_rejected_size)) /
1298 + total(%innfeed_seconds))";
1299 + };
1300 + column {
1301 + name "Vol/Art";
1302 + format "%9s";
1303 + value "bytes(($innfeed_accepted_size{$key} +
1304 + $innfeed_rejected_size{$key}) /
1305 + ($innfeed_accepted{$key} +
1306 + $innfeed_rejected{$key}))";
1307 + total "bytes((total(%innfeed_accepted_size) +
1308 + total(%innfeed_rejected_size)) /
1309 + (total(%innfeed_accepted) +
1310 + total(%innfeed_rejected)))";
1311 + };
1312 + column {
1313 + name "Elapsed";
1314 + format "%9s";
1315 + value "time($innfeed_seconds{$key})";
1316 + total "time(total(%innfeed_seconds))";
1317 + };
1318 + graph {
1319 + title "Outgoing feeds (innfeed) by Volume";
1320 + type histo3d;
1321 + sort "%innfeed_accepted_size";
1322 + data {
1323 + name "Accepted";
1324 + color "#0000FF";
1325 + value "%innfeed_accepted_size";
1326 + };
1327 + data {
1328 + name "Rejected";
1329 + color "#FFAF00";
1330 + value "%innfeed_rejected_size";
1331 + };
1332 + data {
1333 + name "Total";
1334 + color "#00FF00";
1335 + value "%innfeed_accepted_size +
1336 + %innfeed_rejected_size";
1337 + };
1338 + };
1339 +};
1340 +
1341 +section innfeed_shrunk {
1342 + title "Backlog files shrunk by innfeed:";
1343 + data "%innfeed_shrunk";
1344 + sort "$innfeed_shrunk{$b} <=> $innfeed_shrunk{$a}";
1345 + column {
1346 + name "Server";
1347 + format "%-70.70s";
1348 + value "$key";
1349 + format_total "TOTAL: %-63.63s";
1350 + total "$num";
1351 + };
1352 + column {
1353 + name "Size";
1354 + format "%8s";
1355 + value "bytes($innfeed_shrunk{$key})";
1356 + total "bytes(total(%innfeed_shrunk))";
1357 + };
1358 +};
1359 +
1360 +section nntplink_connect {
1361 + title "Outgoing Feeds (nntplink):";
1362 + data "%nntplink_site";
1363 + sort "$nntplink_accepted{$b} <=> $nntplink_accepted{$a}";
1364 + numbering true;
1365 + column {
1366 + name "Server";
1367 + format "%-25.25s";
1368 + value "$key";
1369 + format_total "TOTAL: %-18.18s";
1370 + total "$num";
1371 + };
1372 + column {
1373 + name "Offered";
1374 + format_name "%8s";
1375 + format "%8d";
1376 + value "$nntplink_offered{$key}";
1377 + total "total(%nntplink_offered)";
1378 + };
1379 + column {
1380 + name "Taken";
1381 + format_name "%8s";
1382 + format "%8d";
1383 + value "$nntplink_accepted{$key}";
1384 + total "total(%nntplink_accepted)";
1385 + };
1386 + column {
1387 + name "Rejected";
1388 + format_name "%8s";
1389 + format "%8d";
1390 + value "$nntplink_rejected{$key}";
1391 + total "total(%nntplink_rejected)";
1392 + };
1393 + column {
1394 + name "Failed";
1395 + format_name "%8s";
1396 + format "%8d";
1397 + value "$nntplink_failed{$key}";
1398 + total "total(%nntplink_failed)";
1399 + };
1400 + column {
1401 + name "%Accpt";
1402 + format_name "%6s";
1403 + format "%5d%%";
1404 + value "$nntplink_offered{$key} == 0 ? 0 :
1405 + $nntplink_accepted{$key} / $nntplink_offered{$key} * 100";
1406 + total "total(%nntplink_offered) == 0 ? 0 :
1407 + total(%nntplink_accepted) / total(%nntplink_offered) * 100";
1408 + };
1409 + column {
1410 + name "Elapsed";
1411 + format "%10s";
1412 + value "time($nntplink_times{$key})";
1413 + total "time(total(%nntplink_times))";
1414 + };
1415 + graph {
1416 + title "Outgoing Feeds (nntplink)";
1417 + type histo3d;
1418 + sort "%nntplink_accepted";
1419 + data {
1420 + name "Articles accepted";
1421 + color "#0000FF";
1422 + value "%nntplink_accepted";
1423 + };
1424 + data {
1425 + name "Articles rejected";
1426 + color "#FFAF00";
1427 + value "%nntplink_rejected";
1428 + };
1429 + data {
1430 + name "Articles failed";
1431 + color "#FF0000";
1432 + value "%nntplink_failed";
1433 + };
1434 + };
1435 +};
1436 +
1437 +section nntplink_connect2 {
1438 + title "Outgoing Feeds (nntplink) - other information:";
1439 + data "%nntplink_site";
1440 + sort "$nntplink_accepted{$b} <=> $nntplink_accepted{$a}";
1441 + numbering true;
1442 + column {
1443 + name "Server";
1444 + format "%-20.20s";
1445 + value "$key";
1446 + format_total "TOTAL: %-13.13s";
1447 + total "$num";
1448 + };
1449 + column {
1450 + name "Conn";
1451 + format_name "%4s";
1452 + format "%4d";
1453 + value "$nntplink_site{$key}";
1454 + total "total(%nntplink_site)";
1455 + };
1456 + column {
1457 + name "Ok";
1458 + format_name "%4s";
1459 + format "%4d";
1460 + value "$nntplink_site{$key} - ($nntplink_eof{$key} +
1461 + $nntplink_sockerr{$key} +
1462 + $nntplink_selecterr{$key} +
1463 + $nntplink_hiload{$key} + $nntplink_bpipe{$key} +
1464 + $nntplink_nospace{$key} + $nntplink_auth{$key} +
1465 + $nntplink_expire{$key} + $nntplink_fail{$key})";
1466 + total "total(%nntplink_site) - (total(%nntplink_eof) +
1467 + total(%nntplink_sockerr) +
1468 + total(%nntplink_selecterr) +
1469 + total(%nntplink_hiload) +
1470 + total(%nntplink_bpipe) +
1471 + total(%nntplink_nospace) +
1472 + total(%nntplink_auth) +
1473 + total(%nntplink_expire) +
1474 + total(%nntplink_fail))";
1475 + };
1476 + column {
1477 + name "EOF";
1478 + format_name "%3s";
1479 + format "%3d";
1480 + value "$nntplink_eof{$key}";
1481 + total "total(%nntplink_eof)";
1482 + };
1483 + column {
1484 + name "Sock";
1485 + format_name "%4s";
1486 + format "%4d";
1487 + value "$nntplink_sockerr{$key}";
1488 + total "total(%nntplink_sockerr)";
1489 + };
1490 + column {
1491 + name "Slct";
1492 + format_name "%4s";
1493 + format "%4d";
1494 + value "$nntplink_selecterr{$key}";
1495 + total "total(%nntplink_selecterr)";
1496 + };
1497 + column {
1498 + name "Load";
1499 + format_name "%4s";
1500 + format "%4d";
1501 + value "$nntplink_hiload{$key}";
1502 + total "total(%nntplink_hiload)";
1503 + };
1504 + column {
1505 + name "Bpip";
1506 + format_name "%4s";
1507 + format "%4d";
1508 + value "$nntplink_bpipe{$key}";
1509 + total "total(%nntplink_bpipe)";
1510 + };
1511 + column {
1512 + name "Spce";
1513 + format_name "%4s";
1514 + format "%4d";
1515 + value "$nntplink_nospace{$key}";
1516 + total "total(%nntplink_nospace)";
1517 + };
1518 + column {
1519 + name "Exp";
1520 + format_name "%4s";
1521 + format "%4d";
1522 + value "$nntplink_expire{$key}";
1523 + total "total(%nntplink_expire)";
1524 + };
1525 + column {
1526 + name "Auth";
1527 + format_name "%4s";
1528 + format "%4d";
1529 + value "$nntplink_auth{$key}";
1530 + total "total(%nntplink_auth)";
1531 + };
1532 + column {
1533 + name "Othr";
1534 + format_name "%4s";
1535 + format "%4d";
1536 + value "$nntplink_fail{$key}";
1537 + total "total(%nntplink_fail)";
1538 + };
1539 + column {
1540 + name "Pct";
1541 + format_name "%4s";
1542 + format "%3d%%";
1543 + value "$nntplink_site{$key} ?
1544 + 100 * ($nntplink_site{$key} -
1545 + ($nntplink_eof{$key} + $nntplink_sockerr{$key} +
1546 + $nntplink_selecterr{$key} +
1547 + $nntplink_hiload{$key} + $nntplink_bpipe{$key} +
1548 + $nntplink_nospace{$key} + $nntplink_auth{$key} +
1549 + $nntplink_expire{$key} +
1550 + $nntplink_fail{$key})) / $nntplink_site{$key} : 0";
1551 + total "total(%nntplink_site) ?
1552 + 100 * (total(%nntplink_site) -
1553 + (total(%nntplink_eof) +
1554 + total(%nntplink_sockerr) +
1555 + total(%nntplink_selecterr) +
1556 + total(%nntplink_hiload) +
1557 + total(%nntplink_bpipe) +
1558 + total(%nntplink_nospace) +
1559 + total(%nntplink_auth) +
1560 + total(%nntplink_expire) +
1561 + total(%nntplink_fail))) / total(%nntplink_site) : 0";
1562 + };
1563 +};
1564 +
1565 +section innxmit_connect {
1566 + title "Outgoing Feeds (innxmit) by Articles:";
1567 + data "%innxmit_times";
1568 + sort "$innxmit_accepted{$b} <=> $innxmit_accepted{$a}";
1569 + numbering true;
1570 + column {
1571 + name "Server";
1572 + format "%-27.27s";
1573 + value "$key";
1574 + format_total "TOTAL: %-20.20s";
1575 + total "$num";
1576 + };
1577 + column {
1578 + name "Offered";
1579 + format_name "%7s";
1580 + format "%7d";
1581 + value "$innxmit_offered{$key}";
1582 + total "total(%innxmit_offered)";
1583 + };
1584 + column {
1585 + name "Taken";
1586 + format_name "%7s";
1587 + format "%7d";
1588 + value "$innxmit_accepted{$key}";
1589 + total "total(%innxmit_accepted)";
1590 + };
1591 + column {
1592 + name "Refused";
1593 + format_name "%7s";
1594 + format "%7d";
1595 + value "$innxmit_refused{$key}";
1596 + total "total(%innxmit_refused)";
1597 + };
1598 + column {
1599 + name "Reject";
1600 + format_name "%7s";
1601 + format "%7d";
1602 + value "$innxmit_rejected{$key}";
1603 + total "total(%innxmit_rejected)";
1604 + };
1605 + column {
1606 + name "Miss";
1607 + format_name "%5s";
1608 + format "%5d";
1609 + value "$innxmit_missing{$key}";
1610 + total "total(%innxmit_rejected)";
1611 + };
1612 + column {
1613 + name "%Acc";
1614 + format_name "%4s";
1615 + format "%3d%%";
1616 + value "$innxmit_offered{$key} == 0 ? 0 :
1617 + $innxmit_accepted{$key} / $innxmit_offered{$key} * 100";
1618 + total "total(%innxmit_offered) == 0 ? 0 :
1619 + total(%innxmit_accepted) / total(%innxmit_offered) * 100";
1620 + };
1621 + column {
1622 + name "Elapsed";
1623 + format "%8s";
1624 + value "time($innxmit_times{$key})";
1625 + total "time(total(%innxmit_times))";
1626 + };
1627 + graph {
1628 + title "Outgoing Feeds (innxmit)";
1629 + type histo3d;
1630 + sort "%innxmit_accepted";
1631 + data {
1632 + name "Art. accepted";
1633 + color "#0000FF";
1634 + value "%innxmit_accepted";
1635 + };
1636 + data {
1637 + name "Art. refused";
1638 + color "#FFAF00";
1639 + value "%innxmit_refused";
1640 + };
1641 + data {
1642 + name "Art. rejected";
1643 + color "#FF0000";
1644 + value "%innxmit_rejected";
1645 + };
1646 + data {
1647 + name "Art. missing";
1648 + color "#00FF00";
1649 + value "%innxmit_missing";
1650 + };
1651 + };
1652 +};
1653 +
1654 +section innxmit_volume {
1655 + title "Outgoing Feeds (innxmit) by Volume:";
1656 + data "%innxmit_accepted_size";
1657 + sort "$innxmit_accepted_size{$b} <=> $innxmit_accepted_size{$a}";
1658 + numbering true;
1659 + column {
1660 + name "Server";
1661 + format "%-24.24s";
1662 + value "$key";
1663 + format_total "TOTAL: %-17.17s";
1664 + total "$num";
1665 + };
1666 + column {
1667 + name "AcceptVol";
1668 + format "%9s";
1669 + value "bytes($innxmit_accepted_size{$key})";
1670 + total "bytes(total(%innxmit_accepted_size))";
1671 + };
1672 + column {
1673 + name "RejectVol";
1674 + format "%9s";
1675 + value "bytes($innxmit_rejected_size{$key})";
1676 + total "bytes(total(%innxmit_rejected_size))";
1677 + };
1678 + column {
1679 + name "TotalVol";
1680 + format "%9s";
1681 + value "bytes($innxmit_accepted_size{$key} +
1682 + $innxmit_rejected_size{$key} +
1683 + $innxmit_bytes{$key})";
1684 + total "bytes(total(%innxmit_accepted_size) +
1685 + total(%innxmit_rejected_size) +
1686 + total(%innxmit_bytes))";
1687 + };
1688 + column {
1689 + name "KB/s";
1690 + format_name "%5s";
1691 + format "%5.1f";
1692 + value "($innxmit_accepted_size{$key} +
1693 + $innxmit_rejected_size{$key} +
1694 + $innxmit_bytes{$key}) /
1695 + $innxmit_times{$key} / 1024";
1696 + total "(total(%innxmit_accepted_size) +
1697 + total(%innxmit_rejected_size) +
1698 + total(%innxmit_bytes)) /
1699 + total(%innxmit_times) / 1024";
1700 + };
1701 + column {
1702 + name "Vol/Art";
1703 + format "%9s";
1704 + value "bytes(($innxmit_accepted_size{$key} +
1705 + $innxmit_rejected_size{$key} +
1706 + $innxmit_bytes{$key}) /
1707 + ($innxmit_accepted{$key} +
1708 + $innxmit_rejected{$key}))";
1709 + total "bytes((total(%innxmit_accepted_size) +
1710 + total(%innxmit_rejected_size) +
1711 + total(%innxmit_bytes)) /
1712 + (total(%innxmit_accepted) +
1713 + total(%innxmit_rejected)))";
1714 + };
1715 + column {
1716 + name "Elapsed";
1717 + format "%8s";
1718 + value "time($innxmit_times{$key})";
1719 + total "time(total(%innxmit_times))";
1720 + };
1721 + graph {
1722 + title "Outgoing Feeds (innxmit)";
1723 + type histo3d;
1724 + sort "%innxmit_accepted";
1725 + data {
1726 + name "Articles accepted";
1727 + color "#0000FF";
1728 + value "%innxmit_accepted_size";
1729 + };
1730 + data {
1731 + name "Articles rejected";
1732 + color "#FFAF00";
1733 + value "%innxmit_rejected_size";
1734 + };
1735 + data {
1736 + name "Total";
1737 + color "#FF0000";
1738 + value "%innxmit_missing";
1739 + };
1740 + };
1741 +};
1742 +
1743 +
1744 +section innxmit_connect2 {
1745 + title "Outgoing Feeds (innxmit) - other information:";
1746 + data "%innxmit_site";
1747 + sort "$innxmit_accepted{$b} <=> $innxmit_accepted{$a}";
1748 + numbering true;
1749 + column {
1750 + name "Server";
1751 + format "%-25.25s";
1752 + value "$key";
1753 + format_total "TOTAL: %-18.18s";
1754 + total "$num";
1755 + };
1756 + column {
1757 + name "Conn";
1758 + format_name "%5s";
1759 + format "%5d";
1760 + value "$innxmit_site{$key}";
1761 + total "total(%innxmit_site)";
1762 + };
1763 + column {
1764 + name "Ok";
1765 + format_name "%5s";
1766 + format "%5d";
1767 + value "$innxmit_site{$key} -
1768 + ($innxmit_afail_host{$key} +
1769 + $innxmit_hiload{$key} + $innxmit_nospace{$key} +
1770 + $innxmit_cfail_host{$key} +
1771 + $innxmit_expire{$key} + $innxmit_crefused{$key})";
1772 + total "total(%innxmit_site) -
1773 + (total(%innxmit_afail_host) +
1774 + total(%innxmit_hiload) +
1775 + total(%innxmit_nospace) +
1776 + total(%innxmit_cfail_host) +
1777 + total(%innxmit_expire) +
1778 + total(%innxmit_crefused))";
1779 + };
1780 + column {
1781 + name "Auth";
1782 + format_name "%4s";
1783 + format "%4d";
1784 + value "$innxmit_afail_host{$key}";
1785 + total "total(%innxmit_afail_host)";
1786 + };
1787 + column {
1788 + name "Load";
1789 + format_name "%4s";
1790 + format "%4d";
1791 + value "$innxmit_hiload{$key}";
1792 + total "total(%innxmit_hiload)";
1793 + };
1794 + column {
1795 + name "Space";
1796 + format_name "%5s";
1797 + format "%5d";
1798 + value "$innxmit_nospace{$key}";
1799 + total "total(%innxmit_nospace)";
1800 + };
1801 + column {
1802 + name "Expire";
1803 + format_name "%6s";
1804 + format "%6d";
1805 + value "$innxmit_expire{$key}";
1806 + total "total(%innxmit_expire)";
1807 + };
1808 + column {
1809 + name "Connct";
1810 + format_name "%6s";
1811 + format "%6d";
1812 + value "$innxmit_cfail_host{$key}";
1813 + total "total(%innxmit_cfail_host)";
1814 + };
1815 + column {
1816 + name "Other";
1817 + format_name "%6s";
1818 + format "%6d";
1819 + value "$innxmit_crefused{$key}";
1820 + total "total(%innxmit_crefused)";
1821 + };
1822 + column {
1823 + name "Pct";
1824 + format_name "%4s";
1825 + format "%3d%%";
1826 + value "$innxmit_site{$key} ? 100 *
1827 + ($innxmit_site{$key} -
1828 + ($innxmit_afail_host{$key} +
1829 + $innxmit_hiload{$key} + $innxmit_nospace{$key} +
1830 + $innxmit_cfail_host{$key} +
1831 + $innxmit_expire{$key} +
1832 + $innxmit_crefused{$key})) / $innxmit_site{$key} : 0";
1833 + total "total(%innxmit_site) ?
1834 + 100 * (total(%innxmit_site) -
1835 + (total(%innxmit_afail_host) +
1836 + total(%innxmit_hiload) +
1837 + total(%innxmit_nospace) +
1838 + total(%innxmit_cfail_host) +
1839 + total(%innxmit_expire) +
1840 + total(%innxmit_crefused))) / total(%innxmit_site) : 0";
1841 + };
1842 +};
1843 +
1844 +section innxmit_unwanted {
1845 + title "Sites fed by innxmit rejecting bad articles:";
1846 + data "%innxmit_badart";
1847 + sort "$innxmit_badart{$b} <=> $innxmit_badart{$a}";
1848 + column {
1849 + numbering true;
1850 + name "Server";
1851 + format "%-23.23s";
1852 + value "$key";
1853 + format_total "TOTAL: %-16.16s";
1854 + total "$num";
1855 + };
1856 + column {
1857 + name "Total";
1858 + format_name "%6s";
1859 + format "%6d";
1860 + value "$innxmit_badart{$key}";
1861 + total "total(%innxmit_badart)";
1862 + };
1863 + column {
1864 + name "Group";
1865 + format_name "%6s";
1866 + format "%6d";
1867 + value "$innxmit_uw_ng_s{$key}";
1868 + total "total(%innxmit_uw_ng_s)";
1869 + };
1870 + column {
1871 + name "Dist";
1872 + format_name "%5s";
1873 + format "%5d";
1874 + value "$innxmit_uw_dist_s{$key}";
1875 + total "total(%innxmit_uw_dist_s)";
1876 + };
1877 + column {
1878 + name "Duplic";
1879 + format_name "%6s";
1880 + format "%6d";
1881 + value "$innxmit_duplicate{$key}";
1882 + total "total(%innxmit_duplicate)";
1883 + };
1884 + column {
1885 + name "Unapp";
1886 + format_name "%5s";
1887 + format "%5d";
1888 + value "$innxmit_unapproved{$key}";
1889 + total "total(%innxmit_unapproved)";
1890 + };
1891 + column {
1892 + name "TooOld";
1893 + format_name "%6s";
1894 + format "%6d";
1895 + value "$innxmit_tooold{$key}";
1896 + total "total(%innxmit_tooold)";
1897 + };
1898 + column {
1899 + name "Site";
1900 + format_name "%4s";
1901 + format "%4d";
1902 + value "$innxmit_uw_site{$key}";
1903 + total "total(%innxmit_uw_site)";
1904 + };
1905 + column {
1906 + name "Line";
1907 + format_name "%4s";
1908 + format "%4d";
1909 + value "$innxmit_linecount{$key}";
1910 + total "total(%innxmit_linecount)";
1911 + };
1912 + column {
1913 + name "Other";
1914 + format_name "%5s";
1915 + format "%5d";
1916 + value "$innxmit_others{$key}";
1917 + total "total(%innxmit_others)";
1918 + };
1919 +};
1920 +
1921 +section crosspost {
1922 + title "Crosspost stats:";
1923 + data "%crosspost";
1924 + column {
1925 + name "Events";
1926 + format "%-63.63s";
1927 + value "$key";
1928 + format_total "TOTAL: %-56.56s";
1929 + total "$num";
1930 + };
1931 + column {
1932 + name "Number";
1933 + value "$crosspost{$key}";
1934 + format "%7s";
1935 + total "total(%crosspost)";
1936 + };
1937 + column {
1938 + name "Num/min";
1939 + value "$crosspost_times{$key}";
1940 + format "%7s";
1941 + total "total(%crosspost_times)";
1942 + };
1943 +};
1944 +
1945 +section batcher_elapsed {
1946 + title "UUCP batches created:";
1947 + data "%batcher_elapsed";
1948 + column {
1949 + name "Server";
1950 + format "%-41.41s";
1951 + value "$key";
1952 + format_total "TOTAL: %-34.34s";
1953 + total "$num";
1954 + };
1955 + column {
1956 + name "Offered";
1957 + format_name "%7s";
1958 + format "%7d";
1959 + value "$batcher_offered{$key}";
1960 + total "total(%batcher_offered)";
1961 + };
1962 + column {
1963 + name "Articles";
1964 + format_name "%8s";
1965 + format "%8d";
1966 + value "$batcher_articles{$key}";
1967 + total "total(%batcher_articles)";
1968 + };
1969 + column {
1970 + name "Size";
1971 + format "%10s";
1972 + value "bytes($batcher_bytes{$key})";
1973 + total "bytes(total(%batcher_bytes))";
1974 + };
1975 + column {
1976 + name "Elapsed";
1977 + format "%9s";
1978 + value "time($batcher_elapsed{$key})";
1979 + total "time(total(%batcher_elapsed))";
1980 + };
1981 +};
1982 +
1983 +section rnews_host {
1984 + title "Rnews articles offered from:";
1985 + data "%rnews_host";
1986 + sort "$rnews_host{$b} <=> $rnews_host{$a}";
1987 + column {
1988 + name "System";
1989 + format "%-71.71s";
1990 + value "$key";
1991 + format_total "TOTAL: %-64.64s";
1992 + total "$num";
1993 + };
1994 + column {
1995 + name "Offered";
1996 + format_name "%7s";
1997 + format "%7d";
1998 + value "$rnews_host{$key}";
1999 + total "total(%rnews_host)";
2000 + };
2001 +};
2002 +
2003 +section rnews_rejected {
2004 + title "Rnews connections rejected:";
2005 + data "%rnews_rejected";
2006 + sort "$rnews_rejected{$b} <=> $rnews_rejected{$a}";
2007 + column {
2008 + name "Reason";
2009 + format "%-71.71s";
2010 + value "$key";
2011 + format_total "TOTAL: %-64.64s";
2012 + total "$num";
2013 + };
2014 + column {
2015 + name "Conn";
2016 + format_name "%7s";
2017 + format "%7d";
2018 + value "$rnews_rejected{$key}";
2019 + total "total(%rnews_rejected)";
2020 + };
2021 +};
2022 +
2023 +section rnews_misc {
2024 + title "Miscellaneous rnews statistics:";
2025 + data "%rnews_misc";
2026 + sort "$rnews_misc{$b} <=> $rnews_misc{$a}";
2027 + double true;
2028 + column {
2029 + primary true;
2030 + name "Event";
2031 + format "%-69.69s";
2032 + value "$key1";
2033 + format_total "TOTAL: %-62.62s";
2034 + total "";
2035 + };
2036 + column {
2037 + name "Element";
2038 + format " %-67.67s";
2039 + value "$key2";
2040 + total "";
2041 + };
2042 + column {
2043 + name "Number";
2044 + format_name "%9s";
2045 + format "%9d";
2046 + value "$rnews_misc{$key1}{$key2}";
2047 + total "total(%rnews_misc)";
2048 + };
2049 +};
2050 +
2051 +section nnrpd_groups {
2052 + title "NNRP readership statistics:";
2053 + data "%nnrpd_connect";
2054 + sort "$nnrpd_articles{$b} <=> $nnrpd_articles{$a}";
2055 + numbering true;
2056 + column {
2057 + name "System";
2058 + format "%-30.30s";
2059 + value "$key";
2060 + format_total "TOTAL: %-23.23s";
2061 + total "$num";
2062 + };
2063 + column {
2064 + name "Conn";
2065 + format_name "%4s";
2066 + format "%4d";
2067 + value "$nnrpd_connect{$key}";
2068 + total "total(%nnrpd_connect)";
2069 + };
2070 + column {
2071 + name "Arts";
2072 + format_name "%6s";
2073 + format "%6d";
2074 + value "$nnrpd_articles{$key}";
2075 + total "total(%nnrpd_articles)";
2076 + };
2077 + column {
2078 + name "Size";
2079 + format "%9s";
2080 + value "bytes($nnrpd_bytes{$key})";
2081 + total "bytes(total(%nnrpd_bytes))";
2082 + };
2083 + column {
2084 + name "Groups";
2085 + format_name "%6s";
2086 + format "%6d";
2087 + value "$nnrpd_groups{$key}";
2088 + total "total(%nnrpd_groups)";
2089 + };
2090 + column {
2091 + name "Post";
2092 + format_name "%4s";
2093 + format "%4d";
2094 + value "$nnrpd_post_ok{$key}";
2095 + total "total(%nnrpd_post_ok)";
2096 + };
2097 + column {
2098 + name "Rej";
2099 + format_name "%4s";
2100 + format "%4d";
2101 + value "$nnrpd_post_rej{$key} +
2102 + $nnrpd_post_error{$key}";
2103 + total "total(%nnrpd_post_rej) +
2104 + total(%nnrpd_post_error)";
2105 + };
2106 + column {
2107 + name "Elapsed";
2108 + format "%9s";
2109 + value "time($nnrpd_times{$key})";
2110 + total "time(total(%nnrpd_times))";
2111 + };
2112 +};
2113 +
2114 +section nnrpd_dom_groups {
2115 + title "NNRP readership statistics (by domain):";
2116 + data "%nnrpd_dom_connect";
2117 + sort "$nnrpd_dom_articles{$b} <=> $nnrpd_dom_articles{$a}";
2118 + numbering true;
2119 + column {
2120 + name "System";
2121 + format "%-30.30s";
2122 + value "$key";
2123 + format_total "TOTAL: %-23.23s";
2124 + total "$num";
2125 + };
2126 + column {
2127 + name "Conn";
2128 + format_name "%4s";
2129 + format "%4d";
2130 + value "$nnrpd_dom_connect{$key}";
2131 + total "total(%nnrpd_dom_connect)";
2132 + };
2133 + column {
2134 + name "Arts";
2135 + format_name "%6s";
2136 + format "%6d";
2137 + value "$nnrpd_dom_articles{$key}";
2138 + total "total(%nnrpd_dom_articles)";
2139 + };
2140 + column {
2141 + name "Size";
2142 + format "%9s";
2143 + value "bytes($nnrpd_dom_bytes{$key})";
2144 + total "bytes(total(%nnrpd_dom_bytes))";
2145 + };
2146 + column {
2147 + name "Groups";
2148 + format_name "%6s";
2149 + format "%6d";
2150 + value "$nnrpd_dom_groups{$key}";
2151 + total "total(%nnrpd_dom_groups)";
2152 + };
2153 + column {
2154 + name "Post";
2155 + format_name "%4s";
2156 + format "%4d";
2157 + value "$nnrpd_dom_post_ok{$key}";
2158 + total "total(%nnrpd_dom_post_ok)";
2159 + };
2160 + column {
2161 + name "Rej";
2162 + format_name "%4s";
2163 + format "%4d";
2164 + value "$nnrpd_dom_post_rej{$key} +
2165 + $nnrpd_dom_post_error{$key}";
2166 + total "total(%nnrpd_dom_post_rej) +
2167 + total(%nnrpd_dom_post_error)";
2168 + };
2169 + column {
2170 + name "Elapsed";
2171 + format "%9s";
2172 + value "time($nnrpd_dom_times{$key})";
2173 + total "time(total(%nnrpd_dom_times))";
2174 + };
2175 +};
2176 +
2177 +section nnrpd_auth {
2178 + title "NNRP auth users:";
2179 + data "%nnrpd_auth";
2180 + top 20;
2181 + sort "$nnrpd_auth{$b} <=> $nnrpd_auth{$a}";
2182 + column {
2183 + name "User";
2184 + format "%-71.71s";
2185 + value "$key";
2186 + format_total "TOTAL: %-64.64s";
2187 + total "$num";
2188 + };
2189 + column {
2190 + name "Conn";
2191 + format_name "%7s";
2192 + format "%7d";
2193 + value "$nnrpd_auth{$key}";
2194 + total "total(%nnrpd_auth)";
2195 + };
2196 +};
2197 +
2198 +section nnrpd_resource {
2199 + title "NNRP total resource statistics:";
2200 + data "%nnrpd_resource_elapsed";
2201 + top 20;
2202 + sort "$nnrpd_resource_elapsed{$b} <=> $nnrpd_resource_elapsed{$a}";
2203 + column {
2204 + name "System";
2205 + format "%-40.40s";
2206 + format_total "TOTAL: %-33.33s";
2207 + value "$key";
2208 + total "$num";
2209 + };
2210 + column {
2211 + name "User(ms)";
2212 + format_name "%9s";
2213 + format "%9.3f";
2214 + value "$nnrpd_resource_user{$key}";
2215 + total "total(%nnrpd_resource_user)";
2216 + };
2217 + column {
2218 + name "System(ms)";
2219 + format_name "%9s";
2220 + format "%9.3f";
2221 + value "$nnrpd_resource_system{$key}";
2222 + total "total(%nnrpd_resource_system)";
2223 + };
2224 + column {
2225 + name "Idle(ms)";
2226 + format_name "%9s";
2227 + format "%9.3f";
2228 + value "$nnrpd_resource_idle{$key}";
2229 + total "total(%nnrpd_resource_idle)";
2230 + };
2231 + column {
2232 + name "Elapsed";
2233 + format_name "%8s";
2234 + format "%9s";
2235 + value "time($nnrpd_resource_elapsed{$key})";
2236 + total "time(total(%nnrpd_resource_elapsed))";
2237 + };
2238 +};
2239 +
2240 +section nnrpd_curious {
2241 + title "Curious NNRP server explorers:";
2242 + data "%nnrpd_curious";
2243 + top 20;
2244 + sort "$nnrpd_curious{$b} <=> $nnrpd_curious{$a}";
2245 + column {
2246 + name "System";
2247 + format "%-71.71s";
2248 + value "$key";
2249 + format_total "TOTAL: %-64.64s";
2250 + total "$num";
2251 + };
2252 + column {
2253 + name "Conn";
2254 + format_name "%7s";
2255 + format "%7d";
2256 + value "$nnrpd_curious{$key}";
2257 + total "total(%nnrpd_curious)";
2258 + };
2259 +};
2260 +
2261 +section nnrpd_no_permission {
2262 + title "NNRP no permission clients:";
2263 + data "%nnrpd_no_permission";
2264 + sort "$nnrpd_no_permission{$b} <=> $nnrpd_no_permission{$a}";
2265 + column {
2266 + name "System";
2267 + format "%-71.71s";
2268 + value "$key";
2269 + format_total "TOTAL: %-64.64s";
2270 + total "$num";
2271 + };
2272 + column {
2273 + name "Conn";
2274 + format_name "%7s";
2275 + format "%7d";
2276 + value "$nnrpd_no_permission{$key}";
2277 + total "total(%nnrpd_no_permission)";
2278 + };
2279 +};
2280 +
2281 +section nnrpd_gethostbyaddr {
2282 + title "NNRP gethostbyaddr failures:";
2283 + data "%nnrpd_gethostbyaddr";
2284 + top 20;
2285 + sort "$nnrpd_gethostbyaddr{$b} <=> $nnrpd_gethostbyaddr{$a}";
2286 + column {
2287 + name "System";
2288 + format "%-71.71s";
2289 + value "$key";
2290 + format_total "TOTAL: %-64.64s";
2291 + total "$num";
2292 + };
2293 + column {
2294 + name "Conn";
2295 + format_name "%7s";
2296 + format "%7d";
2297 + value "$nnrpd_gethostbyaddr{$key}";
2298 + total "total(%nnrpd_gethostbyaddr)";
2299 + };
2300 +};
2301 +
2302 +section nnrpd_unrecognized {
2303 + title "NNRP unrecognized commands (by host):";
2304 + data "%nnrpd_unrecognized";
2305 + sort "$nnrpd_unrecognized{$b} <=> $nnrpd_unrecognized{$a}";
2306 + column {
2307 + name "System";
2308 + format "%-71.71s";
2309 + value "$key";
2310 + format_total "TOTAL: %-64.64s";
2311 + total "$num";
2312 + };
2313 + column {
2314 + name "Conn";
2315 + format_name "%7s";
2316 + format "%7d";
2317 + value "$nnrpd_unrecognized{$key}";
2318 + total "total(%nnrpd_unrecognized)";
2319 + };
2320 +};
2321 +
2322 +section nnrpd_unrecognized2 {
2323 + title "NNRP unrecognized commands (by command):";
2324 + data "%nnrpd_unrecogn_cmd";
2325 + sort "$nnrpd_unrecogn_cmd{$b} <=> $nnrpd_unrecogn_cmd{$a}";
2326 + column {
2327 + name "Command";
2328 + format "%-71.71s";
2329 + value "$key";
2330 + format_total "TOTAL: %-64.64s";
2331 + total "$num";
2332 + };
2333 + column {
2334 + name "Count";
2335 + format_name "%7s";
2336 + format "%7d";
2337 + value "$nnrpd_unrecogn_cmd{$key}";
2338 + total "total(%nnrpd_unrecogn_cmd)";
2339 + };
2340 +};
2341 +
2342 +section nnrpd_timeout {
2343 + title "NNRP client timeouts:";
2344 + data "%nnrpd_timeout";
2345 + top 20;
2346 + sort "$nnrpd_timeout{$b} <=> $nnrpd_timeout{$a}";
2347 + column {
2348 + name "System";
2349 + format "%-67.67s";
2350 + value "$key";
2351 + format_total "TOTAL: %-60.60s";
2352 + total "$num";
2353 + };
2354 + column {
2355 + name "Conn";
2356 + format_name "%5s";
2357 + format "%5d";
2358 + value "$nnrpd_timeout{$key}";
2359 + total "total(%nnrpd_timeout)";
2360 + };
2361 + column {
2362 + name "Peer";
2363 + format_name "%5s";
2364 + format "%5d";
2365 + value "$nnrpd_reset_peer{$key}";
2366 + total "total(%nnrpd_reset_peer)";
2367 + };
2368 +};
2369 +
2370 +section nnrpd_hierarchy {
2371 + title "Newsgroup request counts (by category):";
2372 + data "%nnrpd_hierarchy";
2373 + sort "$nnrpd_hierarchy{$b} <=> $nnrpd_hierarchy{$a}";
2374 + numbering true;
2375 + column {
2376 + name "Category";
2377 + format "%-64.64s";
2378 + value "$key";
2379 + format_total "TOTAL: %-57.57s";
2380 + total "$num";
2381 + };
2382 + column {
2383 + name "Count";
2384 + format_name "%7s";
2385 + format "%7d";
2386 + value "$nnrpd_hierarchy{$key}";
2387 + total "total(%nnrpd_hierarchy)";
2388 + };
2389 + column {
2390 + name "Pct";
2391 + format_name "%6s";
2392 + format "%5.1f%%";
2393 + value "$nnrpd_hierarchy{$key} /
2394 + total(%nnrpd_hierarchy) * 100";
2395 + total "100";
2396 + };
2397 + # graph : type piechart
2398 +};
2399 +
2400 +section nnrpd_group {
2401 + title "Newsgroup request counts (by newsgroup):";
2402 + data "%nnrpd_group";
2403 + sort "$nnrpd_group{$b} <=> $nnrpd_group{$a}";
2404 + top 100;
2405 + numbering true;
2406 + column {
2407 + name "Newsgroup";
2408 + format "%-71.71s";
2409 + value "$key";
2410 + format_total "TOTAL: %-64.64s";
2411 + total "$num";
2412 + };
2413 + column {
2414 + name "Count";
2415 + format_name "%7s";
2416 + format "%7d";
2417 + value "$nnrpd_group{$key}";
2418 + total "total(%nnrpd_group)";
2419 + };
2420 +};
2421 +
2422 +section ihave_site {
2423 + title "IHAVE messages offered from:";
2424 + data "%controlchan_ihave_site";
2425 + sort "$controlchan_ihave_site{$b} <=> $controlchan_ihave_site{$a}";
2426 + column {
2427 + name "System";
2428 + format "%-71.71s";
2429 + value "$key";
2430 + format_total "TOTAL: %-64.64s";
2431 + total "$num";
2432 + };
2433 + column {
2434 + name "Offered";
2435 + format_name "%7s";
2436 + format "%7d";
2437 + value "$controlchan_ihave_site{$key}";
2438 + total "total(%controlchan_ihave_site)";
2439 + };
2440 +};
2441 +
2442 +section sendme_site {
2443 + title "SENDME messages offered from:";
2444 + data "%controlchan_sendme_site";
2445 + sort "$controlchan_sendme_site{$b} <=>
2446 + $controlchan_sendme_site{$a}";
2447 + column {
2448 + name "System";
2449 + format "%-71.71s";
2450 + value "$key";
2451 + format_total "TOTAL: %-64.64s";
2452 + total "$num";
2453 + };
2454 + column {
2455 + name "Offered";
2456 + format_name "%7s";
2457 + format "%7d";
2458 + value "$controlchan_sendme_site{$key}";
2459 + total "total(%controlchan_sendme_site)";
2460 + };
2461 +};
2462 --- /dev/null
2463 +++ b/extra/innreport
2464 @@ -0,0 +1,2594 @@
2465 +#! /usr/bin/perl
2466 +require '/usr/lib/news/innshellvars.pl';
2467 +
2468 +##########################################################################
2469 +#
2470 +# innreport: Perl script to summarize news log files
2471 +# (with optional HTML output and graphs).
2472 +#
2473 +# version: 3.0.2
2474 +#
2475 +# Copyright (c) 1996-1999, Fabien Tassin ([email protected]).
2476 +#
2477 +##########################################################################
2478 +#
2479 +# Usage: innreport -f config_file [-[no]options] logfile [logfile2 [...]]
2480 +# where options are:
2481 +# -h (or -help) : this help page
2482 +# -html : HTML output
2483 +# -v : display the version number of INNreport
2484 +# -f config_file : name of the configuration file
2485 +# -config : print INNreport configuration information
2486 +# -g : want graphs [default]
2487 +# -graph : an alias for option -g
2488 +# -d directory : directory for Web pages
2489 +# -dir directory : an alias for option -d
2490 +# -p directory : pictures path (file space)
2491 +# -path directory : an alias for option -p
2492 +# -w directory : pictures path (web space)
2493 +# -webpath directory : an alias for option -w
2494 +# -i : name of index page
2495 +# -index : an alias for option -i
2496 +# -a : want to archive HTML results
2497 +# -archive : an alias for option -a
2498 +# -c number : how many report files to keep (0 = all)
2499 +# -cycle number : an alias for option -c
2500 +# -s char : separator for filename
2501 +# -separator char : an alias for option -s
2502 +# -unknown : Unknown entries from news log file
2503 +# -maxunrec : Max number of unrecognized line to display
2504 +# -casesensitive : Case sensitive
2505 +# -notdaily : Never perform daily actions
2506 +#
2507 +# Use no in front of boolean options to unset them.
2508 +# For example, "-html" is set by default. Use "-nohtml" to remove this
2509 +# feature.
2510 +#
2511 +##########################################################################
2512 +#
2513 +# ABSOLUTELY NO WARRANTY WITH THIS PACKAGE. USE IT AT YOUR OWN RISKS.
2514 +#
2515 +# Note: You need the Perl graphic library GD.pm if you want the graphs.
2516 +# GD is available on all good CPAN ftp sites:
2517 +# ex: [CPAN_DIR]/authors/id/LDS/GD-1.1_.tar.gz (or greater)
2518 +# or directly to:
2519 +# <URL:http://www-genome.wi.mit.edu/pub/software/WWW/GD.html>
2520 +# Note : innreport will create PNG or GIF files depending upon
2521 +# the GD version.
2522 +#
2523 +# Documentation: for a short explaination of the different options, you
2524 +# can read the usage (obtained with the -h or -help switch).
2525 +#
2526 +# Install: - check the Perl location (first line). Require Perl 5.002
2527 +# or greater.
2528 +# - look at the parameters in the configuration file (section
2529 +# 'default')
2530 +# - copy the configuration file into ${PATHETC}/innreport.conf
2531 +# - copy the INN module into ${PATHETC}/innreport_inn.pm
2532 +# - copy this script into ${PATHETC}/innreport
2533 +# - be sure that the news user can run it (chmod 755 or 750)
2534 +# - in "scanlog", comment the line containing innlog and add:
2535 +# ${PATHETC}/innreport -f ${PATHETC}/innreport.conf ${OLD_SYSLOG}
2536 +# or, if you want to change some options:
2537 +# ${PATHETC}/innreport -f ${PATHETC}/innreport.conf options ${OLD_SYSLOG}
2538 +#
2539 +# Report: please report bugs (preferably) to the innreport mailing list
2540 +# (see below) or directly to the author (do not forget to
2541 +# include the result of the "-config" switch, the parameters
2542 +# passed on the command line and the INN version).
2543 +# Please also report unknown entries.
2544 +# Be sure your are using the latest version of this script before
2545 +# any report.
2546 +# (check <URL:ftp://ftp.sofaraway.org/pub/innreport/>)
2547 +#
2548 +##########################################################################
2549 +
2550 +# remember to add '-w' on the first line and to uncomment the 'use strict'
2551 +# below before doing any changes to this file.
2552 +
2553 +use strict;
2554 +
2555 +## Do you want to create a Web page. Pick DO or DONT.
2556 +my $HTML = "DONT";
2557 +
2558 +## Do you want the graphs (need $HTML too). Pick DO or DONT.
2559 +my $GRAPH = "DO";
2560 +
2561 +## Directory for the Web pages (used only if the previous line is active)
2562 +my $HTML_dir = "/var/www/News/stats";
2563 +
2564 +## Directory for the pictures (need HTML support) in the file space
2565 +my $IMG_dir = "$HTML_dir/pics";
2566 +
2567 +## Directory for the pictures (need HTML support) in the Web space
2568 +## (can be relative or global)
2569 +my $IMG_pth = "pics";
2570 +
2571 +## Do you want to archive HTML results (& pics) [ will add a date in each
2572 +## name ]. Pick DO or DONT.
2573 +my $ARCHIVE = "DO";
2574 +
2575 +## index page will be called:
2576 +my $index = "index.html";
2577 +
2578 +## How many report files to keep (0 = all) (need $ARCHIVE).
2579 +my $CYCLE = 30;
2580 +
2581 +## separator between hours-minutes-seconds in filenames
2582 +## (normaly a ":" but some web-browsers (Lynx, MS-IE, Mosaic) can't read it)
2583 +## Warning: never use "/". Use only a _valid_ filename char.
2584 +my $SEPARATOR = ".";
2585 +
2586 +## Do you want the "Unknown entries from news log file" report. Pick DO or
2587 +## DONT.
2588 +my $WANT_UNKNOWN = "DO";
2589 +
2590 +## Max number of unrecognized lines to display (if $WANT_UNKNOWN)
2591 +## (-1 = no limit)
2592 +my $MAX_UNRECOGNIZED = 50;
2593 +
2594 +## Do you want to be case sensitive. Pick DO or DONT.
2595 +my $CASE_SENSITIVE = "DO";
2596 +
2597 +## Some actions must only be performed daily (once for a log file).
2598 +## (ex: unwanted.log with INN). Default value (DONT) means to perform
2599 +## these actions each . Pick DO or DONT.
2600 +my $NOT_DAILY = "DONT";
2601 +
2602 +###############################################
2603 +## THERE'S NOTHING TO CHANGE AFTER THIS LINE ##
2604 +###############################################
2605 +
2606 +my $version = "3.0.2";
2607 +my %output; # content of the configuration file.
2608 +my $DEBUG = 0; # set to 1 to verify the structure/content of the conf file.
2609 +my $start_time = time;
2610 +
2611 +# Require Perl 5.002 or greater.
2612 +require 5.002;
2613 +use Getopt::Long;
2614 +use vars qw/$HAVE_GD $GD_FORMAT/;
2615 +
2616 +my @old_argv = @ARGV;
2617 +
2618 +# Convert DO/DONT into boolean values.
2619 +{
2620 + my $i;
2621 + foreach $i (\$HTML, \$GRAPH, \$ARCHIVE, \$WANT_UNKNOWN,
2622 + \$CASE_SENSITIVE, \$NOT_DAILY) {
2623 + $$i = $$i eq 'DO' ? 1 : 0 ;
2624 + }
2625 +}
2626 +
2627 +my %ref;
2628 +GetOptions (\%ref,
2629 + qw(-h -help
2630 + -html!
2631 + -config
2632 + -f=s
2633 + -g! -graph!
2634 + -d=s -dir=s
2635 + -p=s -path=s
2636 + -w=s -webpath=s
2637 + -i=s -index=s
2638 + -a! -archive!
2639 + -c=i -cycle=i
2640 + -s=s -separator=s
2641 + -unknown!
2642 + -html-unknown!
2643 + -maxunrec=i
2644 + -casesensitive!
2645 + -notdaily!
2646 + -v
2647 + ));
2648 +
2649 +&Version if $ref{'v'};
2650 +
2651 +&Decode_Config_File($ref{'f'}) if defined $ref{'f'};
2652 +&Usage if $ref{'h'} || $ref{'help'} || !defined $ref{'f'};
2653 +
2654 +$HTML = 0 if defined $output{'default'}{'html'};
2655 +$HTML = 1 if $output{'default'}{'html'} eq 'true';
2656 +$HTML = 0 if defined $ref{'html'};
2657 +$HTML = 1 if $ref{'html'};
2658 +
2659 +$GRAPH = 0 if defined $output{'default'}{'graph'};
2660 +$GRAPH = 1 if $HTML && ($output{'default'}{'graph'} eq 'true');
2661 +$GRAPH = 0 if defined $ref{'g'} || defined $ref{'graph'};
2662 +$GRAPH = 1 if $HTML && ($ref{'g'} || $ref{'graph'});
2663 +
2664 +$HTML_dir = &GetValue ($output{'default'}{'html_dir'})
2665 + if defined $output{'default'}{'html_dir'};
2666 +$HTML_dir = $ref{'d'} if defined $ref{'d'};
2667 +$HTML_dir = $ref{'dir'} if defined $ref{'dir'};
2668 +
2669 +$IMG_pth = &GetValue ($output{'default'}{'img_dir'})
2670 + if defined $output{'default'}{'img_dir'};
2671 +$IMG_pth = $ref{'w'} if defined $ref{'w'};
2672 +$IMG_pth = $ref{'webpath'} if defined $ref{'webpath'};
2673 +
2674 +$IMG_dir = $HTML_dir . "/" . $IMG_pth
2675 + if (defined $output{'default'}{'html_dir'} ||
2676 + defined $ref{'w'} || defined $ref{'webpath'})
2677 + &&
2678 + (defined $output{'default'}{'html_dir'} ||
2679 + defined $ref{'d'} || defined $ref{'dir'});
2680 +
2681 +$IMG_dir = $ref{'p'} if defined $ref{'p'};
2682 +$IMG_dir = $ref{'path'} if defined $ref{'path'};
2683 +
2684 +$index = &GetValue ($output{'default'}{'index'})
2685 + if defined $output{'default'}{'index'};
2686 +$index = $ref{'i'} if defined $ref{'i'};
2687 +$index = $ref{'index'} if defined $ref{'index'};
2688 +
2689 +$ARCHIVE = &GetValue ($output{'default'}{'archive'})
2690 + if defined $output{'default'}{'archive'};
2691 +$ARCHIVE = $ARCHIVE eq 'true';
2692 +$ARCHIVE = 0 if defined $ref{'a'} || defined $ref{'archive'};
2693 +$ARCHIVE = 1 if ($ref{'a'} || $ref{'archive'}) && $HTML;
2694 +$ARCHIVE = 0 unless $HTML;
2695 +
2696 +$CYCLE = &GetValue ($output{'default'}{'cycle'})
2697 + if defined $output{'default'}{'cycle'};
2698 +$CYCLE = 0 if $CYCLE eq 'none';
2699 +$CYCLE = $ref{'c'} if defined $ref{'c'};
2700 +$CYCLE = $ref{'cycle'} if defined $ref{'cycle'};
2701 +
2702 +$SEPARATOR = &GetValue ($output{'default'}{'separator'})
2703 + if defined $output{'default'}{'separator'};
2704 +$SEPARATOR = $ref{'s'} if defined $ref{'s'};
2705 +$SEPARATOR = $ref{'separator'} if defined $ref{'separator'};
2706 +
2707 +if (defined $output{'default'}{'unknown'}) {
2708 + $WANT_UNKNOWN = &GetValue ($output{'default'}{'unknown'});
2709 + $WANT_UNKNOWN = $WANT_UNKNOWN eq 'true' ? 1 : 0;
2710 +}
2711 +$WANT_UNKNOWN = 0 if defined $ref{'unknown'};
2712 +$WANT_UNKNOWN = 1 if $ref{'unknown'};
2713 +
2714 +my $WANT_HTML_UNKNOWN = $WANT_UNKNOWN;
2715 +if (defined $output{'default'}{'html-unknown'}) {
2716 + $WANT_HTML_UNKNOWN = &GetValue ($output{'default'}{'html-unknown'});
2717 + $WANT_HTML_UNKNOWN = $WANT_HTML_UNKNOWN eq 'true' ? 1 : 0;
2718 +}
2719 +$WANT_HTML_UNKNOWN = 0 if defined $ref{'html-unknown'};
2720 +$WANT_HTML_UNKNOWN = 1 if $ref{'html-unknown'};
2721 +
2722 +$NOT_DAILY = 0 if defined $ref{'notdaily'};
2723 +$NOT_DAILY = 1 if $ref{'notdaily'};
2724 +
2725 +$MAX_UNRECOGNIZED = &GetValue ($output{'default'}{'max_unknown'})
2726 + if defined $output{'default'}{'max_unknown'};
2727 +$MAX_UNRECOGNIZED = $ref{'maxunrec'} if defined ($ref{'maxunrec'});
2728 +
2729 +$CASE_SENSITIVE = &GetValue ($output{'default'}{'casesensitive'})
2730 + if defined $output{'default'}{'casesensitive'};
2731 +$CASE_SENSITIVE = 1 if $CASE_SENSITIVE eq 'true';
2732 +$CASE_SENSITIVE = 0 if defined $ref{'casesensitive'};
2733 +$CASE_SENSITIVE = 1 if $ref{'casesensitive'};
2734 +
2735 +my $CLASS = &GetValue ($output{'default'}{'module'});
2736 +my $LIBPATH = &GetValue ($output{'default'}{'libpath'});
2737 +
2738 +umask 022;
2739 +
2740 +BEGIN {
2741 + eval "use GD;";
2742 + $HAVE_GD = $@ eq '';
2743 + if ($HAVE_GD) {
2744 + my $gd = new GD::Image(1,1);
2745 + $GD_FORMAT = "gif" if $gd->can('gif');
2746 + $GD_FORMAT = "png" if $gd->can('png');
2747 + }
2748 + $HAVE_GD;
2749 +};
2750 +undef $GRAPH unless $HTML;
2751 +if ($GRAPH && !$::HAVE_GD) {
2752 + print "WARNING: can't make graphs as required.\n" .
2753 + " Install GD.pm or disable this option.\n\n";
2754 + undef $GRAPH;
2755 +}
2756 +
2757 +if ($HTML) {
2758 + if ($GRAPH) {
2759 + $IMG_dir = "." if defined $IMG_dir && $IMG_dir eq '';
2760 + $IMG_pth .= "/" if $IMG_pth;
2761 + $IMG_pth =~ s|/+|/|g;
2762 + $IMG_dir =~ s|/+|/|g;
2763 + unless (-w $IMG_dir) {
2764 + print "WARNING: can't write in \"$IMG_dir\" as required by -g " .
2765 + "switch.\n Option -g removed. Please see the -p switch.\n\n";
2766 + undef $GRAPH;
2767 + }
2768 + }
2769 + $HTML_dir = "." if defined $HTML_dir && $HTML_dir eq '';
2770 + unless (-w $HTML_dir) {
2771 + print "WARNING: can't write in \"$HTML_dir\" as required by -html " .
2772 + "switch.\n Option -html and -a removed. Please see the " .
2773 + "-d switch.\n\n";
2774 + undef $HTML;
2775 + $ARCHIVE = 0;
2776 + }
2777 +}
2778 +
2779 +# Now, we are sure that HTML and graphs can be made if options are active.
2780 +&Summary if defined $ref{'config'};
2781 +
2782 +my $unrecognize_max = 0;
2783 +my @unrecognize;
2784 +my ($total_line, $total_size) = (0, 0);
2785 +my ($suffix, $HTML_output, %config, $first_date, $last_date,
2786 + %prog_type, %prog_size);
2787 +
2788 +my $HTML_header = '';
2789 +my $HTML_footer = '';
2790 +
2791 +my $MIN = 1E10;
2792 +my $MAX = -1;
2793 +
2794 +my $xmax = &GetValue ($output{'default'}{'graph_width'}) # Graph size..
2795 + if defined $output{'default'}{'graph_width'};
2796 +$xmax = 550 unless $xmax;
2797 +
2798 +my $transparent = &GetValue ($output{'default'}{'transparent'})
2799 + if defined $output{'default'}{'transparent'};
2800 +$transparent = (defined $transparent && $transparent eq 'true') ? 1 : 0;
2801 +
2802 +my $repeated = 1;
2803 +
2804 +my $first_date_cvt = $MIN;
2805 +my $last_date_cvt = $MAX;
2806 +
2807 +
2808 +#########################################################################
2809 +my $s = sprintf "use lib qw($LIBPATH); use $CLASS;";
2810 +eval $s; # initialization
2811 +die "Can't find/load $CLASS.pm : $@\n" if $@;
2812 +
2813 +my $save_line = <>;
2814 +$_ = $save_line;
2815 +local $^W = 0 if $] < 5.004; # to avoid a warning for each '+=' first use.
2816 +LINE: while (!eof ()) {
2817 + $total_line++;
2818 + my $size = length;
2819 + $total_size += $size;
2820 +
2821 + # Syslog optimization
2822 + if ($repeated) {
2823 + $repeated--;
2824 + $_ = $save_line;
2825 + }
2826 + else {
2827 + $_ = <>;
2828 + if ($_ =~ /last message repeated (\d+) times?$/o) {
2829 + $repeated = $1;
2830 + $_ = $save_line;
2831 + }
2832 + else {
2833 + $save_line = $_;
2834 + }
2835 + }
2836 +
2837 + # skip empty lines
2838 + next LINE if $_ eq '';
2839 +
2840 + my $res;
2841 + my ($day, $hour, $prog, $left) =
2842 + $_ =~ m/^(\S+\s+\S+) (\S+) \S+ (\S+): \[ID \d+ \S+\] (.*)$/o;
2843 + ($day, $hour, $prog, $left) =
2844 + $_ =~ m/^(\S+\s+\S+) (\S+) \S+ (\S+): (.*)$/o unless $day;
2845 + ($day, $hour, $prog, $left) =
2846 + $_ =~ m/^(\S+\s+\S+) (\S+) \d+ \S+ (\S+): (.*)$/o unless $day;
2847 +
2848 + unless ($day) {
2849 + ($day, $hour, $res, $left) = $_ =~ m/^(\S+\s+\S+) (\S+)\.\d+ (\S+) (.*)$/o;
2850 + if ($day) {
2851 + my $cvtdate = &ConvDate ("$day $hour");
2852 + if ($cvtdate < $first_date_cvt) {
2853 + $first_date_cvt = $cvtdate;
2854 + $first_date = "$day $hour";
2855 + }
2856 + elsif ($cvtdate > $last_date_cvt) {
2857 + $last_date_cvt = $cvtdate;
2858 + $last_date = "$day $hour";
2859 + }
2860 + $prog = "inn";
2861 + }
2862 + else {
2863 + next if $_ =~ /^$/;
2864 + # Unrecognize line... skip
2865 + $unrecognize[$unrecognize_max] = $_
2866 + unless $unrecognize_max > $MAX_UNRECOGNIZED
2867 + && $MAX_UNRECOGNIZED > 0;
2868 + $unrecognize_max++;
2869 + next LINE;
2870 + }
2871 + }
2872 + else {
2873 + my $cvtdate = &ConvDate ("$day $hour");
2874 + if ($cvtdate < $first_date_cvt) {
2875 + $first_date_cvt = $cvtdate;
2876 + $first_date = "$day $hour";
2877 + }
2878 + elsif ($cvtdate > $last_date_cvt) {
2879 + $last_date_cvt = $cvtdate;
2880 + $last_date = "$day $hour";
2881 + }
2882 + }
2883 +
2884 + ########
2885 + ## Program name
2886 + # word[7164] -> word
2887 + my ($pid) = $prog =~ s/\[(\d+)\]$//o;
2888 + # word: -> word
2889 + $prog =~ s/:$//o;
2890 + # wordX -> word (where X is a digit)
2891 + $prog =~ s/\d+$//o;
2892 +
2893 + $prog_type{$prog}++;
2894 + $prog_size{$prog} = 0 unless defined $prog_size{$prog}; # stupid warning :(
2895 + $prog_size{$prog} += $size;
2896 +
2897 + # The "heart" of the tool.
2898 + {
2899 + no strict;
2900 + next LINE if
2901 + &{$CLASS."::collect"} ($day, $hour, $prog, $res, $left, $CASE_SENSITIVE);
2902 + }
2903 +
2904 + $unrecognize[$unrecognize_max] = $_
2905 + unless $unrecognize_max > $MAX_UNRECOGNIZED
2906 + && $MAX_UNRECOGNIZED > 0;
2907 + $unrecognize_max++;
2908 +}
2909 +
2910 +{
2911 + no strict;
2912 + &{$CLASS . "::adjust"} ($first_date, $last_date);
2913 +}
2914 +
2915 +$| = 1;
2916 +
2917 +die "no data. Abort.\n" unless $total_line;
2918 +
2919 +my $sec_glob = &ConvDate ("$last_date") - &ConvDate ("$first_date");
2920 +unless ($sec_glob) {
2921 + print "WARNING: bad date (\"$last_date\" or \"$first_date\")\n" .
2922 + " Please, contact the author of innreport.\n";
2923 + $sec_glob = 24 * 60 * 60; # one day
2924 +}
2925 +
2926 +$HTML_output = '';
2927 +
2928 +if ($HTML) {
2929 + # Create a new filename (unique and _sortable_)
2930 + if ($ARCHIVE) {
2931 + # The filename will contain the first date of the log or the current time.
2932 + my ($ts, $tm, $th, $dd, $dm, $dy) = localtime;
2933 + my ($m, $d, $h, $mn, $s) =
2934 + $first_date =~ /^(\S+)\s+(\d+)\s+(\d+):(\d+):(\d+)$/;
2935 + if ($m) {
2936 + my $ddm = (index "JanFebMarAprMayJunJulAugSepOctNovDec", $m) / 3;
2937 + # Adjust the year because syslog doesn't record it. We assume that
2938 + # it's the current year unless the last date is in the future.
2939 + my $ld = &ConvDate($last_date);
2940 + $dy-- if $ld > $ts + 60 * ($tm + 60 * ($th + 24 * ($dd - 1 +
2941 + substr("000031059090120151181212243273304334", $dm * 3, 3)))) ||
2942 + $ld < &ConvDate($first_date);
2943 + ($dm, $dd, $th, $tm, $ts) = ($ddm, $d, $h, $mn, $s);
2944 + }
2945 + $dm++; # because January = 0 and we prefer 1
2946 + $dy += 100 if $dy < 90; # Try to pacify the year 2000 !
2947 + $dy += 1900;
2948 + $suffix = sprintf ".%02d.%02d.%02d-%02d$SEPARATOR%02d$SEPARATOR%02d",
2949 + $dy, $dm, $dd, $th, $tm, $ts;
2950 + }
2951 + else {
2952 + $suffix = '';
2953 + }
2954 + $HTML_output = "$HTML_dir" . "/news-notice" . "$suffix" . ".html";
2955 + $HTML_output =~ s|/+|/|g;
2956 + if (defined $output{'default'}{'html_header_file'}) {
2957 + my $file = &GetValue ($output{'default'}{'html_header_file'});
2958 + $file = $HTML_dir . "/" . $file;
2959 + open (F, $file) && do {
2960 + local $/ = undef;
2961 + $HTML_header = <F>;
2962 + close F;
2963 + };
2964 + }
2965 + if (defined $output{'default'}{'html_footer_file'}) {
2966 + my $file = &GetValue ($output{'default'}{'html_footer_file'});
2967 + $file = $HTML_dir . "/" . $file;
2968 + open (F, $file) && do {
2969 + local $/ = undef;
2970 + $HTML_footer = <F>;
2971 + close F;
2972 + };
2973 + }
2974 +}
2975 +
2976 +&Write_all_results ($HTML_output, \%output);
2977 +
2978 +&Make_Index ($HTML_dir, $index, "news-notice$suffix.html", \%output)
2979 + if $HTML && $index;
2980 +
2981 +#====================================================================
2982 +
2983 +if ($ARCHIVE) {
2984 + # rotate html files
2985 + &Rotate ($CYCLE, $HTML_dir, "news-notice", ".html");
2986 +
2987 + # rotate pictures
2988 + my $report;
2989 + foreach $report (@{$output{'_order_'}}) {
2990 + next if $report =~ m/^(default|index)$/;
2991 + next unless defined $output{$report}{'graph'};
2992 +
2993 + my $i = 0;
2994 + while ($GRAPH && defined ${${$output{$report}{'graph'}}[$i]}{'type'}) {
2995 + my $name = $report . ($i ? $i : '');
2996 + &Rotate ($CYCLE, $IMG_dir, $name, '.' . $GD_FORMAT);
2997 + $i++;
2998 + }
2999 + }
3000 +}
3001 +
3002 +# Code needed by INN only. It must be in innreport_inn.pm to keep things clean.
3003 +if (!$NOT_DAILY && defined $output{'default'}{'unwanted_log'}) {
3004 + my $logfile = &GetValue ($output{'default'}{'unwanted_log'});
3005 + my $logpath = &GetValue ($output{'default'}{'logpath'});
3006 + {
3007 + no strict;
3008 + &{$CLASS . "::report_unwanted_ng"} ("$logpath/$logfile");
3009 + }
3010 +}
3011 +
3012 +################
3013 +# End of report.
3014 +###################################################################
3015 +
3016 +######
3017 +# Misc...
3018 +
3019 +# Compare 2 dates (+hour)
3020 +sub DateCompare {
3021 + # ex: "May 12 06" for May 12, 6:00am
3022 + # The 2 dates are near. The range is less than a few days that's why we
3023 + # can cheat to determine the order. It is only important if one date
3024 + # is in January and the other in December.
3025 +
3026 + my $date1 = substr ($a, 4, 2) * 24;
3027 + my $date2 = substr ($b, 4, 2) * 24;
3028 + $date1 += index("JanFebMarAprMayJunJulAugSepOctNovDec",substr($a,0,3)) * 288;
3029 + $date2 += index("JanFebMarAprMayJunJulAugSepOctNovDec",substr($b,0,3)) * 288;
3030 + if ($date1 - $date2 > 300 * 24) {
3031 + $date2 += 288 * 3 * 12;
3032 + }
3033 + elsif ($date2 - $date1 > 300 * 24) {
3034 + $date1 += 288 * 3 * 12;
3035 + }
3036 + $date1 += substr($a, 7, 2);
3037 + $date2 += substr($b, 7, 2);
3038 + $date1 - $date2;
3039 +}
3040 +
3041 +
3042 +# Convert: seconds to hh:mm:ss
3043 +sub second2time {
3044 + my $temp;
3045 + my $t = shift;
3046 + # Hours
3047 + $temp = sprintf "%02d", $t / 3600;
3048 + my $chaine = "$temp:";
3049 + $t %= 3600;
3050 + # Min
3051 + $temp = sprintf "%02d", $t / 60;
3052 + $chaine .= "$temp:";
3053 + $t %= 60;
3054 + # Sec
3055 + $chaine .= sprintf "%02d", $t;
3056 + return $chaine;
3057 +}
3058 +
3059 +# Convert: milliseconds to hh:mm:ss:mm
3060 +sub ms2time {
3061 + my $temp;
3062 + my $t = shift;
3063 + # Hours
3064 + $temp = sprintf "%02d", $t / 3600000;
3065 + my $chaine = "$temp:";
3066 + $t %= 3600000;
3067 + # Min
3068 + $temp = sprintf "%02d", $t / 60000;
3069 + $chaine .= "$temp:";
3070 + $t %= 60000;
3071 + # Sec
3072 + $temp = sprintf "%02d", $t / 1000;
3073 + $chaine .= "$temp.";
3074 + $t %= 1000;
3075 + # Millisec
3076 + $chaine .= sprintf "%03d", $t;
3077 + return $chaine;
3078 +}
3079 +
3080 +# Rotate the archive files..
3081 +sub Rotate {
3082 + # Usage: &Rotate ($max_files, "$directory", "prefix", "suffix");
3083 + my ($max, $rep, $prefix, $suffix) = @_;
3084 + my ($file, $num, %files);
3085 + local ($a, $b);
3086 +
3087 + return 1 unless $max;
3088 + opendir (DIR, "$rep") || die "Error: Cant open directory \"$rep\"\n";
3089 +
3090 + FILE : while (defined ($file = readdir (DIR))) {
3091 + next FILE
3092 + unless $file =~ /^ # e.g. news-notice.1997.05.14-01:34:29.html
3093 + $prefix # Prefix : news-notice
3094 + \. # dot : .
3095 + (\d\d)?\d\d # Year : 1997 (or 97)
3096 + \. # dot : .
3097 + \d\d # Month : 05
3098 + \. # dot : .
3099 + \d\d # Day : 14
3100 + - # Separator : -
3101 + \d\d # Hour : 01
3102 + $SEPARATOR # Separator : ":"
3103 + \d\d # Minute : 34
3104 + $SEPARATOR # Separator : ":"
3105 + \d\d # Second : 29
3106 + $suffix # Suffix : ".html"
3107 + $/x;
3108 + $files{$file}++;
3109 + }
3110 + closedir DIR;
3111 + $num = 0;
3112 + foreach $file (sort {$b cmp $a} (keys (%files))) {
3113 + unlink "$rep/$file" if $num++ >= $max && -f "$rep/$file";
3114 + }
3115 + return 1;
3116 +}
3117 +
3118 +# convert a date to a number of seconds
3119 +sub ConvDate {
3120 + # usage: $num = &ConvDate ($date);
3121 + # date format is Aug 22 01:49:40
3122 + my $T = shift;
3123 + my ($m, $d, $h, $mn, $s) = $T =~ /^(\S+)\s+(\d+)\s+(\d+):(\d+):(\d+)$/;
3124 + my $out = $s + 60 * $mn + 3600 * $h + 86400 * ($d - 1);
3125 +
3126 + $m = substr("000031059090120151181212243273304334",
3127 + index ("JanFebMarAprMayJunJulAugSepOctNovDec", $m), 3);
3128 + $out += $m * 86400;
3129 + return $out;
3130 +}
3131 +
3132 +# Compare 2 filenames
3133 +sub filenamecmp {
3134 + my ($la, $lb) = ($a, $b);
3135 + my ($ya) = $la =~ m/news-notice\.(\d+)\./o;
3136 + $ya += 100 if $ya < 90; # Try to pacify the year 2000 !
3137 + $ya += 1900 if $ya < 1900; # xx -> xxxx
3138 + my ($yb) = $lb =~ m/news-notice\.(\d+)\./o;
3139 + $yb += 100 if $yb < 90; # Try to pacify the year 2000 !
3140 + $yb += 1900 if $yb < 1900; # xx -> xxxx
3141 +
3142 + $la =~ s/news-notice\.(\d+)\./$ya\./;
3143 + $lb =~ s/news-notice\.(\d+)\./$yb\./;
3144 + $la =~ s/[\.\-\:html]//g;
3145 + $lb =~ s/[\.\-\:html]//g;
3146 +
3147 + $lb <=> $la;
3148 +}
3149 +
3150 +sub ComputeTotal {
3151 + my $h = shift;
3152 + my $total = 0;
3153 + my $key;
3154 + foreach $key (keys (%$h)) {
3155 + $total += $$h{$key};
3156 + }
3157 + $total;
3158 +}
3159 +
3160 +sub ComputeTotalDouble {
3161 + my $h = shift;
3162 + my $total = 0;
3163 + my ($key1, $key2);
3164 + foreach $key1 (keys (%$h)) {
3165 + foreach $key2 (keys (%{$$h{$key1}})) {
3166 + $total += ${$$h{$key1}}{$key2};
3167 + }
3168 + }
3169 + $total;
3170 +}
3171 +
3172 +# make an index for archive pages
3173 +sub Make_Index {
3174 + my ($rep, $index, $filename, $data) = @_;
3175 + my %output = %$data;
3176 +
3177 + $index =~ s/^\"\s*(.*?)\s*\"$/$1/o;
3178 +
3179 + # add requested data at the end of the database.
3180 + open (DATA, ">> $rep/innreport.db") || die "can't open $rep/innreport.db\n";
3181 + my $i = 0;
3182 + my $res = "$filename";
3183 + while (defined ${${$output{'index'}{'column'}}[$i]}{'value'}) {
3184 + my $data = &GetValue (${${$output{'index'}{'column'}}[$i]}{'value'});
3185 + $data =~ s/\n//sog;
3186 + my @list = split /\|/, $data;
3187 + my $val;
3188 + foreach $val (@list) {
3189 + $res .= ($val eq 'date' ? "|$first_date -- $last_date"
3190 + : "|" . &EvalExpr($val));
3191 + }
3192 + $i++;
3193 + }
3194 + print DATA "$res\n";
3195 + close DATA;
3196 +
3197 + # sort the database (reverse order), remove duplicates.
3198 + open (DATA, "$rep/innreport.db") || die "can't open $rep/innreport.db\n";
3199 + my %data;
3200 + while (<DATA>) {
3201 + m/^([^\|]+)\|(.*)$/o;
3202 + $data{$1} = $2;
3203 + }
3204 + close DATA;
3205 + open (DATA, "> $rep/innreport.db") || die "can't open $rep/innreport.db\n";
3206 + $i = 0;
3207 + foreach (sort {$b cmp $a} (keys %data)) {
3208 + print DATA "$_|$data{$_}\n" if $CYCLE == 0 || $i < $CYCLE;
3209 + $i++;
3210 + }
3211 + close DATA;
3212 +
3213 + my $title = "Daily Usenet report";
3214 + $title = &GetValue ($output{'default'}{'title'})
3215 + if defined $output{'default'}{'title'};
3216 + $title =~ s/\\\"/\"/g;
3217 + my $Title = $title;
3218 + $Title =~ s/<.*?>//g;
3219 + my $body = '';
3220 + $body = &GetValue ($output{'default'}{'html_body'})
3221 + if defined $output{'default'}{'html_body'};
3222 + $body =~ s/\\\"/\"/go;
3223 + my $result = sprintf <<EOF;
3224 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
3225 +<HTML><HEAD>
3226 +<TITLE>$Title: index</TITLE>
3227 +</HEAD><BODY $body>
3228 +$HTML_header
3229 +<HR ALIGN=CENTER SIZE=\"4\" WIDTH=\"100%%\">
3230 +<BR><CENTER><FONT SIZE=\"+2\">
3231 +<B>$title - archives</B>
3232 +</FONT></CENTER>
3233 +<BR CLEAR=ALL>
3234 +<HR ALIGN=CENTER SIZE=4 WIDTH=\"100%%\"><P>
3235 +<CENTER>
3236 +EOF
3237 +
3238 + if ($GRAPH) {
3239 + my $i = 0;
3240 + while (defined ${${$output{'index'}{'graph'}}[$i]}{'title'}) {
3241 + my $title = &GetValue (${${$output{'index'}{'graph'}}[$i]}{'title'});
3242 + my $filename = "index$i.$GD_FORMAT";
3243 + my $color_bg = &GetValue (${${$output{'index'}{'graph'}}[$i]}{'color'});
3244 + my $unit = &GetValue (${${$output{'index'}{'graph'}}[$i]}{'unit'});
3245 + my $date_idx = &GetValue (${${$output{'index'}{'graph'}}[$i]}{'value'});
3246 + $date_idx =~ s/^val(\d+)$/$1/o;
3247 + my @c = @{${${$output{'index'}{'graph'}}[$i]}{'data'}};
3248 + my $label_in = &GetValue (${$c[0]}{'name'});
3249 + my $color_in = &GetValue (${$c[0]}{'color'});
3250 + my $value_in = &GetValue (${$c[0]}{'value'});
3251 + my $type_in = 0;
3252 + $type_in = $value_in =~ s/^byte\((.*?)\)$/$1/o;
3253 + $value_in =~ s/^val(\d+)$/$1/o;
3254 + my $label_out = &GetValue (${$c[1]}{'name'});
3255 + my $color_out = &GetValue (${$c[1]}{'color'});
3256 + my $value_out = &GetValue (${$c[1]}{'value'});
3257 + my $type_out = 0;
3258 + $type_out = $value_out =~ s/^byte\((.*?)\)$/$1/o;
3259 + $value_out =~ s/^val(\d+)$/$1/o;
3260 + my (%in, %out, %dates, $k);
3261 + foreach $k (keys (%data)) {
3262 + my @res = split /\|/, $data{$k};
3263 + my ($year) = $k =~ m/^news-notice\.(\d+)\.\d+\.\d+-\d+.\d+.\d+\.html/;
3264 + next unless $year; # bad filename.. strange.
3265 + my ($start, $end) =
3266 + $res[$date_idx - 1] =~ m/^(\w+\s+\d+ \S+) -- (\w+\s+\d+ \S+)$/o;
3267 + next unless $start; # bad date
3268 + $start = &ConvDate ($start);
3269 + $end = &ConvDate ($end);
3270 + # 31/12 - 1/1 ?
3271 + my $inc = $end < $start ? 1 : 0;
3272 + $start += (($year - 1970) * 365 +
3273 + int (($year - 1968) / 4)) * 3600 * 24;
3274 + $year += $inc;
3275 + $end += (($year - 1970) * 365 + int (($year - 1968) / 4)) * 3600 * 24;
3276 + $in{$start} = $type_in ? &kb2i($res[$value_in - 1])
3277 + : $res[$value_in - 1];
3278 + $out{$start} = $type_out ? &kb2i($res[$value_out - 1])
3279 + : $res[$value_out - 1];
3280 + $dates{$start} = $end;
3281 + }
3282 + my ($xmax, $ymax) = (500, 170);
3283 + &Chrono ("$IMG_dir/$filename", $title, $color_bg, $xmax, $ymax,
3284 + \%in, \%out, \%dates, $label_in, $label_out,
3285 + $color_in, $color_out, $unit);
3286 + $result .= "<IMG WIDTH=\"$xmax\" HEIGHT=\"$ymax\" ";
3287 + $result .= "SRC=\"$IMG_pth$filename\" ALT=\"Graph\">\n";
3288 + $i++;
3289 + }
3290 + $result .= "<P>\n";
3291 + }
3292 + $i = 0;
3293 + $result .= "<TABLE BORDER=\"1\"><TR>";
3294 + my $temp = '';
3295 + while (defined ${${$output{'index'}{'column'}}[$i]}{'title'}) {
3296 + my $title = &GetValue (${${$output{'index'}{'column'}}[$i]}{'title'});
3297 + my $name = '';
3298 + $name = &GetValue (${${$output{'index'}{'column'}}[$i]}{'name'})
3299 + if defined ${${$output{'index'}{'column'}}[$i]}{'name'};
3300 + my @list = split /\|/, $name;
3301 + if ($name) {
3302 + $result .= sprintf "<TH COLSPAN=%d>$title</TH>", $#list + 1;
3303 + }
3304 + else {
3305 + $result .= "<TH ROWSPAN=\"2\">$title</TH>";
3306 + }
3307 + foreach (@list) {
3308 + $temp .= "<TH>$_</TH>";
3309 + }
3310 + $i++;
3311 + }
3312 + $result .= "</TR>\n<TR>$temp</TR>\n";
3313 +
3314 + $i = 0;
3315 + foreach (sort {$b cmp $a} (keys %data)) {
3316 + if ($CYCLE == 0 || $i < $CYCLE) {
3317 + my @list = split /\|/, $data{$_};
3318 + my $str = "<TR><TD ALIGN=LEFT>";
3319 + $str .= "<A HREF=\"$_\">" if -e "$rep/$_";
3320 + $str .= shift @list;
3321 + $str .= "</A>" if -e "$rep/$_";;
3322 + $str .= "</TD>";
3323 + while (@list) {
3324 + $str .= "<TD ALIGN=RIGHT>";
3325 + my $t = shift @list;
3326 + $t =~ s/^\0+//o; # remove garbage, if any.
3327 + $str .= "$t</TD>";
3328 + }
3329 + $str .= "</TR>\n";
3330 + $result .= "$str";
3331 + }
3332 + $i++;
3333 + }
3334 + $result .= "</TABLE>\n</CENTER>\n<P><HR>";
3335 + $result .= "<A HREF=\"ftp://ftp.sofaraway.org/pub/innreport/\">innreport";
3336 + $result .= "</A> $version (c) 1996-1999 ";
3337 + $result .= "by Fabien Tassin &lt;<A HREF=\"mailto:fta\@sofaraway.org\">";
3338 + $result .= "fta\@sofaraway.org</A>&gt;.\n";
3339 + if (defined ($output{'default'}{'footer'})) {
3340 + my ($t) = $output{'default'}{'footer'} =~ m/^\"\s*(.*?)\s*\"$/o;
3341 + $t =~ s/\\\"/\"/go;
3342 + $result .= "<BR>" . $t;
3343 + }
3344 + $result .= "$HTML_footer\n</BODY>\n</HTML>\n";
3345 + my $name = $rep . "/" . $index;
3346 + while ($name =~ m/\/\.\.\//o) {
3347 + $name =~ s|^\./||o; # ^./xxx => ^xxx
3348 + $name =~ s|/\./|/|go; # xxx/./yyy => xxx/yyy
3349 + $name =~ s|/+|/|go; # xxx//yyy => xxx/yyy
3350 + $name =~ s|^/\.\./|/|o; # ^/../xxx => ^/xxx
3351 + $name =~ s|^[^/]+/\.\./||o; # ^xxx/../ => ^nothing
3352 + $name =~ s|/[^/]+/\.\./|/|go; # /yyy/../ => /
3353 + }
3354 +
3355 + open (INDEX, "> $name") || die "Error: Unable to create $name\n";
3356 + print INDEX $result;
3357 + close INDEX;
3358 + 1;
3359 +}
3360 +
3361 +sub Graph3d {
3362 + my $filename = shift; # filename
3363 + my $title = shift; # title
3364 + my $xmax = shift; # width
3365 + my $n = shift; # Number of hash code tables
3366 +
3367 + no strict;
3368 + my ($i, $k, $t);
3369 + my @val;
3370 + for $i (0 .. $n - 1) {
3371 + push @val, shift; # hash code table
3372 + }
3373 + my $colors = shift; # colors table
3374 + my $labels = shift; # labels
3375 +
3376 + my $max = 0;
3377 + my $max_size = 0;
3378 + my $size = 0;
3379 + foreach $k (sort keys (%{$val[0]})) {
3380 + $t = 0;
3381 + $size++;
3382 + for $i (0 .. $n - 1) {
3383 + $t += ${$val[$i]}{$k} if defined ${$val[$i]}{$k};
3384 + }
3385 + $max = $t if $max < $t;
3386 + $t = length "$k";
3387 + $max_size = $t if $max_size < $t;
3388 + }
3389 + $max = 1 unless $max;
3390 + $max_size *= gdSmallFont->width;
3391 +
3392 + # relief
3393 + my ($rx, $ry) = (15, 5);
3394 +
3395 + # margins
3396 + my ($mt, $mb) = (40, 40);
3397 + my $ml = $max_size > 30 ? $max_size + 8 : 30;
3398 +
3399 + my $mr = 7 + (length "$max") * gdSmallFont->width;
3400 + $mr = 30 if $mr < 30;
3401 +
3402 + # height of each bar
3403 + my $h = 12;
3404 +
3405 + # difference between 2 bars
3406 + my $d = 25;
3407 +
3408 + my $ymax = $size * $d + $mt + $mb;
3409 + my $image = new GD::Image ($xmax, $ymax);
3410 +
3411 + my ($white, $black);
3412 + if (defined $output{'default'}{'graph_fg'}) {
3413 + my $t = $output{'default'}{'graph_fg'};
3414 + $t =~ s/^\"\s*\#(.*?)\s*\"$/$1/o;
3415 + $t =~ m/^[\da-fA-F]{6}$/o ||
3416 + die "Error in section 'default' section 'graph_fg'. Bad color.\n";
3417 + my @c = map { hex ($_) } ($t =~ m/^(..)(..)(..)$/);
3418 + $black = $image->colorAllocate (@c);
3419 + }
3420 + else {
3421 + $black = $image->colorAllocate ( 0, 0, 0);
3422 + }
3423 + if (defined $output{'default'}{'graph_bg'}) {
3424 + my $t = $output{'default'}{'graph_bg'};
3425 + $t =~ s/^\"\s*\#(.*?)\s*\"$/$1/o;
3426 + $t =~ m/^[\da-fA-F]{6}$/o ||
3427 + die "Error in section 'default' section 'graph_bg'. Bad color.\n";
3428 + my @c = map { hex ($_) } ($t =~ m/^(..)(..)(..)$/);
3429 + $white = $image->colorAllocate (@c);
3430 + }
3431 + else {
3432 + $white = $image->colorAllocate (255, 255, 255);
3433 + }
3434 + $image->filledRectangle (0, 0, $xmax, $ymax, $white);
3435 + my @col;
3436 + for $i (0 .. $n - 1) {
3437 + $col[$i][0] = $image->colorAllocate
3438 + ($$colors[$i][0], $$colors[$i][1], $$colors[$i][2]);
3439 + $col[$i][1] = $image->colorAllocate
3440 + ($$colors[$i][0] * 3 / 4, $$colors[$i][1] * 3 / 4,
3441 + $$colors[$i][2] * 3 / 4);
3442 + $col[$i][2] = $image->colorAllocate
3443 + ($$colors[$i][0] * 2 / 3, $$colors[$i][1] * 2 / 3,
3444 + $$colors[$i][2] * 2 / 3);
3445 + }
3446 +
3447 + $image->transparent ($white) if $transparent;
3448 +
3449 + $image->rectangle (0, 0, $xmax - 1, $size * $d + $mt + $mb - 1, $black);
3450 + $image->line (0, $mt - 5, $xmax - 1, $mt - 5, $black);
3451 + for $i (0 .. $n - 1) {
3452 + $image->string (gdSmallFont, $i * $xmax / $n + $mt - 10 + $rx,
3453 + ($mt - gdSmallFont->height) / 2, "$$labels[$i]", $black);
3454 + $image->filledRectangle ($i * $xmax / $n + 10, 8 + $ry / 2,
3455 + $i * $xmax / $n + $mt - 10, $mt - 12, $col[$i][0]);
3456 + $image->rectangle ($i * $xmax / $n + 10, 8 + $ry / 2,
3457 + $i * $xmax / $n + $mt - 10, $mt - 12, $black);
3458 + {
3459 + my $poly = new GD::Polygon;
3460 + $poly->addPt($i * $xmax / $n + 10, 8 + $ry / 2);
3461 + $poly->addPt($i * $xmax / $n + 10 + $rx / 2, 8);
3462 + $poly->addPt($i * $xmax / $n + $mt - 10 + $rx / 2, 8);
3463 + $poly->addPt($i * $xmax / $n + $mt - 10, 8 + $ry / 2);
3464 +
3465 + $image->filledPolygon($poly, $col[$i][1]);
3466 + $image->polygon($poly, $black);
3467 + }
3468 + {
3469 + my $poly = new GD::Polygon;
3470 + $poly->addPt($i * $xmax / $n + $mt - 10 + $rx / 2, 8);
3471 + $poly->addPt($i * $xmax / $n + $mt - 10, 8 + $ry / 2);
3472 + $poly->addPt($i * $xmax / $n + $mt - 10, $mt - 12);
3473 + $poly->addPt($i * $xmax / $n + $mt - 10 + $rx / 2, $mt - 12 - $ry / 2);
3474 +
3475 + $image->filledPolygon($poly, $col[$i][2]);
3476 + $image->polygon($poly, $black);
3477 + }
3478 + }
3479 + # Title
3480 + $image->string (gdMediumBoldFont, ($xmax - gdMediumBoldFont->width *
3481 + (length "$title")) / 2, $ymax - gdMediumBoldFont->height - 7,
3482 + "$title", $black);
3483 +
3484 + my $e = $mt - $h + $d;
3485 + my $r = ($xmax - $ml - $mr - $rx) / $max;
3486 +
3487 + # Axe Oz
3488 + $image->line ($ml + $rx, $mt, $ml + $rx, $size * $d + $mt - $ry, $black);
3489 + $image->line ($ml + $rx + $max * $r, $mt, $ml + $rx + $max * $r,
3490 + $size * $d + $mt - $ry, $black);
3491 + $image->line ($ml, $mt + $ry, $ml, $size * $d + $mt, $black);
3492 + # Axe Ox
3493 + $image->line ($ml + $rx, $size * $d + $mt - $ry,
3494 + $ml + $rx - 2 * $rx, $size * $d + $mt + $ry, $black);
3495 + # Axe Oy
3496 + $image->line ($ml + $rx, $size * $d + $mt - $ry,
3497 + $xmax - $mr / 2, $size * $d + $mt - $ry, $black);
3498 + $image->line ($ml, $size * $d + $mt,
3499 + $xmax - $mr - $rx, $size * $d + $mt, $black);
3500 +
3501 + # Graduations..
3502 + my $nn = 10;
3503 + for $k (1 .. ($nn - 1)) {
3504 + $image->dashedLine ($ml + $rx + $k * ($xmax - $ml - $mr - $rx) / $nn,
3505 + $mt + 10, $ml + $rx + $k * ($xmax - $ml - $mr - $rx) / $nn,
3506 + $size * $d + $mt - $ry, $black);
3507 + $image->dashedLine ($ml + $rx + $k * ($xmax - $ml - $mr - $rx) / $nn,
3508 + $size * $d + $mt - $ry,
3509 + $ml + $k * ($xmax - $ml - $mr - $rx) / $nn,
3510 + $size * $d + $mt, $black);
3511 + $image->line ($ml + $k * ($xmax - $ml - $mr - $rx) / $nn,
3512 + $size * $d + $mt,
3513 + $ml + $k * ($xmax - $ml - $mr - $rx) / $nn,
3514 + $size * $d + $mt + 5, $black);
3515 + my $t = sprintf "%d%%", $k * 10;
3516 + $image->string (gdSmallFont, $ml + $k * ($xmax - $ml - $mr - $rx) / $nn -
3517 + (length "$t") * gdSmallFont->width / 2,
3518 + $size * $d + $mt + 6, "$t", $black);
3519 + }
3520 + {
3521 + my $t = sprintf "%d%%", 0;
3522 + $image->line ($ml, $size * $d + $mt, $ml, $size * $d + $mt + 5, $black);
3523 + $image->string (gdSmallFont, $ml - (length "$t") * gdSmallFont->width / 2,
3524 + $size * $d + $mt + 6, "$t", $black);
3525 + $image->line ($xmax - $mr, $size * $d + $mt - $ry,
3526 + $xmax - $mr - $rx, $size * $d + $mt, $black);
3527 + $image->line ($xmax - $mr - $rx, $size * $d + $mt,
3528 + $xmax - $mr - $rx, $size * $d + $mt + 5, $black);
3529 + $t = sprintf "%d%%", 100;
3530 + $image->string (gdSmallFont, $xmax - $mr - $rx
3531 + - (length "$t") * gdSmallFont->width / 2,
3532 + $size * $d + $mt + 6, "$t", $black);
3533 + }
3534 + foreach $k (sort {${$val[0]}{$b} <=> ${$val[0]}{$a}} keys (%{$val[0]})) {
3535 + $image->string (gdSmallFont, $ml - (length "$k") * gdSmallFont->width - 3,
3536 + $e + $h / 2 - gdSmallFont->height / 2, "$k", $black);
3537 + my $t = 0;
3538 + $image->line ($ml + ($t + ${$val[0]}{$k}) * $r + $rx - $rx, $e + $h,
3539 + $ml + ($t + ${$val[0]}{$k}) * $r + $rx, $e - $ry + $h,
3540 + $black);
3541 + for $i (0 .. $n - 1) {
3542 + next unless defined ${$val[$i]}{$k};
3543 + {
3544 + my $poly = new GD::Polygon;
3545 + $poly->addPt($ml + $t * $r, $e);
3546 + $poly->addPt($ml + $t * $r + $rx, $e - $ry);
3547 + $poly->addPt($ml + ($t + ${$val[$i]}{$k}) * $r + $rx, $e - $ry);
3548 + $poly->addPt($ml + ($t + ${$val[$i]}{$k}) * $r, $e);
3549 +
3550 + $image->filledPolygon($poly, $col[$i][1]);
3551 + $image->polygon($poly, $black);
3552 + }
3553 + unless (${$val[$i + 1]}{$k} || ${$val[$i]}{$k} == 0) {
3554 + my $poly = new GD::Polygon;
3555 + $poly->addPt($ml + ($t + ${$val[$i]}{$k}) * $r + $rx, $e - $ry);
3556 + $poly->addPt($ml + ($t + ${$val[$i]}{$k}) * $r + $rx - $rx, $e);
3557 + $poly->addPt($ml + ($t + ${$val[$i]}{$k}) * $r + $rx - $rx, $e + $h);
3558 + $poly->addPt($ml + ($t + ${$val[$i]}{$k}) * $r + $rx, $e - $ry + $h);
3559 +
3560 + $image->filledPolygon($poly, $col[$i][2]);
3561 + $image->polygon($poly, $black);
3562 + }
3563 + $image->filledRectangle ($ml + $t * $r, $e,
3564 + $ml + ($t + ${$val[$i]}{$k}) * $r, $e + $h,
3565 + $col[$i][0]);
3566 + $image->rectangle ($ml + $t * $r, $e, $ml + ($t + ${$val[$i]}{$k}) * $r,
3567 + $e + $h, $black);
3568 + $t += ${$val[$i]}{$k};
3569 + }
3570 + # total length (offered)
3571 + $image->filledRectangle ($ml + $t * $r + $rx + 3,
3572 + $e - 2 - gdSmallFont->height / 2,
3573 + $ml + $t * $r + $rx + 4 +
3574 + gdSmallFont->width * length $t,
3575 + $e - 6 + gdSmallFont->height / 2, $white);
3576 + $image->string (gdSmallFont, $ml + $t * $r + $rx + 5,
3577 + $e - 3 - gdSmallFont->height / 2, "$t", $black);
3578 + # first value (accepted)
3579 + $image->filledRectangle ($ml + $t * $r + $rx + 3,
3580 + $e - 4 + gdSmallFont->height / 2,
3581 + $ml + $t * $r + $rx + 4 +
3582 + gdSmallFont->width * length "${$val[0]}{$k}",
3583 + $e - 2 + gdSmallFont->height, $white);
3584 + $image->string (gdSmallFont, $ml + $t * $r + $rx + 5,
3585 + $e - 5 + gdSmallFont->height / 2, ${$val[0]}{$k}, $black);
3586 + $e += $d;
3587 + }
3588 + open (IMG, "> $filename") || die "Error: Can't open \"$filename\": $!\n";
3589 + if ($GD_FORMAT eq 'png') {
3590 + print IMG $image->png;
3591 + }
3592 + else {
3593 + print IMG $image->gif;
3594 + }
3595 + close IMG;
3596 + $ymax;
3597 +}
3598 +
3599 +sub Histo {
3600 + my ($filename, $title, $xmax, $factor,
3601 + $labelx, $labely, $val1, $labels1) = @_;
3602 +
3603 + no strict;
3604 + my $max = 0;
3605 + my $ymax = 300;
3606 + my $nb = 0;
3607 + # A hugly hack to convert hashes to lists..
3608 + # and to adjust the first and the last value...
3609 + # this function should be rewritten..
3610 + my (@a, @b, $kk);
3611 + foreach $kk (sort keys (%$val1)) {
3612 + if (defined $$val1{$kk}) {
3613 + $nb++;
3614 + # Arg... the following MUST be removed !!!!!!!!!
3615 + $$val1{$kk} = $$val1{$kk} / $innreport_inn::inn_flow_time{$kk} * 3600
3616 + if ($innreport_inn::inn_flow_time{$kk} != 3600) &&
3617 + ($innreport_inn::inn_flow_time{$kk} != 0);
3618 + push @a, $$val1{$kk};
3619 + $max = $$val1{$kk} if $$val1{$kk} > $max;
3620 + push @b, $$labels1{$kk};
3621 + }
3622 + }
3623 + return 0 unless $nb; # strange, no data.
3624 + my $val = \@a;
3625 + my $labels = \@b;
3626 + my ($i, $j);
3627 + my ($marginl, $marginr, $margint, $marginb, $shx, $shy);
3628 +
3629 + my $image = new GD::Image($xmax, $ymax);
3630 + my ($white, $black);
3631 + if (defined $output{'default'}{'graph_fg'}) {
3632 + my $t = $output{'default'}{'graph_fg'};
3633 + $t =~ s/^\"\s*\#(.*?)\s*\"$/$1/o;
3634 + $t =~ m/^[\da-fA-F]{6}$/o ||
3635 + die "Error in section 'default' section 'graph_fg'. Bad color.\n";
3636 + my @c = map { hex ($_) } ($t =~ m/^(..)(..)(..)$/);
3637 + $black = $image->colorAllocate (@c);
3638 + }
3639 + else {
3640 + $black = $image->colorAllocate ( 0, 0, 0);
3641 + }
3642 + if (defined $output{'default'}{'graph_bg'}) {
3643 + my $t = $output{'default'}{'graph_bg'};
3644 + $t =~ s/^\"\s*\#(.*?)\s*\"$/$1/o;
3645 + $t =~ m/^[\da-fA-F]{6}$/o ||
3646 + die "Error in section 'default' section 'graph_bg'. Bad color.\n";
3647 + my @c = map { hex $_ } ($t =~ m/^(..)(..)(..)$/);
3648 + $white = $image->colorAllocate (@c);
3649 + }
3650 + else {
3651 + $white = $image->colorAllocate (255, 255, 255);
3652 + }
3653 + $image->filledRectangle (0, 0, $xmax, $ymax, $white);
3654 + my $gray = $image->colorAllocate (128, 128, 128);
3655 + my $red = $image->colorAllocate (255, 0, 0);
3656 + my $red2 = $image->colorAllocate (189, 0, 0);
3657 + my $red3 = $image->colorAllocate (127, 0, 0);
3658 + my $coltxt = $black;
3659 +
3660 + $image->transparent ($white) if $transparent;
3661 +
3662 + my $FontWidth = gdSmallFont->width;
3663 + my $FontHeight = gdSmallFont->height;
3664 +
3665 + $marginl = 60;
3666 + $marginr = 30;
3667 + $margint = 60;
3668 + $marginb = 30;
3669 + $shx = 7;
3670 + $shy = 7;
3671 +
3672 + $max = 1 unless $max;
3673 + my $part = 8;
3674 + $max /= $factor;
3675 +
3676 + my $old_max = $max;
3677 + {
3678 + my $t = log ($max) / log 10;
3679 + $t = sprintf "%.0f", $t - 1;
3680 + $t = exp ($t * log 10);
3681 + $max = sprintf "%.0f", $max / $t * 10 + 0.4;
3682 + my $t2 = sprintf "%.0f", $max / $part;
3683 + unless ($part * $t2 == $max) {
3684 + while ($part * $t2 != $max) {
3685 + $max++;
3686 + $t2 = sprintf "%d", $max / $part;
3687 + }
3688 + }
3689 + $max = $max * $t / 10;
3690 + }
3691 +
3692 + # Title
3693 + $image->string (gdMediumBoldFont,
3694 + ($xmax - length ($title) * gdMediumBoldFont->width) / 2,
3695 + ($margint - $shy - gdMediumBoldFont->height) / 2,
3696 + $title, $coltxt);
3697 +
3698 + # Labels
3699 + $image->string (gdSmallFont, $marginl / 2, $margint / 2, $labely, $coltxt);
3700 + $image->string (gdSmallFont, $xmax - $marginr / 2 -
3701 + $FontWidth * length ($labelx), $ymax - $marginb / 2,
3702 + $labelx, $coltxt);
3703 +
3704 + # Max
3705 + $image->line ($marginl, $ymax - $marginb - $shy -
3706 + $old_max * ($ymax - $marginb - $margint - $shy) / $max,
3707 + $xmax - $marginr, $ymax - $marginb - $shy -
3708 + $old_max * ($ymax - $marginb - $margint - $shy) / $max, $red);
3709 + $image->line ($marginl, $ymax - $marginb - $shy -
3710 + $old_max * ($ymax - $marginb - $margint - $shy) / $max,
3711 + $marginl - $shx, $ymax - $marginb -
3712 + $old_max * ($ymax - $marginb - $margint - $shy) / $max, $red);
3713 +
3714 + # Left
3715 + $image->line ($marginl - $shx, $margint + $shy,
3716 + $marginl - $shx, $ymax - $marginb, $coltxt);
3717 + $image->line ($marginl, $margint,
3718 + $marginl, $ymax - $marginb - $shy, $coltxt);
3719 + $image->line ($marginl, $margint,
3720 + $marginl - $shx, $margint + $shy, $coltxt);
3721 + $image->line ($marginl - $shx, $ymax - $marginb,
3722 + $marginl, $ymax - $marginb - $shy, $coltxt);
3723 +
3724 + # Right
3725 + $image->line ($xmax - $marginr, $margint,
3726 + $xmax - $marginr, $ymax - $marginb - $shy, $coltxt);
3727 + $image->line ($xmax - $marginr - $shx, $ymax - $marginb,
3728 + $xmax - $marginr, $ymax - $marginb - $shy, $coltxt);
3729 +
3730 + # Bottom
3731 + $image->line ($marginl - $shx, $ymax - $marginb,
3732 + $xmax - $marginr - $shx, $ymax - $marginb, $coltxt);
3733 + $image->line ($marginl, $ymax - $marginb - $shy,
3734 + $xmax - $marginr, $ymax - $marginb - $shy, $coltxt);
3735 + $image->fill ($xmax / 2, $ymax - $marginb - $shy / 2, $gray);
3736 +
3737 + # Top
3738 + $image->line ($marginl, $margint,
3739 + $xmax - $marginr, $margint, $coltxt);
3740 + $image->setStyle ($coltxt, $coltxt, &GD::gdTransparent,
3741 + &GD::gdTransparent, &GD::gdTransparent);
3742 + # Graduations
3743 + for ($i = 0; $i <= $part; $i++) {
3744 + $j = $max * $i / $part ; # Warning to floor
3745 + # $j = ($max / $part) * ($i / 10000);
3746 + # $j *= 10000;
3747 +
3748 + # Little hack...
3749 + $j = sprintf "%d", $j if $j > 100;
3750 +
3751 + $image->line ($marginl - $shx - 3, $ymax - $marginb -
3752 + $i * ($ymax - $marginb - $margint - $shy) / $part,
3753 + $marginl - $shx, $ymax - $marginb -
3754 + $i * ($ymax - $marginb - $margint - $shy) / $part, $coltxt);
3755 + $image->line ($marginl - $shx, $ymax - $marginb -
3756 + $i * ($ymax - $marginb - $margint - $shy) / $part,
3757 + $marginl, $ymax - $marginb - $shy -
3758 + $i * ($ymax - $marginb - $margint - $shy) / $part, gdStyled);
3759 + $image->line ($marginl, $ymax - $marginb - $shy -
3760 + $i * ($ymax - $marginb - $margint - $shy) / $part,
3761 + $xmax - $marginr, $ymax - $marginb - $shy -
3762 + $i * ($ymax - $marginb - $margint - $shy) / $part, gdStyled);
3763 + $image->string (gdSmallFont,
3764 + $marginl - $shx - $FontWidth * length ("$j") - 7,
3765 + $ymax - $marginb -
3766 + ($i) * ($ymax - $marginb - $margint - $shy) / ($part) -
3767 + $FontHeight / 2, "$j", $coltxt);
3768 + }
3769 +
3770 + # Graduation (right bottom corner)
3771 + $image->line ($xmax - $marginr - $shx, $ymax - $marginb,
3772 + $xmax - $marginr - $shx, $ymax - $marginb + 3, $coltxt);
3773 + # Bars
3774 + $i = 0;
3775 + my $w = ($xmax - $marginl - $marginr) / $nb;
3776 + my $k = $w / 5;
3777 + $$val[$nb - 1] = 0 unless $$val[$nb - 1];
3778 + foreach $j (@$val) {
3779 + my $MAX = 1;
3780 + if ($i++ <= $nb) {
3781 + # Graduation
3782 + $image->line ($marginl + ($i - 1) * $w - $shx, $ymax - $marginb,
3783 + $marginl + ($i - 1) * $w - $shx, $ymax - $marginb + 3,
3784 + $coltxt);
3785 + my $ii = sprintf "%d", $i / $MAX;
3786 + $image->string (gdSmallFont,
3787 + $marginl + ($i - 0.5) * $w + 1 -
3788 + ($FontWidth * length ($$labels[$i-1])) / 2 - $shx,
3789 + $ymax - $marginb + 3, $$labels[$i-1], $coltxt)
3790 + unless ($w < $FontWidth * length ($$labels[$i-1]))
3791 + && ($i != $MAX * $ii);
3792 +
3793 + # Right
3794 + my $poly = new GD::Polygon;
3795 + $poly->addPt($marginl + ($i) * $w - $k, $ymax - $marginb - $shy -
3796 + $j / $factor * ($ymax - $marginb - $margint - $shy) / $max);
3797 + $poly->addPt($marginl + ($i) * $w - $k, $ymax - $marginb - $shy);
3798 + $poly->addPt($marginl + ($i) * $w - $k - $shx, $ymax - $marginb);
3799 + $poly->addPt($marginl + ($i) * $w - $k - $shx, $ymax - $marginb -
3800 + $j / $factor * ($ymax - $marginb - $margint - $shy) / $max);
3801 +
3802 + $image->filledPolygon($poly, $red3);
3803 + $image->polygon($poly, $coltxt);
3804 +
3805 + # Front
3806 + $image->filledRectangle ($marginl + ($i - 1) * $w + $k - $shx,
3807 + $ymax - $marginb -
3808 + $j / $factor * ($ymax - $marginb - $margint - $shy) / $max,
3809 + $marginl + ($i) * $w - $k - $shx,
3810 + $ymax - $marginb, $red);
3811 + $image->rectangle ($marginl + ($i - 1) * $w + $k - $shx,
3812 + $ymax - $marginb -
3813 + $j / $factor * ($ymax - $marginb - $margint - $shy) / $max,
3814 + $marginl + ($i) * $w - $k - $shx,
3815 + $ymax - $marginb, $coltxt);
3816 + # Top
3817 + my $poly2 = new GD::Polygon;
3818 + $poly2->addPt($marginl + ($i - 1) * $w + $k, $ymax - $marginb - $shy -
3819 + $j / $factor * ($ymax - $marginb - $margint - $shy) / $max);
3820 + $poly2->addPt($marginl + ($i) * $w - $k, $ymax - $marginb - $shy -
3821 + $j / $factor * ($ymax - $marginb - $margint - $shy) / $max);
3822 + $poly2->addPt($marginl + ($i) * $w - $k - $shx, $ymax - $marginb -
3823 + $j / $factor * ($ymax - $marginb - $margint - $shy) / $max);
3824 + $poly2->addPt($marginl + ($i - 1) * $w + $k - $shx, $ymax - $marginb -
3825 + $j / $factor * ($ymax - $marginb - $margint - $shy) / $max);
3826 +
3827 + $image->rectangle (0, 0, $xmax - 1, $ymax - 1, $coltxt);
3828 + $image->filledPolygon($poly2, $red2);
3829 + $image->polygon($poly2, $coltxt);
3830 + }
3831 + }
3832 +
3833 + open (IMG, "> $filename") || die "Can't create '$filename'\n";
3834 + if ($GD_FORMAT eq 'png') {
3835 + print IMG $image->png;
3836 + }
3837 + else {
3838 + print IMG $image->gif;
3839 + }
3840 + close IMG;
3841 + 1;
3842 +}
3843 +
3844 +sub Chrono {
3845 + my $filename = shift; # filename
3846 + my $title = shift; # title
3847 + my $color_bg = shift; # background color
3848 + my $xmax = shift; # width
3849 + my $ymax = shift; # height
3850 +
3851 + my $in = shift;
3852 + my $out = shift;
3853 + my $dates = shift;
3854 +
3855 + my $legend_in = shift;
3856 + my $legend_out = shift;
3857 +
3858 + my $color_in = shift;
3859 + my $color_out = shift;
3860 +
3861 + my $unit = shift;
3862 +
3863 + my $key;
3864 + my $x_min = 1E30;
3865 + my $x_max = 0;
3866 + my $y_min = 0;
3867 + my $y_max;
3868 + my $y_max_in = 0;
3869 + my $y_max_out = 0;
3870 +
3871 + foreach $key (sort keys %$dates) {
3872 + $x_min = $key if $x_min > $key;
3873 + $x_max = $$dates{$key} if $x_max < $$dates{$key};
3874 + my $t = $$out{$key} / ($$dates{$key} - $key);
3875 + $y_max_out = $t if $y_max_out < $t;
3876 + $t = $$in{$key} / ($$dates{$key} - $key);
3877 + $y_max_in = $t if $y_max_in < $t;
3878 + }
3879 + $y_max = $y_max_out > $y_max_in ? $y_max_out : $y_max_in;
3880 + my $factor = 1;
3881 + if ($y_max < 1) {
3882 + $factor = 60;
3883 + if ($y_max < 4 / 60) {
3884 + $y_max = 4 / 60;
3885 + }
3886 + else {
3887 + $y_max = int ($y_max * $factor) + 1;
3888 + $y_max += (4 - ($y_max % 4)) % 4;
3889 + $y_max /= $factor;
3890 + }
3891 + }
3892 + else {
3893 + $y_max = int ($y_max) + 1;
3894 + $y_max += (4 - ($y_max % 4)) % 4;
3895 + }
3896 +
3897 + $unit .= "/" . ($factor == 60 ? "min" : "sec");
3898 +
3899 + # min range is 4 weeks.
3900 + my $delta = $x_max - $x_min;
3901 + $x_min = $x_max - 3024000 if $delta < 3024000;
3902 + # between 4 weeks and one year, range is a year.
3903 + $x_min = $x_max - 31536000 if ($delta < 31536000 && $delta > 3024000);
3904 + # max range is 13 months
3905 + $x_min = $x_max - 34128000 if $delta > 34128000;
3906 + my $image = new GD::Image ($xmax, $ymax);
3907 + my ($white, $black);
3908 + if (defined $output{'default'}{'graph_fg'}) {
3909 + my $t = $output{'default'}{'graph_fg'};
3910 + $t =~ s/^\"\s*\#(.*?)\s*\"$/$1/o;
3911 + $t =~ m/^[\da-fA-F]{6}$/o ||
3912 + die "Error in section 'default' section 'graph_fg'. Bad color.\n";
3913 + my @c = map { hex $_ } ($t =~ m/^(..)(..)(..)$/);
3914 + $black = $image->colorAllocate (@c);
3915 + }
3916 + else {
3917 + $black = $image->colorAllocate ( 0, 0, 0);
3918 + }
3919 + if (defined $output{'default'}{'graph_bg'}) {
3920 + my $t = $output{'default'}{'graph_bg'};
3921 + $t =~ s/^\"\s*\#(.*?)\s*\"$/$1/o;
3922 + $t =~ m/^[\da-fA-F]{6}$/o ||
3923 + die "Error in section 'default' section 'graph_bg'. Bad color.\n";
3924 + my @c = map { hex $_ } ($t =~ m/^(..)(..)(..)$/);
3925 + $white = $image->colorAllocate (@c);
3926 + }
3927 + else {
3928 + $white = $image->colorAllocate (255, 255, 255);
3929 + }
3930 + my $bg;
3931 + if (defined $color_bg) {
3932 + $color_bg =~ m/^\#[\da-fA-F]{6}$/o ||
3933 + die "Error in section 'index'. Bad color $color_bg.\n";
3934 + my @c = map { hex $_ } ($color_bg =~ m/^\#(..)(..)(..)$/);
3935 + $bg = $image->colorAllocate (@c);
3936 + }
3937 + else {
3938 + $bg = $image->colorAllocate (255, 255, 206);
3939 + }
3940 + my $col_in;
3941 + if (defined $color_in) {
3942 + $color_in =~ m/^\#[\da-fA-F]{6}$/o ||
3943 + die "Error in section 'index'. Bad color $color_in.\n";
3944 + my @c = map { hex $_ } ($color_in =~ m/^\#(..)(..)(..)$/);
3945 + $col_in = $image->colorAllocate (@c);
3946 + }
3947 + else {
3948 + $col_in = $image->colorAllocate ( 80, 159, 207);
3949 + }
3950 + my $col_out;
3951 + my @col_out = ( 0, 0, 255);
3952 + if (defined $color_out) {
3953 + $color_out =~ m/^\#[\da-fA-F]{6}$/o ||
3954 + die "Error in section 'index'. Bad color $color_out.\n";
3955 + my @c = map { hex $_ } ($color_out =~ m/^\#(..)(..)(..)$/);
3956 + $col_out = $image->colorAllocate (@c);
3957 + @col_out = @c;
3958 + }
3959 + else {
3960 + $col_out = $image->colorAllocate (@col_out);
3961 + }
3962 +
3963 + my $white2 = $image->colorAllocate (255, 255, 255);
3964 + my $gray = $image->colorAllocate (192, 192, 192);
3965 + my $red = $image->colorAllocate (255, 0, 0);
3966 + my $coltxt = $black;
3967 +
3968 + my $size = 22; # legend
3969 + # legend statistics
3970 + my ($max_in, $max_out) = (0, 0); # min
3971 + my ($min_in, $min_out) = (1E10, 1E10); # max
3972 + my ($t_in, $t_out) = (0, 0); # time
3973 + my ($s_in, $s_out) = (0, 0); # sum
3974 +
3975 + $image->filledRectangle (0, 0, $xmax, $ymax, $gray);
3976 + $image->transparent ($gray) if $transparent;
3977 +
3978 + my $FontWidth = gdSmallFont->width;
3979 + my $FontHeight = gdSmallFont->height;
3980 + $image->setStyle ($black, &GD::gdTransparent, &GD::gdTransparent);
3981 +
3982 + my $marginl = 13 + $FontWidth * length (sprintf "%d", $y_max * $factor);
3983 + my $marginr = 15 + 4 * $FontWidth; # "100%"
3984 + my $margint = 2 * $FontHeight + gdMediumBoldFont->height;
3985 + my $marginb = 2 * $FontHeight + $size;
3986 + my $xratio = ($xmax - $marginl - $marginr) / ($x_max - $x_min);
3987 + my $yratio = ($ymax - $margint - $marginb) / ($y_max - $y_min);
3988 +
3989 + my $frame = new GD::Polygon;
3990 + $frame->addPt(2, $margint - $FontHeight -3);
3991 + $frame->addPt($xmax - 2, $margint - $FontHeight -3);
3992 + $frame->addPt($xmax - 2, $ymax - 3);
3993 + $frame->addPt(2, $ymax - 3);
3994 + $image->filledPolygon($frame, $white2);
3995 + $image->polygon($frame, $black);
3996 +
3997 + $image->filledRectangle ($marginl, $margint,
3998 + $xmax - $marginr, $ymax - $marginb, $bg);
3999 + my $brush = new GD::Image(1, 2);
4000 + my $b_col = $brush->colorAllocate(@col_out);
4001 + $brush->line(0, 0, 0, 1, $b_col);
4002 + $image->setBrush($brush);
4003 + my ($old_x, $old_y_in, $old_y_out);
4004 + foreach $key (sort keys %$dates) {
4005 + next if $key < $x_min;
4006 + my $delta = $$dates{$key} - $key;
4007 + $min_in = $$in{$key} / $delta if $min_in > $$in{$key} / $delta;
4008 + $max_in = $$in{$key} / $delta if $max_in < $$in{$key} / $delta;
4009 + $min_out = $$out{$key} / $delta if $min_out > $$out{$key} / $delta;
4010 + $max_out = $$out{$key} / $delta if $max_out < $$out{$key} / $delta;
4011 + $t_in += $delta;
4012 + $s_in += $$in{$key};
4013 + $s_out += $$out{$key};
4014 +
4015 + my $tt_in = $$in{$key} / ($$dates{$key} - $key) * $yratio;
4016 + my $tt_out = $$out{$key} / ($$dates{$key} - $key) * $yratio;
4017 + my $new_x = $marginl + ($key - $x_min) * $xratio;
4018 + $image->filledRectangle ($marginl + ($key - $x_min) * $xratio,
4019 + $ymax - $marginb - $tt_in,
4020 + $marginl + ($$dates{$key} - $x_min) * $xratio,
4021 + $ymax - $marginb, $col_in);
4022 + if (defined $old_x) {
4023 + $old_x = $new_x if $old_x > $new_x;
4024 + my $poly = new GD::Polygon;
4025 + $poly->addPt($old_x, $old_y_in);
4026 + $poly->addPt($new_x, $ymax - $marginb - $tt_in);
4027 + $poly->addPt($new_x, $ymax - $marginb);
4028 + $poly->addPt($old_x, $ymax - $marginb);
4029 + $image->filledPolygon($poly, $col_in);
4030 + }
4031 + $image->line ($marginl + ($key - $x_min) * $xratio,
4032 + $ymax - $marginb - $tt_out,
4033 + $marginl + ($$dates{$key} - $x_min) * $xratio,
4034 + $ymax - $marginb - $tt_out, &GD::gdBrushed);
4035 + $image->line ($old_x, $old_y_out, $new_x,
4036 + $ymax - $marginb - $tt_out, $col_out) if defined $old_x;
4037 + $old_x = $marginl + ($$dates{$key} - $x_min) * $xratio;
4038 + $old_y_in = $ymax - $marginb - $tt_in;
4039 + $old_y_out = $ymax - $marginb - $tt_out;
4040 + }
4041 + $t_out = $t_in;
4042 +
4043 + # main frame
4044 + $image->rectangle ($marginl, $margint,
4045 + $xmax - $marginr, $ymax - $marginb, $black);
4046 + # graduations
4047 + my $i;
4048 + foreach $i (0, 25, 50, 75, 100) {
4049 + my $t = $ymax - $margint - $marginb;
4050 + $image->line ($marginl, $ymax - $marginb - $i / 100 * $t,
4051 + $xmax - $marginr, $ymax - $marginb - $i / 100 * $t,
4052 + &GD::gdStyled);
4053 + $image->line ($xmax - $marginr, $ymax - $marginb - $i / 100 * $t,
4054 + $xmax - $marginr + 3, $ymax - $marginb - $i / 100 * $t,
4055 + $black);
4056 + $image->line ($marginl - 3, $ymax - $marginb - $i / 100 * $t,
4057 + $marginl, $ymax - $marginb - $i / 100 * $t,
4058 + $black);
4059 + $image->string (&GD::gdSmallFont, $xmax - $marginr + 8, - $FontHeight / 2 +
4060 + $ymax - $marginb - $i / 100 * $t, "$i%", $black);
4061 + my $s = sprintf "%d", $y_max * $i / 100 * $factor;
4062 + $image->string (&GD::gdSmallFont, $marginl - 5 - $FontWidth * length $s,
4063 + - $FontHeight / 2 +
4064 + $ymax - $marginb - $i / 100 * $t, $s, $black);
4065 + }
4066 + ##
4067 + my $w = 604800; # number of seconds in a week
4068 + my $y = 31536000; # number of seconds in a 365 days year
4069 + my $mm = 2592000; # number of seconds in a 30 days month
4070 + if ($x_max - $x_min <= 3024000) { # less than five weeks
4071 + # unit is a week
4072 + # 1/1/1990 is a monday. Use this as a basis.
4073 + my $d = 631152000; # number of seconds between 1/1/1970 and 1/1/1990
4074 + my $n = int ($x_min / $y);
4075 + my $t = $x_min - $n * $y - int (($n - 2) / 4) * 24 * 3600;
4076 + my $f = int ($t / $w);
4077 + $n = $d + int (($x_min - $d) / $w) * $w;
4078 + while ($n < $x_max) {
4079 + $t = $marginl + ($n - $x_min) * $xratio;
4080 + if ($n > $x_min) {
4081 + $image->line ($t, $margint, $t, $ymax - $marginb, &GD::gdStyled);
4082 + $image->line ($t, $ymax - $marginb, $t, $ymax - $marginb + 2, $black);
4083 + }
4084 + $image->string (&GD::gdSmallFont, $FontWidth * 7 / 2 + $t,
4085 + $ymax - $marginb + 4, (sprintf "Week %02d", $f), $black)
4086 + if ($n + $w / 2 > $x_min) && ($n + $w / 2 < $x_max);
4087 + $f++;
4088 + $n += $w;
4089 + $t = int ($n / $y);
4090 + $f = 0
4091 + if $n - $y * $t - int (($t - 2) / 4) * 24 * 3600 < $w && $f > 50;
4092 + }
4093 + $d = 86400; # 1 day
4094 + $n = int ($x_min / $y);
4095 + $t = $n * $y + int (($n - 2) / 4) * 24 * 3600;
4096 + $i = 0;
4097 + my $x;
4098 + while ($t < $x_max) {
4099 + $x = $marginl + ($t - $x_min) * $xratio;
4100 + $image->line ($x, $margint, $x, $ymax - $marginb + 2, $red)
4101 + if $t > $x_min;
4102 + $t += $mm;
4103 + $t += $d if $i == 0 || $i == 2 || $i == 4 ||
4104 + $i == 6 || $i == 7 || $i == 9 || $i == 11; # 31 days months
4105 + if ($i == 1) { # february ?
4106 + $t -= 2 * $d;
4107 + $t += $d unless (1970 + int ($t / $y)) % 4;
4108 + }
4109 + $i++;
4110 + $i = 0 if $i == 12; # Happy New Year !!
4111 + }
4112 + }
4113 + else {
4114 + # unit is a month
4115 + my $n = int ($x_min / $y);
4116 + my $t = $n * $y + int (($n - 2) / 4) * 24 * 3600;
4117 + my @m = ("Jan", "Feb", "Mar", "Apr", "May", "Jun",
4118 + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
4119 + my $d = 86400; # 1 day
4120 + my $i = 0;
4121 + my $x;
4122 + while ($t < $x_max) {
4123 + $x = $marginl + ($t - $x_min) * $xratio;
4124 + if ($t > $x_min) {
4125 + $image->line ($x, $margint, $x, $ymax - $marginb, &GD::gdStyled);
4126 + $image->line ($x, $ymax - $marginb, $x,
4127 + $ymax - $marginb + 2, $black);
4128 + $image->line ($x, $margint, $x, $ymax - $marginb, $red) unless $i;
4129 + }
4130 + $image->string (&GD::gdSmallFont,
4131 + $mm * $xratio / 2 - $FontWidth * 3 / 2 +
4132 + $x, $ymax - $marginb + 4, (sprintf "%s", $m[$i]),
4133 + $black)
4134 + if ($t + 2 * $w > $x_min) && ($x_max > 2 * $w + $t);
4135 + $t += $mm;
4136 + $t += $d if ($i == 0 || $i == 2 || $i == 4 ||
4137 + $i == 6 || $i == 7 || $i == 9 || $i == 11); # 31 days months
4138 + if ($i == 1) { # february ?
4139 + $t -= 2 * $d;
4140 + $t += $d unless (1970 + int ($t / $y)) % 4;
4141 + }
4142 + $i++;
4143 + $i = 0 if $i == 12; # Happy New Year !!
4144 + }
4145 + }
4146 +
4147 + # Add the little red arrow
4148 + my $poly = new GD::Polygon;
4149 + $poly->addPt($xmax - $marginr - 2, $ymax - $marginb - 3);
4150 + $poly->addPt($xmax - $marginr + 4, $ymax - $marginb);
4151 + $poly->addPt($xmax - $marginr - 2, $ymax - $marginb + 3);
4152 + $image->filledPolygon($poly, $red);
4153 +
4154 + # Title
4155 + $image->string (&GD::gdMediumBoldFont,
4156 + $xmax / 2 - $FontWidth * length ($title) / 2, 4,
4157 + $title, $black);
4158 +
4159 + # Legend
4160 + my $y_in = $ymax - $size - $FontHeight + 5;
4161 + $image->string (&GD::gdSmallFont, $marginl, $y_in, $legend_in, $col_in);
4162 + $image->string (&GD::gdSmallFont, $xmax / 4, $y_in,
4163 + (sprintf "Min: %5.1f $unit", $min_in * $factor), $black);
4164 + $image->string (&GD::gdSmallFont, $xmax / 2, $y_in,
4165 + (sprintf "Avg: %5.1f $unit", $s_in / $t_in * $factor), $black);
4166 + $image->string (&GD::gdSmallFont, 3 * $xmax / 4, $y_in,
4167 + (sprintf "Max: %5.1f $unit", $max_in * $factor), $black);
4168 +
4169 + my $y_out = $ymax - $size + 5;
4170 + $image->string (&GD::gdSmallFont, $marginl, $y_out, $legend_out, $col_out);
4171 + $image->string (&GD::gdSmallFont, $xmax / 4, $y_out,
4172 + (sprintf "Min: %5.1f $unit", $min_out * $factor), $black);
4173 + $image->string (&GD::gdSmallFont, $xmax / 2, $y_out,
4174 + (sprintf "Avg: %5.1f $unit", $s_out / $t_out * $factor), $black);
4175 + $image->string (&GD::gdSmallFont, 3 * $xmax / 4, $y_out,
4176 + (sprintf "Max: %5.1f $unit", $max_out * $factor), $black);
4177 +
4178 + open (IMG, "> $filename") || die "Error: Can't open \"$filename\": $!\n";
4179 + if ($GD_FORMAT eq 'png') {
4180 + print IMG $image->png;
4181 + }
4182 + else {
4183 + print IMG $image->gif;
4184 + }
4185 + close IMG;
4186 + return $ymax;
4187 +}
4188 +
4189 +sub Write_all_results {
4190 + my $HTML_output = shift;
4191 + my $h = shift;
4192 + my $k;
4193 +
4194 + my $title = $$h{'default'}{'title'} ?
4195 + $$h{'default'}{'title'} : "Daily Usenet report";
4196 + $title =~ s/^\"\s*(.*?)\s*\"$/$1/o;
4197 + $title =~ s/\\\"/\"/go;
4198 + my $Title = $title;
4199 + $Title =~ s/<.*?>//go;
4200 + {
4201 + my $Title = $Title;
4202 + $Title =~ s/\&amp;/&/go;
4203 + $Title =~ s/\&lt;/</go;
4204 + $Title =~ s/\&gt;/>/go;
4205 + print "$Title from $first_date to $last_date\n\n";
4206 + }
4207 +
4208 + if ($HTML) {
4209 + my $body = defined $output{'default'}{'html_body'} ?
4210 + $output{'default'}{'html_body'} : '';
4211 + $body =~ s/^\"\s*(.*?)\s*\"$/ $1/o;
4212 + $body =~ s/\\\"/\"/go;
4213 + open (HTML, "> $HTML_output") || die "Error: cant open $HTML_output\n";
4214 +
4215 + print HTML "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n" .
4216 + "<HTML>\n<HEAD>\n<TITLE>$Title: $first_date</TITLE>\n" .
4217 + "<!-- innreport $version -->\n</HEAD>\n<BODY $body>\n" .
4218 + "$HTML_header\n<CENTER><H1>$title</H1>\n" .
4219 + "<H3>$first_date -- $last_date</H3>\n</CENTER>\n<P><HR><P>\n";
4220 +
4221 + # Index
4222 + print HTML "<UL>\n";
4223 + foreach $k (@{$$h{'_order_'}}) {
4224 + next if $k =~ m/^(default|index)$/;
4225 + my ($data) = $$h{$k}{'data'} =~ m/^\"\s*(.*?)\s*\"$/o;
4226 + $data =~ s/^\%/\%$CLASS\:\:/ unless $data eq '%prog_type';
4227 + my %data;
4228 + { local $^W = 0; no strict; %data = eval $data }
4229 + my ($string) = $$h{$k}{'title'} =~ m/^\"\s*(.*?)\s*\"$/o;
4230 + $string =~ s/\s*:$//o;
4231 + my $want = 1;
4232 +
4233 + ($want) = $$h{$k}{'skip'} =~ m/^\"?\s*(.*?)\s*\"?$/o
4234 + if defined $$h{$k}{'skip'};
4235 + $want = $want eq 'true' ? 0 : 1;
4236 + print HTML "<LI><A HREF=\"#$k\">$string</A>\n" if %data && $want;
4237 + }
4238 + print HTML "</UL><P><HR><P>\n";
4239 + }
4240 + if (@unrecognize && $WANT_UNKNOWN) {
4241 + my $mm = $#unrecognize;
4242 + print HTML "<A NAME=\"unrecognize\">" if $HTML && $WANT_HTML_UNKNOWN;
4243 + print "Unknown entries from news log file:\n";
4244 + print HTML "<STRONG>Unknown entries from news log file:</STRONG></A><P>\n"
4245 + if $HTML && $WANT_HTML_UNKNOWN;
4246 + $mm = $MAX_UNRECOGNIZED - 1
4247 + if $MAX_UNRECOGNIZED > 0 && $mm > $MAX_UNRECOGNIZED - 1;
4248 + if ($mm < $unrecognize_max && $unrecognize_max > 0) {
4249 + printf HTML "First %d / $unrecognize_max lines (%3.1f%%)<BR>\n", $mm + 1,
4250 + ($mm + 1) / $unrecognize_max * 100 if $HTML && $WANT_HTML_UNKNOWN;
4251 + printf "First %d / $unrecognize_max lines (%3.1f%%)\n", $mm + 1,
4252 + ($mm + 1) / $unrecognize_max * 100;
4253 + }
4254 +
4255 + my $l;
4256 + for $l (0 .. $mm) {
4257 + chomp $unrecognize[$l]; # sometimes, the last line need a CR
4258 + print "$unrecognize[$l]\n"; # so, we always add one
4259 + if ($HTML && $WANT_HTML_UNKNOWN) {
4260 + $unrecognize[$l] =~ s/&/\&amp;/g;
4261 + $unrecognize[$l] =~ s/</\&lt;/g;
4262 + $unrecognize[$l] =~ s/>/\&gt;/g;
4263 + print HTML "$unrecognize[$l]<BR>\n";
4264 + }
4265 + }
4266 + print "\n";
4267 + print HTML "<P><HR><P>\n" if $HTML && $WANT_HTML_UNKNOWN;
4268 + }
4269 +
4270 + close HTML if $HTML;
4271 + foreach $k (@{$$h{'_order_'}}) {
4272 + next if $k =~ m/^(default|index)$/;
4273 + &Write_Results($HTML_output, $k, $h);
4274 + }
4275 + if ($HTML) {
4276 + open (HTML, ">> $HTML_output") || die "Error: cant open $HTML_output\n";
4277 + print HTML <<EOT;
4278 +<A HREF="ftp://ftp.sofaraway.org/pub/innreport/">innreport</A>
4279 +$version (c) 1996-1999 by Fabien Tassin
4280 +&lt;<A HREF="mailto:fta\@sofaraway.org">fta\@sofaraway.org</A>&gt;.
4281 +EOT
4282 + if (defined $$h{'default'}{'footer'}) {
4283 + my ($t) = $$h{'default'}{'footer'} =~ m/^\"\s*(.*?)\s*\"$/o;
4284 + $t =~ s/\\\"/\"/go;
4285 + print HTML "<BR>" . $t;
4286 + }
4287 + print HTML "\n$HTML_footer";
4288 + printf HTML "\n<!-- Running time: %s -->", second2time(time - $start_time);
4289 + print HTML "\n</BODY>\n</HTML>\n";
4290 + close HTML;
4291 + }
4292 +}
4293 +
4294 +sub Write_Results {
4295 + my $HTML_output = shift;
4296 + my $report = shift;
4297 + my $data = shift;
4298 + my %output = %$data;
4299 + return 0 unless defined $output{$report}; # no data to write
4300 + return 0 if defined $output{$report}{'skip'} &&
4301 + $output{$report}{'skip'} =~ m/^true$/io;
4302 + my ($TEXT, $HTML, $DOUBLE);
4303 +
4304 + # Need a text report ?
4305 + $TEXT = defined $output{$report}{'text'} ? $output{$report}{'text'} :
4306 + (defined $output{'default'}{'text'} ? $output{'default'}{'text'} : '');
4307 + die "Error in config file. Field 'text' is mandatory.\n" unless $TEXT;
4308 + $TEXT = ($TEXT =~ m/^true$/io) ? 1 : 0;
4309 +
4310 + # Need an html report ?
4311 + if ($HTML_output) {
4312 + $HTML = defined $output{$report}{'html'} ? $output{$report}{'html'} :
4313 + (defined $output{'default'}{'html'} ? $output{'default'}{'html'} : '');
4314 + die "Error in config file. Field 'html' is mandatory.\n" unless $HTML;
4315 + $HTML = ($HTML =~ m/^true$/io) ? 1 : 0;
4316 + }
4317 + # Double table ?
4318 + $DOUBLE = defined $output{$report}{'double'} ?
4319 + $output{$report}{'double'} : 0;
4320 + $DOUBLE = ($DOUBLE =~ m/^true$/io) ? 1 : 0;
4321 +
4322 + # Want to truncate the report ?
4323 + my $TOP = defined $output{$report}{'top'} ? $output{$report}{'top'} : -1;
4324 + my $TOP_HTML = defined $output{$report}{'top_html'} ?
4325 + $output{$report}{'top_html'} : $TOP;
4326 + my $TOP_TEXT = defined $output{$report}{'top_text'} ?
4327 + $output{$report}{'top_text'} : $TOP;
4328 +
4329 + my (%h, %d, $h);
4330 + {
4331 + my $t = $output{$report}{'data'} ||
4332 + die "Error in section $report. Need a 'data' field.\n";
4333 + $t =~ s/^\"\s*(.*?)\s*\"$/$1/o;
4334 + $t =~ s/^\%/\%$CLASS\:\:/ unless $t eq '%prog_type';
4335 + %d = eval $t;
4336 + return unless %d; # nothing to report. exit.
4337 + return unless keys (%d); # nothing to report. exit.
4338 + }
4339 + {
4340 + my $t = defined $output{$report}{'sort'} ? $output{$report}{'sort'} :
4341 + "\$a cmp \$b";
4342 + $t =~ s/\n/ /smog;
4343 + $t =~ s/^\"\s*(.*?)\s*\"$/$1/o;
4344 + $t =~ s/([\$\%\@])/$1${CLASS}\:\:/go;
4345 + $t =~ s/([\$\%\@])${CLASS}\:\:(prog_(?:size|type)|key|num)/$1$2/go;
4346 + $t =~ s/\{\$${CLASS}\:\:(a|b)\}/\{\$$1\}/go;
4347 + $t =~ s/\$${CLASS}\:\:(a|b)/\$$1/go;
4348 + $h = $t;
4349 + }
4350 +
4351 + if ($HTML) {
4352 + open (HTML, ">> $HTML_output") || die "Error: cant open $HTML_output\n";
4353 + }
4354 + print "\n" if $TEXT;
4355 + my ($key, $key1, $key2);
4356 + if (defined $output{$report}{'title'}) {
4357 + my $t = $output{$report}{'title'};
4358 + $t =~ s/^\"\s*(.*?)\s*\"$/$1/o;
4359 + if ($HTML) {
4360 + print HTML "<A NAME=\"$report\">";
4361 + my $html = $t;
4362 + $html =~ s/(:?)$/ [Top $TOP_HTML]$1/o if $TOP_HTML > 0;
4363 + $html =~ s|^(.*)$|<STRONG>$1</STRONG>|;
4364 + print HTML "$html</A>\n<P>\n<CENTER>\n<TABLE BORDER=\"1\">\n";
4365 + }
4366 + $t =~ s/(:?)$/ [Top $TOP_TEXT]$1/o if $TOP_TEXT > 0;
4367 + print "$t\n" if $TEXT;
4368 + }
4369 + my $numbering = 0;
4370 + $numbering = 1 if defined $output{$report}{'numbering'} &&
4371 + $output{$report}{'numbering'} =~ m/^true$/o;
4372 + my $i;
4373 + my $s = '';
4374 + my $html = '';
4375 + my $first = 0;
4376 +
4377 + foreach $i (@{$output{$report}{'column'}}) {
4378 + my ($v1, $v2);
4379 +
4380 + my $wtext = defined $$i{'text'} ? $$i{'text'} : 1;
4381 + $wtext = $wtext =~ m/^(1|true)$/io ? 1 : 0;
4382 + my $whtml = defined $$i{'html'} ? $$i{'html'} : 1;
4383 + $whtml = $whtml =~ m/^(1|true)$/io ? 1 : 0;
4384 +
4385 + $v1 = defined ($$i{'format_name'}) ? $$i{'format_name'} :
4386 + (defined ($$i{'format'}) ? $$i{'format'} : "%s");
4387 + $v1 =~ s/^\"\s*(.*?)\s*\"$/$1/o;
4388 + $v2 = $$i{'name'};
4389 + $v2 =~ s/^\"\s*(.*?)\s*\"$/$1/o;
4390 + $s .= sprintf $v1 . " ", $v2 if $wtext && !($DOUBLE && $first == 1);
4391 + if ($HTML && $whtml) {
4392 + my $v1 = $v1;
4393 + $v1 =~ s/\%-?(?:\d+(?:\.\d+)?)?(\w)/\%$1/g;
4394 + my $temp = $first ? "CENTER" : "LEFT";
4395 + $temp .= "\" COLSPAN=\"2" if $numbering && !$first;
4396 + $html .= sprintf "<TH ALIGN=\"$temp\">$v1</TH>", $v2;
4397 + }
4398 + $first++;
4399 + }
4400 + $s =~ s/\s*$//;
4401 + print "$s\n" if $TEXT;
4402 + $s = '';
4403 + if ($HTML) {
4404 + print HTML "<TR>$html</TR>\n<TR><TD></TD></TR>\n";
4405 + $html = '';
4406 + }
4407 + my $num = 0;
4408 + my $done;
4409 + if ($DOUBLE) {
4410 + my $num_d = 0;
4411 + foreach $key1 (sort keys (%d)) {
4412 + $done = 0;
4413 + $num = 0;
4414 + $num_d++;
4415 + $s = '';
4416 + $html = '';
4417 + my @res;
4418 + foreach $key2 (sort {$d{$key1}{$b} <=> $d{$key1}{$a}}
4419 + keys (%{$d{$key1}})) {
4420 + my $first = 0;
4421 + $num++;
4422 + foreach $i (@{$output{$report}{'column'}}) {
4423 + my ($v1, $v2, $p);
4424 +
4425 + my $wtext = defined $$i{'text'} ? $$i{'text'} : 1;
4426 + $wtext = $wtext =~ m/^(1|true)$/io ? 1 : 0;
4427 + my $whtml = defined $$i{'html'} ? $$i{'html'} : 1;
4428 + $whtml = $whtml =~ m/^(1|true)$/io ? 1 : 0;
4429 +
4430 + # is it the primary key ?
4431 + $p = 0;
4432 + $p = 1 if defined $$i{'primary'} && $$i{'primary'} =~ m/true/;
4433 +
4434 + # format
4435 + $v1 = defined ($$i{'format'}) ? $$i{'format'} : "%s";
4436 + $v1 =~ s/^\"\s*(.*?)\s*\"$/$1/o;
4437 +
4438 + # value
4439 + $v2 = $$i{'value'};
4440 + $v2 =~ s/^\"\s*(.*?)\s*\"$/$1/o;
4441 + my $r ='';
4442 + if ($v2) {
4443 + $r = &EvalExpr ($v2, $key2, $num, $key1);
4444 + die "Error in section $report column $$i{'name'}. " .
4445 + "Invalid 'value' value.\n" unless defined $r;
4446 + }
4447 + $res[$first] += $r if $v1 =~ m/\%-?(?:\d+(?:\.\d+)?)?d/o;
4448 + if ($p) {
4449 + $s .= sprintf $v1. "\n", $r unless $done || !$wtext;
4450 + if ($HTML && $whtml) {
4451 + if ($done) {
4452 + $html .= "<TD></TD>";
4453 + }
4454 + else {
4455 + $v1 =~ s/\%-?(?:\d+(?:\.\d+)?)?s/\%s/g;
4456 + $html .= $numbering ? "<TH ALIGN=\"CENTER\">$num_d</TH>" : '';
4457 + # unless $first;
4458 + $html .= sprintf "<TD ALIGN=\"LEFT\">$v1</TD></TR>\n", $r;
4459 + $html .= "<TR><TD></TD>";
4460 + }
4461 + }
4462 + }
4463 + else {
4464 + if ($wtext) {
4465 + $s .= " " if $first == 1;
4466 + $s .= sprintf $v1 . " ", $r;
4467 + }
4468 + if ($HTML && $whtml) {
4469 + $html .= $numbering ? "<TD></TD>" : '' if $first == 1;
4470 + $v1 =~ s/\%-?(?:\d+(?:\.\d+)?)?s/\%s/g;
4471 + my $temp = $first > 1 ? "RIGHT" : "LEFT";
4472 + $html .= sprintf "<TD ALIGN=\"$temp\">$v1</TD>", $r;
4473 + }
4474 + }
4475 + $done = 1 if $p;
4476 + $first++;
4477 + }
4478 + $s =~ s/\s*$//;
4479 + $s =~ s/\\n/\n/g;
4480 + print "$s\n" if $TEXT && ($num <= $TOP_TEXT || $TOP_TEXT == -1);
4481 + if ($HTML && ($num <= $TOP_HTML || $TOP_HTML == -1)) {
4482 + $html =~ s/\\n//g;
4483 + print HTML "<TR>$html</TR>\n";
4484 + }
4485 + $s = '';
4486 + $html = '';
4487 + }
4488 + $first = 0;
4489 + $s = '';
4490 + $html = '';
4491 + if ($TOP_TEXT != -1 && $TOP_HTML != -1) {
4492 + foreach $i (@{$output{$report}{'column'}}) {
4493 + if (defined $$i{'primary'} && $$i{'primary'} =~ m/true/o) {
4494 + $first++;
4495 + $s .= ' ';
4496 + $html .= "<TD></TD>" if $HTML;
4497 + $html .= "<TD></TD>" if $HTML && $numbering;
4498 + next;
4499 + }
4500 + my ($v1, $v2);
4501 + $v1 = defined ($$i{'format_total'}) ? $$i{'format_total'} :
4502 + (defined ($$i{'format'}) ? $$i{'format'} : "%s");
4503 + $v1 =~ s/^\"\s*(.*?)\s*\"$/$1/o;
4504 + my $r = $first == 1 ? $num : $res[$first];
4505 + $s .= sprintf $v1 . " ", $r;
4506 + if ($HTML) {
4507 + my $temp = $first > 1 ? "RIGHT" : "LEFT";
4508 + $v1 =~ s/\%-?(?:\d+(?:\.\d+)?)?s/\%s/g;
4509 + $v1 =~ s|(.*)|<STRONG>$1</STRONG>|o unless $first > 1;
4510 + $html .= sprintf "<TD ALIGN=\"$temp\">$v1</TD>", $r;
4511 + }
4512 + $first++;
4513 + }
4514 + $s =~ s/\s*$//;
4515 + $s =~ s/\\n//g;
4516 + print "$s\n" if $TEXT;
4517 + print HTML "<TR>$html</TR>\n" if $HTML;
4518 + }
4519 + }
4520 + print "\n" if $TEXT;
4521 + print HTML "<TR><TD></TD></TR>\n" if $HTML;
4522 + $first = 0;
4523 + $num = $num_d;
4524 + $s = '';
4525 + $html = '';
4526 + foreach $i (@{$output{$report}{'column'}}) {
4527 + my $wtext = defined $$i{'text'} ? $$i{'text'} : 1;
4528 + $wtext = $wtext =~ m/^(1|true)$/io ? 1 : 0;
4529 + my $whtml = defined $$i{'html'} ? $$i{'html'} : 1;
4530 + $whtml = $whtml =~ m/^(1|true)$/io ? 1 : 0;
4531 +
4532 + my ($v1, $v2);
4533 + $v1 = defined $$i{'format_total'} ? $$i{'format_total'} :
4534 + (defined $$i{'format'} ? $$i{'format'} : "%s");
4535 + $v1 =~ s/^\"\s*(.*?)\s*\"$/$1/o;
4536 + $v2 = $$i{'total'} ||
4537 + die "Error in section $report column $$i{'name'}. " .
4538 + "Need a 'total' field.\n";
4539 + $v2 =~ s/^\"\s*(.*?)\s*\"$/$1/o;
4540 + my $r = '';
4541 + if ($v2) {
4542 + $r = &EvalExpr ($v2, $key2, $num, 1);
4543 + die "Error in section $report column $$i{'name'}. " .
4544 + "Invalid 'total' value.\n" unless defined $r;
4545 + }
4546 + $s .= sprintf $v1 . " ", $r if $wtext && $first != 1;
4547 + if ($HTML && $whtml) {
4548 + my $temp = $first ? "RIGHT" : "LEFT";
4549 + $temp .= "\" COLSPAN=\"2" if $numbering && !$first;
4550 + $v1 =~ s/\%-?(?:\d+(?:\.\d+)?)?s/\%s/g;
4551 + $v1 =~ s|(.*)|<STRONG>$1</STRONG>|o unless $first;
4552 + $html .= $first == 1 ? "<TD></TD>" :
4553 + sprintf "<TD ALIGN=\"$temp\">$v1</TD>", $r;
4554 + }
4555 + $first++;
4556 + }
4557 + $s =~ s/\s*$//;
4558 + $s =~ s/\\n//g;
4559 + print "$s\n" if $TEXT;
4560 + print HTML "<TR>$html</TR>\n</TABLE>\n</CENTER>\n<P>\n<HR>\n" if $HTML;
4561 + }
4562 + else {
4563 + # foreach $key (sort { local $^W = 0; no strict; eval $h } (keys (%d)))
4564 + foreach $key ((eval "sort {local \$^W = 0; no strict; $h} (keys (%d))")) {
4565 + next unless defined $key;
4566 + next unless defined $d{$key}; # to avoid problems after some undef()
4567 + $num++;
4568 + next unless $num <= $TOP_HTML || $TOP_HTML == -1 ||
4569 + $num <= $TOP_TEXT || $TOP_TEXT == -1;
4570 + my $first = 0;
4571 + foreach $i (@{$output{$report}{'column'}}) {
4572 + my $wtext = defined $$i{'text'} ? $$i{'text'} : 1;
4573 + $wtext = $wtext =~ m/^(1|true)$/io ? 1 : 0;
4574 + my $whtml = defined $$i{'html'} ? $$i{'html'} : 1;
4575 + $whtml = $whtml =~ m/^(1|true)$/io ? 1 : 0;
4576 +
4577 + my ($v1, $v2);
4578 + $v1 = defined ($$i{'format'}) ? $$i{'format'} : "%s";
4579 + $v1 =~ s/^\"\s*(.*?)\s*\"$/$1/o;
4580 + $v2 = $$i{'value'};
4581 + $v2 =~ s/^\"\s*(.*?)\s*\"$/$1/o;
4582 + my $r ='';
4583 + if ($v2) {
4584 + $r = &EvalExpr ($v2, $key, $num);
4585 + die "Error in section $report column $$i{'name'}. " .
4586 + "Invalid 'value' value.\n" unless defined $r;
4587 + }
4588 + $s .= sprintf $v1 . " ", $r
4589 + if $wtext && (($num <= $TOP_TEXT) || ($TOP_TEXT == -1));
4590 + if ($HTML && $whtml && ($num <= $TOP_HTML || $TOP_HTML == -1)) {
4591 + $v1 =~ s/\%-?(?:\d+(?:\.\d+)?)?s/\%s/g;
4592 + $html .= "<TH ALIGN=\"CENTER\">$num</TH>" if $numbering && !$first;
4593 + my $temp = $first ? "RIGHT" : "LEFT";
4594 + $html .= sprintf "<TD ALIGN=\"$temp\">$v1</TD>", $r;
4595 + }
4596 + $first++;
4597 + }
4598 + $s =~ s/\s*$//;
4599 + print "$s\n" if $TEXT && ($num <= $TOP_TEXT || $TOP_TEXT == -1);
4600 + $s = '';
4601 + if ($HTML && ($num <= $TOP_HTML || $TOP_HTML == -1)) {
4602 + print HTML "<TR>$html</TR>\n";
4603 + $html = '';
4604 + }
4605 + }
4606 + print "\n" if $TEXT;
4607 + print HTML "<TR><TD></TD></TR>\n" if $HTML;
4608 + $first = 0;
4609 + foreach $i (@{$output{$report}{'column'}}) {
4610 + my $wtext = defined $$i{'text'} ? $$i{'text'} : 1;
4611 + $wtext = $wtext =~ m/^(1|true)$/io ? 1 : 0;
4612 + my $whtml = defined $$i{'html'} ? $$i{'html'} : 1;
4613 + $whtml = $whtml =~ m/^(1|true)$/io ? 1 : 0;
4614 +
4615 + my ($v1, $v2);
4616 + $v1 = defined ($$i{'format_total'}) ? $$i{'format_total'} :
4617 + (defined ($$i{'format'}) ? $$i{'format'} : "%s");
4618 + $v1 =~ s/^\"\s*(.*?)\s*\"$/$1/o;
4619 + $v2 = $$i{'total'} ||
4620 + die "Error in section $report column $$i{'name'}. " .
4621 + "Need a 'total' field.\n";
4622 + $v2 =~ s/^\"\s*(.*?)\s*\"$/$1/o;
4623 + my $r = '';
4624 + if ($v2) {
4625 + $r = &EvalExpr ($v2, $key, $num);
4626 + die "Error in section $report column $$i{'name'}. " .
4627 + "Invalid 'total' value.\n" unless defined $r;
4628 + }
4629 + $s .= sprintf $v1 . " ", $r if $wtext;
4630 + if ($HTML && $whtml) {
4631 + $v1 =~ s/\%-?(?:\d+(?:\.\d+)?)?s/\%s/g;
4632 + my $temp = $first ? "RIGHT" : "LEFT";
4633 + $temp .= "\" COLSPAN=\"2" if $numbering && !$first;
4634 + $v1 =~ s|(.*)|<STRONG>$1</STRONG>|o unless $first;
4635 + $html .= sprintf "<TD ALIGN=\"$temp\">$v1</TD>", $r;
4636 + }
4637 + $first++;
4638 + }
4639 + $s =~ s/\s*$//;
4640 + print "$s\n" if $TEXT;
4641 + if ($HTML) {
4642 + print HTML "<TR>$html</TR>\n";
4643 + print HTML "</TABLE>\n</CENTER><P>\n";
4644 +
4645 + my $i = 0;
4646 + while ($GRAPH && defined ${${$output{$report}{'graph'}}[$i]}{'type'}) {
4647 + my $type = ${${$output{$report}{'graph'}}[$i]}{'type'};
4648 + my ($title) = ${${$output{$report}{'graph'}}[$i]}{'title'} =~
4649 + m/^\"\s*(.*?)\s*\"$/o;
4650 + if ($type eq 'histo3d') {
4651 + my (@values, @colors, @labels);
4652 + my $num = 0;
4653 + my $j;
4654 + foreach $j (@{${${$output{$report}{'graph'}}[$i]}{'data'}}) {
4655 + $num++;
4656 + my ($h) = $$j{'value'} =~ m/^\"\s*(.*?)\s*\"$/o;
4657 + my %hh;
4658 + $h =~ s/^\%/\%$CLASS\:\:/ unless $h eq '%prog_type';
4659 + { local $^W = 0; no strict; %hh = eval $h }
4660 + push @values, \%hh;
4661 + my ($t) = $$j{'name'} =~ m/^\"\s*(.*?)\s*\"$/o;
4662 + push @labels, $t;
4663 + $t = $$j{'color'} ||
4664 + die "Error in section $report section 'graph'. " .
4665 + "No color specified for 'value' $$j{'value'}.\n";
4666 + $t =~ s/^\"\s*\#(.*?)\s*\"$/$1/o;
4667 + $t =~ m/^[\da-fA-F]{6}$/o ||
4668 + die "Error in section $report section 'graph'. " .
4669 + "Bad color for 'value' $$j{'value'}.\n";
4670 + my @c = map { hex $_ } ($t =~ m/^(..)(..)(..)$/);
4671 + push @colors, \@c;
4672 + }
4673 + $suffix = '' unless defined $suffix;
4674 + my $s = ($i ? $i : '') . $suffix;
4675 + print HTML "<CENTER><IMG ALT=\"$title\" ";
4676 + close HTML;
4677 + my $y = &Graph3d ("$IMG_dir/$report$s.$GD_FORMAT",
4678 + $title, $xmax, $num, @values, \@colors, \@labels);
4679 + open (HTML, ">> $HTML_output") ||
4680 + die "Error: cant open $HTML_output\n";
4681 + print HTML "WIDTH=\"$xmax\" HEIGHT=\"$y\" ";
4682 + print HTML "SRC=\"$IMG_pth$report$s.$GD_FORMAT\"></CENTER>\n";
4683 + }
4684 + elsif ($type eq 'histo') {
4685 + my (%values, %labels);
4686 + my $factor =
4687 + ${${${${$output{$report}{'graph'}}[$i]}{'data'}}[1]}{'factor'}
4688 + || die "Error in section $report section 'graph'. " .
4689 + "No factor specified for 'value' " .
4690 + ${${${${$output{$report}{'graph'}}[$i]}{'data'}}[1]}{'name'} .
4691 + ".\n";
4692 + $factor =~ s/^\"\s*(.*?)\s*\"$/$1/o;
4693 + my $labelx =
4694 + ${${${${$output{$report}{'graph'}}[$i]}{'data'}}[0]}{'name'}
4695 + || die "Error in section $report section 'graph'. " .
4696 + "No name specified for value.\n";
4697 + $labelx =~ s/^\"\s*(.*?)\s*\"$/$1/o;
4698 + my $labely =
4699 + ${${${${$output{$report}{'graph'}}[$i]}{'data'}}[1]}{'name'}
4700 + || die "Error in section $report section 'graph'. " .
4701 + "No name specified for value.\n";
4702 + $labely =~ s/^\"\s*(.*?)\s*\"$/$1/o;
4703 + my $t = ${${${${$output{$report}{'graph'}}[$i]}{'data'}}[0]}{'value'}
4704 + || die "Error in section $report section 'graph'. " .
4705 + "No 'value' specified for " .
4706 + ${${${${$output{$report}{'graph'}}[$i]}{'data'}}[0]}{'name'} .
4707 + ".\n";
4708 + $t =~ s/^\"\s*(.*?)\s*\"$/$1/o;
4709 + $t =~ s/^\%/\%$CLASS\:\:/ unless $t eq '%prog_type';
4710 + { local $^W = 0; no strict; %labels = eval $t }
4711 +
4712 + $t = ${${${${$output{$report}{'graph'}}[$i]}{'data'}}[1]}{'value'} ||
4713 + die "Error in section $report section 'graph'. " .
4714 + "No 'value' specified for " .
4715 + ${${${${$output{$report}{'graph'}}[$i]}{'data'}}[1]}{'name'} .
4716 + ".\n";
4717 + $t =~ s/^\"\s*(.*?)\s*\"$/$1/o;
4718 + $t =~ s/^\%/\%$CLASS\:\:/ unless $t eq '%prog_type';
4719 + { local $^W = 0; no strict; %values = eval $t }
4720 + my $s = ($i ? $i : '') . $suffix;
4721 + {
4722 + my $r;
4723 + close HTML;
4724 + $r = &Histo ("$IMG_dir/$report$s.$GD_FORMAT", $title, $xmax,
4725 + $factor, $labelx, $labely, \%values, \%labels);
4726 + open (HTML, ">> $HTML_output") ||
4727 + die "Error: cant open $HTML_output\n";
4728 + print HTML "<CENTER><IMG ALT=\"$title\" WIDTH=\"$xmax\" " .
4729 + "SRC=\"$IMG_pth$report$s.$GD_FORMAT\"></CENTER>\n" if $r;
4730 + }
4731 + }
4732 + elsif ($type eq 'piechart') {
4733 + print "Sorry, graph type 'piechart' not supported yet..\n";
4734 + }
4735 + else {
4736 + die "Error in section $report section 'graph'. " .
4737 + "Invalid 'type' value.\n"
4738 + }
4739 + $i++;
4740 + print HTML "<P>\n";
4741 + }
4742 + print HTML "\n<HR>\n";
4743 + }
4744 + }
4745 + close HTML if $HTML;
4746 +}
4747 +
4748 +sub EvalExpr {
4749 + my $v = shift;
4750 + my ($key, $num, $key1) = @_;
4751 + my $key2;
4752 +
4753 + $v =~ s/\n/ /smog;
4754 + $v =~ s/^\"(.*?)\"$/$1/o;
4755 + if ($key1) {
4756 + $key2 = $key;
4757 + $v =~ s/([^a-zA-Z_\-]?)total\s*\(\s*%/$1&ComputeTotalDouble\(\\%/og;
4758 + }
4759 + else {
4760 + $v =~ s/([^a-zA-Z_\-]?)total\s*\(\s*%/$1&ComputeTotal\(\\%/og;
4761 + # $v =~ s/([^a-zA-Z_\-]?)total\s*\(\s*%([^\)]*)\)/$1&ComputeTotal\("$2"\)/og;
4762 + }
4763 + $v =~ s/([^a-zA-Z_\-]?)bytes\s*\(\s*/$1&NiceByte\(/og;
4764 + $v =~ s/([^a-zA-Z_\-]?)time\s*\(\s*/$1&second2time\(/og;
4765 + $v =~ s/([^a-zA-Z_\-]?)time_ms\s*\(\s*/$1&ms2time\(/og;
4766 + # $v =~ s/([\$\%\@])/$1${CLASS}\:\:/og;
4767 + $v =~ s/([\$\%\@])([^{\s\d])/$1${CLASS}\:\:$2/og;
4768 + $v =~ s/([\$\%\@])${CLASS}\:\:(prog_(?:size|type)|key|sec_glob|num)/$1$2/og;
4769 + my $r;
4770 + # eval { local $^W = 0; no strict; ($r) = eval $v; };
4771 + eval " local \$^W = 0; no strict; (\$r) = $v; ";
4772 + $r = 0 unless defined $r;
4773 + $r;
4774 +}
4775 +
4776 +sub NiceByte {
4777 + my $size = shift;
4778 + my $t;
4779 +
4780 + $size = 0 unless defined $size;
4781 + $t = $size / 1024 / 1024 / 1024 > 1 ?
4782 + sprintf "%.1f GB", $size / 1024 / 1024 / 1024 :
4783 + ($size / 1024 / 1024 > 1 ? sprintf "%.1f MB", $size / 1024 / 1024 :
4784 + sprintf "%.1f KB", $size / 1024);
4785 + return $t;
4786 +}
4787 +
4788 +sub kb2i {
4789 + my $s = shift;
4790 + my ($i, $u) = $s =~ m/^(\S+) (\S+)$/;
4791 + $i *= 1024 * 8 if $u =~ m/MB/o;
4792 + $i *= 1024 * 1024 * 8 if $u =~ m/GB/o;
4793 + return $i;
4794 +}
4795 +
4796 +sub Decode_Config_File {
4797 + my $file = shift;
4798 + my ($line, $section);
4799 + my $linenum = 0;
4800 + my $info;
4801 + my @list;
4802 + open (FILE, "$file") || die "Can\'t open config file \"$file\". Abort.\n";
4803 + while (defined ($line = <FILE>)) {
4804 + $linenum++;
4805 + last if eof (FILE);
4806 + ($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
4807 + die "Error in $file line $linenum: must be 'section' instead of '$info'\n"
4808 + unless ($info eq 'section');
4809 + ($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
4810 + die "Error in $file line $linenum: invalid section name '$info'\n"
4811 + unless $info =~ /^\w+$/;
4812 + print "section $info {\n" if $DEBUG;
4813 + $section = $info;
4814 + ($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
4815 + die "Error in $file line $linenum: must be a '{' instead of '$info'\n"
4816 + unless ($info eq '{');
4817 + ($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
4818 + push @list, $section;
4819 + while ($info ne '}') { # it is a block
4820 + last if eof (FILE);
4821 + my $keyword = $info;
4822 + ($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
4823 + my $value = $info;
4824 + if ($info eq '{') { # it is a sub-block
4825 + my @a;
4826 + $output{$section}{$keyword} = \@a unless $output{$section}{$keyword};
4827 + my %hash;
4828 + print "\t$keyword {\n" if $DEBUG;
4829 + ($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
4830 + my @sublist; # to store the "data" blocks
4831 +
4832 + while ($info ne '}') {
4833 + last if eof (FILE);
4834 + my $subkeyword = $info;
4835 + ($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
4836 + my $subvalue = $info;
4837 + if ($info eq '{') {
4838 + # it is a sub-sub-block
4839 + my %subhash;
4840 + print "\t\t$subkeyword {\n" if $DEBUG;
4841 + my @b;
4842 + $hash{$subkeyword} = \@b unless ${hash}{$subkeyword};
4843 + ($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
4844 + while ($info ne '}') {
4845 + last if eof (FILE);
4846 + my $subsubkeyword = $info;
4847 + ($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
4848 + my $subsubvalue = $info;
4849 + if ($info eq '{') {
4850 + die "Error in $file line $linenum: too many blocks.\n";
4851 + }
4852 + else {
4853 + ($info, $linenum, $line) =
4854 + &read_conf ($linenum, $line, \*FILE);
4855 + die "Error in $file line $linenum: must be a ';' instead " .
4856 + "of '$info'\n" unless ($info eq ';');
4857 + print "\t\t\t$subsubkeyword\t$subsubvalue;\n" if $DEBUG;
4858 + $subhash{$subsubkeyword} = $subsubvalue;
4859 + ($info, $linenum, $line) =
4860 + &read_conf ($linenum, $line, \*FILE);
4861 + }
4862 + }
4863 + ($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
4864 + die "Error in $file line $linenum: must be a ';' instead of " .
4865 + "'$info'\n" unless $info eq ';';
4866 + push @{$hash{$subkeyword}} , \%subhash;
4867 + ($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
4868 + print "\t\t};\n" if $DEBUG;
4869 + }
4870 + else {
4871 + ($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
4872 + die "Error in $file line $linenum: must be a ';' instead " .
4873 + "of '$info'\n" unless $info eq ';';
4874 + print "\t\t$subkeyword\t$subvalue;\n" if $DEBUG;
4875 + $hash{$subkeyword} = $subvalue;
4876 + ($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
4877 + }
4878 + }
4879 + ($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
4880 + die "Error in $file line $linenum: must be a ';' instead of '$info'\n"
4881 + unless $info eq ';';
4882 + push @{$output{$section}{$keyword}}, \%hash;
4883 + ($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
4884 + print "\t};\n" if $DEBUG;
4885 + }
4886 + else {
4887 + ($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
4888 + die "Error in $file line $linenum: must be a ';' instead of '$info'\n"
4889 + unless $info eq ';';
4890 + print "\t$keyword\t$value;\n" if $DEBUG;
4891 + $output{$section}{$keyword} = $value;
4892 + ($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
4893 + }
4894 + }
4895 + die "Error in $file line $linenum: must be a '}' instead of '$info'\n"
4896 + unless $info eq '}';
4897 + ($info, $linenum, $line) = &read_conf ($linenum, $line, \*FILE);
4898 + die "Error in $file line $linenum: must be a ';' instead of '$info'\n"
4899 + unless $info eq ';';
4900 + print "};\n\n" if $DEBUG;
4901 + }
4902 + close FILE;
4903 + $output{'_order_'} = \@list;
4904 +}
4905 +
4906 +sub read_conf {
4907 + my ($linenum, $line, $file) = @_;
4908 + *FILE = *$file;
4909 +
4910 + $line =~ s,^\s+,,o; # remove useless blanks
4911 + $line =~ s,^(\#|//).*$,,o; # remove comments (at the beginning)
4912 + while (($line =~ m/^$/o || $line =~ m/^\"[^\"]*$/o) && !(eof (FILE))) {
4913 + $line .= <FILE>; # read one line
4914 + $linenum++;
4915 + $line =~ s,^\s*,,om; # remove useless blanks
4916 + $line =~ s,^(\#|//).*$,,om; # remove comments (at the beginning)
4917 + }
4918 + $line =~ s/^( # at the beginning
4919 + [{};] # match '{', '}', or ';'
4920 + | # OR
4921 + \" # a double quoted string
4922 + (?:\\.|[^\"\\])*
4923 + \"
4924 + | # OR
4925 + [^{};\"\s]+ # a word
4926 + )\s*//mox;
4927 + my $info = $1;
4928 + if (defined $info && $info) {
4929 + chomp $info;
4930 + }
4931 + else {
4932 + warn "Syntax error in conf file line $linenum.\n";
4933 + }
4934 + return ($info, $linenum, $line);
4935 +}
4936 +
4937 +sub GetValue {
4938 + my $v = shift;
4939 + my ($r) = $v =~ m/^(?:\"\s*)?(.*?)(?:\s*\")?$/so;
4940 + return $r;
4941 +}
4942 +
4943 +sub Usage {
4944 + my ($base) = $0 =~ /([^\/]+)$/;
4945 + print "Usage: $base -f innreport.conf [-[no]options]\n";
4946 + print " where options are:\n";
4947 + print " -h (or -help) this help page\n";
4948 + print " -v display the version number of INNreport\n";
4949 + print " -config print INNreport configuration information\n";
4950 + print " -html HTML output";
4951 + print " [default]" if ($HTML);
4952 + print "\n";
4953 + print " -g want graphs";
4954 + print " [default]" if ($GRAPH);
4955 + print "\n";
4956 + print " -graph an alias for option -g\n";
4957 + print " -d directory directory for Web pages";
4958 + print "\n [default=$HTML_dir]"
4959 + if (defined ($HTML_dir));
4960 + print "\n";
4961 + print " -dir directory an alias for option -d\n";
4962 + print " -p directory pictures path (file space)";
4963 + print "\n [default=$IMG_dir]"
4964 + if (defined ($IMG_dir));
4965 + print "\n";
4966 + print " -path directory an alias for option -p\n";
4967 + print " -w directory pictures path (web space)";
4968 + print " [default=$IMG_pth]" if (defined ($IMG_pth));
4969 + print "\n";
4970 + print " -webpath directory an alias for option -w\n";
4971 + print "\n";
4972 + print " -i file Name of index file";
4973 + print " [default=$index]" if (defined ($index));
4974 + print "\n";
4975 + print " -index file an alias for option -i\n";
4976 + print " -a want to archive HTML results";
4977 + print " [default]" if ($ARCHIVE);
4978 + print "\n";
4979 + print " -archive an alias for option -a\n";
4980 + print " -c number how many report files to keep (0 = all)\n";
4981 + print " [default=$CYCLE]"
4982 + if (defined ($CYCLE));
4983 + print "\n";
4984 + print " -cycle number an alias for option -c\n";
4985 + print " -s char separator for filename";
4986 + print " [default=\"$SEPARATOR\"]\n";
4987 + print " -separator char an alias for option -s\n";
4988 + print " -unknown \"Unknown entries from news log file\"\n";
4989 + print " report";
4990 + print " [default]" if ($WANT_UNKNOWN);
4991 + print "\n";
4992 + print " -html-unknown Same as above, but in generated HTML output.";
4993 + print " [default]" if ($WANT_UNKNOWN);
4994 + print "\n";
4995 + print " -maxunrec Max number of unrecognized lines to display\n";
4996 + print " [default=$MAX_UNRECOGNIZED]"
4997 + if (defined ($MAX_UNRECOGNIZED));
4998 + print "\n";
4999 + print " -notdaily Never perform daily actions";
5000 + print " [default]" if $NOT_DAILY;
5001 + print "\n";
5002 + print " -casesensitive Case sensitive";
5003 + print " [default]" if ($CASE_SENSITIVE);
5004 + print "\n\n";
5005 + print "Use no in front of boolean options to unset them.\n";
5006 + print "For example, \"-html\" is set by default. Use \"-nohtml\" to remove this\n";
5007 + print "feature.\n";
5008 + exit 0;
5009 +}
5010 +
5011 +sub Version {
5012 + print "\nThis is INNreport version $version\n\n";
5013 + print "Copyright 1996-1999, Fabien Tassin <fta\@sofaraway.org>\n";
5014 + exit 0;
5015 +}
5016 +
5017 +sub Summary {
5018 + use Config;
5019 +
5020 + # Convert empty arguments into null string ("")
5021 + my $i = 0;
5022 + foreach (@old_argv) {
5023 + $old_argv[$i] = '""' if $_ eq '';
5024 + $i++;
5025 + }
5026 +
5027 + # Display the summary
5028 + print "\nSummary of my INNreport (version $version) configuration:\n";
5029 + print " General options:\n";
5030 + print " command line='@old_argv' (please, check this value)\n";
5031 + print " html=" . ($HTML?"yes":"no") . ", graph=" .
5032 + ($GRAPH?"yes":"no") . ", haveGD=" .
5033 + ($::HAVE_GD?"yes":"no") . "\n";
5034 + print " archive=" . ($ARCHIVE?"yes":"no") .
5035 + ", cycle=$CYCLE, separator=\"" . $SEPARATOR . "\"\n";
5036 + print " case_sensitive=" .
5037 + ($CASE_SENSITIVE?"yes":"no") . ", want_unknown=" .
5038 + ($WANT_UNKNOWN?"yes":"no") .
5039 + ", max_unrecog=$MAX_UNRECOGNIZED\n";
5040 + print " Paths:\n";
5041 + print " html_dir=$HTML_dir\n";
5042 + print " img_dir=$IMG_dir\n";
5043 + print " img_pth=$IMG_pth\n";
5044 + print " index=$index\n";
5045 + print " Platform:\n";
5046 + print " perl version $::Config{baserev} "
5047 + . "patchlevel $::Config{patchlevel} "
5048 + . "subversion $::Config{subversion}\n";
5049 + print " libperl=$::Config{libperl}, useshrplib=$::Config{useshrplib}, "
5050 + . "bincompat3=$::Config{bincompat3}\n";
5051 + print " osname=$::Config{osname}, osvers=$::Config{osvers}, "
5052 + . "archname=$::Config{archname}\n";
5053 + print " uname=$::Config{myuname}\n\n";
5054 +
5055 + exit 0;
5056 +}
5057 +
5058 +######################### End of File ##########################
5059 --- /dev/null
5060 +++ b/extra/innreport_inn.pm
5061 @@ -0,0 +1,2101 @@
5062 +##########################################################
5063 +# INN module for innreport (3.*).
5064 +#
5065 +# Sample file tested with INN 2.3, 2.2, 1.7.2 and 1.5.1
5066 +#
5067 +# (c) 1997-1999 by Fabien Tassin <[email protected]>
5068 +# version 3.0.2
5069 +##########################################################
5070 +
5071 +# TODO: add the map file.
5072 +
5073 +package innreport_inn;
5074 +
5075 +my $MIN = 1E10;
5076 +my $MAX = -1;
5077 +
5078 +my %ctlinnd = ('a', 'addhist', 'D', 'allow',
5079 + 'b', 'begin', 'c', 'cancel',
5080 + 'u', 'changegroup', 'd', 'checkfile',
5081 + 'e', 'drop', 'f', 'flush',
5082 + 'g', 'flushlogs', 'h', 'go',
5083 + 'i', 'hangup', 's', 'mode',
5084 + 'j', 'name', 'k', 'newgroup',
5085 + 'l', 'param', 'm', 'pause',
5086 + 'v', 'readers', 't', 'refile',
5087 + 'C', 'reject', 'o', 'reload',
5088 + 'n', 'renumber', 'z', 'reserve',
5089 + 'p', 'rmgroup', 'A', 'send',
5090 + 'q', 'shutdown', 'B', 'signal',
5091 + 'r', 'throttle', 'w', 'trace',
5092 + 'x', 'xabort', 'y', 'xexec',
5093 + 'E', 'logmode', 'F', 'feedinfo',
5094 + 'T', 'filter', 'P', 'perl',);
5095 +
5096 +my %timer_names = (idle => 'idle',
5097 + hishave => 'history lookup',
5098 + hisgrep => 'history grep',
5099 + hiswrite => 'history write',
5100 + hissync => 'history sync',
5101 + artlink => 'article link',
5102 + artwrite => 'article write',
5103 + artcncl => 'article cancel',
5104 + artctrl => 'article control',
5105 + sitesend => 'site send',
5106 + perl => 'perl filter',
5107 +);
5108 +
5109 +my %innfeed_timer_names = (
5110 + 'idle' => 'idle',
5111 + 'blstats' => 'backlog stats',
5112 + 'stsfile' => 'status file',
5113 + 'newart' => 'article new',
5114 + 'prepart' => 'article prepare',
5115 + 'readart' => 'article read',
5116 + 'read' => 'data read',
5117 + 'write' => 'data write',
5118 + 'cb' => 'callbacks',
5119 +);
5120 +
5121 +my %nnrpd_timer_names = (
5122 + 'idle' => 'idle',
5123 + 'newnews' => 'newnews',
5124 +);
5125 +
5126 +# init innd timer
5127 +foreach (values %timer_names) {
5128 + $innd_time_min{$_} = $MIN;
5129 + $innd_time_max{$_} = $MAX;
5130 + $innd_time_time{$_} = 0; # to avoid a warning... Perl < 5.004
5131 + $innd_time_num{$_} = 0; # ...
5132 +}
5133 +$innd_time_times = 0; # ...
5134 +
5135 +# init innfeed timer
5136 +foreach (values %innfeed_timer_names) {
5137 + $innfeed_time_min{$_} = $MIN;
5138 + $innfeed_time_max{$_} = $MAX;
5139 + $innfeed_time_time{$_} = 0; # to avoid a warning... Perl < 5.004
5140 + $innfeed_time_num{$_} = 0; # ...
5141 +}
5142 +$innfeed_time_times = 0; # ...
5143 +
5144 +# init nnrpd timer
5145 +foreach (values %nnrpd_timer_names) {
5146 + $nnrpd_time_min{$_} = $MIN;
5147 + $nnrpd_time_max{$_} = $MAX;
5148 + $nnrpd_time_time{$_} = 0; # to avoid a warning... Perl < 5.004
5149 + $nnrpd_time_num{$_} = 0; # ...
5150 +}
5151 +$nnrpd_time_times = 0; # ...
5152 +
5153 +# collect: Used to collect the data.
5154 +sub collect {
5155 + my ($day, $hour, $prog, $res, $left, $CASE_SENSITIVE) = @_;
5156 +
5157 + return 1 if $left =~ /Reading config from (\S+)$/o;
5158 +
5159 + ########
5160 + ## inn (from the "news" log file - not from "news.notice")
5161 + ##
5162 + if ($prog eq "inn") {
5163 + # accepted article
5164 + if ($res =~ m/[\+j]/o) {
5165 + $hour =~ s/:.*$//o;
5166 + $inn_flow{"$day $hour"}++;
5167 + $inn_flow_total++;
5168 +
5169 + # Memorize the size. This can only be done with INN >= 1.5xx and
5170 + # DO_LOG_SIZE = DO.
5171 +
5172 + # server <msg-id> size [feeds]
5173 + # or
5174 + # server <msg-id> (filename) size [feeds]
5175 +
5176 + my ($s) = $left =~ /^\S+ \S+ (?:\(\S+\) )?(\d+)(?: |$)/o;
5177 + if ($s) {
5178 + $inn_flow_size{"$day $hour"} += $s;
5179 + $inn_flow_size_total += $s;
5180 + }
5181 + return 1;
5182 + }
5183 +
5184 + # 437 Duplicate article
5185 + if ($left =~ /(\S+) <[^>]+> 437 Duplicate(?: article)?$/o) {
5186 + my $server = $1;
5187 + $server = lc $server unless $CASE_SENSITIVE;
5188 + $inn_badart{$server}++;
5189 + $inn_duplicate{$server}++;
5190 + return 1;
5191 + }
5192 + # 437 Unapproved for
5193 + if ($left =~ /(\S+) <[^>]+> 437 Unapproved for \"([^\"]+)\"$/o) {
5194 + my ($server, $group) = ($1, $2);
5195 + $server = lc $server unless $CASE_SENSITIVE;
5196 + $inn_badart{$server}++;
5197 + $inn_unapproved{$server}++;
5198 + $inn_unapproved_g{$group}++;
5199 + return 1;
5200 + }
5201 + # 437 Too old -- ...
5202 + if ($left =~ /(\S+) <[^>]+> 437 Too old -- /o) {
5203 + my $server = $1;
5204 + $server = lc $server unless $CASE_SENSITIVE;
5205 + $inn_badart{$server}++;
5206 + $inn_tooold{$server}++;
5207 + return 1;
5208 + }
5209 + # 437 Unwanted site ... in path
5210 + if ($left =~ /(\S+) <[^>]+> 437 Unwanted site (\S+) in path$/o) {
5211 + my ($server, $site) = ($1, $2);
5212 + $server = lc $server unless $CASE_SENSITIVE;
5213 + $inn_badart{$server}++;
5214 + $inn_uw_site{$server}++;
5215 + $inn_site_path{$site}++;
5216 + return 1;
5217 + }
5218 + # 437 Unwanted newsgroup "..."
5219 + if ($left =~ /(\S+) <[^>]+> 437 Unwanted newsgroup \"(\S+)\"$/o) {
5220 + my ($server, $group) = ($1, $2);
5221 + ($group) = split(/,/, $group);
5222 + $server = lc $server unless $CASE_SENSITIVE;
5223 + $inn_badart{$server}++;
5224 + $inn_uw_ng_s{$server}++;
5225 + $inn_uw_ng{$group}++;
5226 + return 1;
5227 + }
5228 + # 437 Unwanted distribution "..."
5229 + if ($left =~ /(\S+) <[^>]+> 437 Unwanted distribution \"(\S+)\"$/o) {
5230 + my ($server, $dist) = ($1, $2);
5231 + $server = lc $server unless $CASE_SENSITIVE;
5232 + $inn_badart{$server}++;
5233 + $inn_uw_dist_s{$server}++;
5234 + $inn_uw_dist{$dist}++;
5235 + return 1;
5236 + }
5237 + # 437 Linecount x != y +- z
5238 + if ($left =~ /(\S+) <[^>]+> 437 Linecount/o) {
5239 + my $server = $1;
5240 + $server = lc $server unless $CASE_SENSITIVE;
5241 + $inn_badart{$server}++;
5242 + $inn_linecount{$server}++;
5243 + return 1;
5244 + }
5245 + # 437 No colon-space in "xxxx" header
5246 + if ($left =~ /(\S+) <[^>]+> 437 No colon-space in \"[^\"]+\" header/o) {
5247 + my $server = $1;
5248 + $server = lc $server unless $CASE_SENSITIVE;
5249 + $inn_badart{$server}++;
5250 + $innd_others{$server}++;
5251 + $innd_no_colon_space{$server}++;
5252 + return 1;
5253 + }
5254 + # 437 Article posted in the future -- "xxxxx"
5255 + if ($left =~ /(\S+) <[^>]+> 437 Article posted in the future -- \"[^\"]+\"/o) {
5256 + my $server = $1;
5257 + $server = lc $server unless $CASE_SENSITIVE;
5258 + $innd_posted_future{$server}++;
5259 + $innd_others{$server}++;
5260 + $inn_badart{$server}++;
5261 + return 1;
5262 + }
5263 + # 437 article includes "....."
5264 + if ($left =~ /(\S+) <[^>]+> 437 article includes/o) {
5265 + my $server = $1;
5266 + $server = lc $server unless $CASE_SENSITIVE;
5267 + $innd_strange_strings{$server}++;
5268 + $innd_others{$server}++;
5269 + $inn_badart{$server}++;
5270 + return 1;
5271 + }
5272 + # Cancelling <...>
5273 + if ($left =~ /(\S+) <[^>]+> Cancelling/o) {
5274 + return 1;
5275 + }
5276 + # all others are just counted as "Other"
5277 + if ($left =~ /(\S+) /o) {
5278 + my $server = $1;
5279 + $server = lc $server unless $CASE_SENSITIVE;
5280 + $inn_badart{$server}++;
5281 + $innd_others{$server}++;
5282 + return 1;
5283 + }
5284 + }
5285 +
5286 + ########
5287 + ## innd
5288 + if ($prog eq "innd") {
5289 + ## Note for innd logs:
5290 + ## there's a lot of entries detected but still not used
5291 + ## (because of a lack of interest).
5292 +
5293 + # think it's a dotquad
5294 + return 1 if $left =~ /^think it\'s a dotquad$/o;
5295 + if ($left =~ /^SERVER /o) {
5296 + # SERVER perl filtering enabled
5297 + return 1 if $left =~ /^SERVER perl filtering enabled$/o;
5298 + # SERVER perl filtering disabled
5299 + return 1 if $left =~ /^SERVER perl filtering disabled$/o;
5300 + # SERVER cancelled +id
5301 + return 1 if $left =~ /^SERVER cancelled /o;
5302 + }
5303 + # rejecting[perl]
5304 + if ($left =~ /^rejecting\[perl\] <[^>]+> \d+ (.*)/o) {
5305 + $innd_filter_perl{$1}++;
5306 + return 1;
5307 + }
5308 + # closed lost
5309 + return 1 if $left =~ /^\S+ closed lost \d+/o;
5310 + # control command (by letter)
5311 + if ($left =~ /^(\w)$/o) {
5312 + my $command = $1;
5313 + my $cmd = $ctlinnd{$command};
5314 + $cmd = $command unless $cmd;
5315 + return 1 if $cmd eq 'flush'; # to avoid a double count
5316 + $innd_control{"$cmd"}++;
5317 + return 1;
5318 + }
5319 + # control command (letter + reason)
5320 + if ($left =~ /^(\w):.*$/o) {
5321 + my $command = $1;
5322 + my $cmd = $ctlinnd{$command};
5323 + $cmd = $command unless $cmd;
5324 + return 1 if $cmd eq 'flush'; # to avoid a double count
5325 + $innd_control{"$cmd"}++;
5326 + return 1;
5327 + }
5328 + # opened
5329 + return 1 if $left =~ /\S+ opened \S+:\d+:file$/o;
5330 + # buffered
5331 + return 1 if $left =~ /\S+ buffered$/o;
5332 + # spawned
5333 + return 1 if $left =~ /\S+ spawned \S+:\d+:proc:\d+$/o;
5334 + return 1 if $left =~ /\S+ spawned \S+:\d+:file$/o;
5335 + # running
5336 + return 1 if $left =~ /\S+ running$/o;
5337 + # sleeping
5338 + if ($left =~ /(\S+):\d+:proc:\d+ sleeping$/o) {
5339 + my $server = $1;
5340 + $server = lc $server unless $CASE_SENSITIVE;
5341 + $innd_blocked{$server}++;
5342 + return 1;
5343 + }
5344 + # blocked sleeping
5345 + if ($left =~ /(\S+):\d+:proc:\d+ blocked sleeping/o) {
5346 + my $server = $1;
5347 + $server = lc $server unless $CASE_SENSITIVE;
5348 + $innd_blocked{$server}++;
5349 + return 1;
5350 + }
5351 + if ($left =~ /(\S+):\d+ blocked sleeping/o) {
5352 + my $server = $1;
5353 + $server = lc $server unless $CASE_SENSITIVE;
5354 + $innd_blocked{$server}++;
5355 + return 1;
5356 + }
5357 + # restarted
5358 + return 1 if $left =~ m/^\S+ restarted$/o;
5359 + # starting
5360 + return 1 if $left =~ m/^\S+ starting$/o;
5361 + # readclose
5362 + return 1 if $left =~ m/^\S+:\d+ readclose+$/o;
5363 + # rejected 502
5364 + if ($left =~ m/^(\S+) rejected 502$/) {
5365 + my $server = $1;
5366 + $server = lc $server unless $CASE_SENSITIVE;
5367 + $innd_no_permission{$server}++;
5368 + return 1;
5369 + }
5370 + # rejected 505
5371 + if ($left =~ m/^(\S+) rejected 505$/) {
5372 + my $server = $1;
5373 + $server = lc $server unless $CASE_SENSITIVE;
5374 + $innd_too_many_connects_per_minute{$server}++;
5375 + return 1;
5376 + }
5377 + # connected
5378 + if ($left =~ /^(\S+) connected \d+/o) {
5379 + my $server = $1;
5380 + $server = lc $server unless $CASE_SENSITIVE;
5381 + $innd_connect{$server}++;
5382 + return 1;
5383 + }
5384 + # closed (with times)
5385 + if ($left =~ /(\S+):\d+ closed seconds (\d+) accepted (\d+) refused (\d+) rejected (\d+) duplicate (\d+) accepted size (\d+) duplicate size (\d+)$/o) {
5386 + my ($server, $seconds, $accepted, $refused, $rejected, $duplicate, $accptsize, $dupsize) =
5387 + ($1, $2, $3, $4, $5, $6, $7, $8);
5388 + $server = lc $server unless $CASE_SENSITIVE;
5389 + $innd_seconds{$server} += $seconds;
5390 + $innd_accepted{$server} += $accepted;
5391 + $innd_refused{$server} += $refused;
5392 + $innd_rejected{$server} += $rejected;
5393 + $innd_stored_size{$server} += $accptsize;
5394 + $innd_duplicated_size{$server} += $dupsize;
5395 + return 1;
5396 + } elsif ($left =~ /(\S+):\d+ closed seconds (\d+) accepted (\d+) refused (\d+) rejected (\d+)$/o) {
5397 + # closed (with times)
5398 + my ($server, $seconds, $accepted, $refused, $rejected) =
5399 + ($1, $2, $3, $4, $5);
5400 + $server = lc $server unless $CASE_SENSITIVE;
5401 + $innd_seconds{$server} += $seconds;
5402 + $innd_accepted{$server} += $accepted;
5403 + $innd_refused{$server} += $refused;
5404 + $innd_rejected{$server} += $rejected;
5405 + return 1;
5406 + }
5407 + # closed (without times (?))
5408 + return 1 if $left =~ m/\S+ closed$/o;
5409 + # checkpoint
5410 + return 1 if $left =~ m/^\S+:\d+ checkpoint /o;
5411 + # if ($left =~ /(\S+):\d+ checkpoint seconds (\d+) accepted (\d+)
5412 + # refused (\d+) rejected (\d+)$/) {
5413 + # # Skipped...
5414 + # my ($server, $seconds, $accepted, $refused, $rejected) =
5415 + # ($1, $2, $3, $4, $5);
5416 + # $innd_seconds{$server} += $seconds;
5417 + # $innd_accepted{$server} += $accepted;
5418 + # $innd_refused{$server} += $refused;
5419 + # $innd_rejected{$server} += $rejected;
5420 + # return 1;
5421 + # }
5422 +
5423 + # flush
5424 + if ($left =~ /(\S+) flush$/o) {
5425 + $innd_control{"flush"}++;
5426 + return 1;
5427 + }
5428 + # flush-file
5429 + if ($left =~ /flush_file/) {
5430 + $innd_control{"flush_file"}++;
5431 + return 1;
5432 + }
5433 + # too many connections from site
5434 + if ($left =~ /too many connections from (\S+)/o) {
5435 + $innd_max_conn{$1}++;
5436 + return 1;
5437 + }
5438 + # overview exit 0 elapsed 23 pid 28461
5439 + return 1 if $left =~ m/\S+ exit \d+ .*$/o;
5440 + # internal rejecting huge article
5441 + if ($left =~ /(\S+) internal rejecting huge article/o) {
5442 + my $server = $1;
5443 + $server =~ s/:\d+$//o;
5444 + $server = lc $server unless $CASE_SENSITIVE;
5445 + $innd_huge{$server}++;
5446 + return 1;
5447 + }
5448 + # internal closing free channel
5449 + if ($left =~ /(\S+) internal closing free channel/o) {
5450 + $innd_misc{"Free channel"}++;
5451 + return 1;
5452 + }
5453 + # internal (other)
5454 + return 1 if $left =~ /\S+ internal/o;
5455 + # wakeup
5456 + return 1 if $left =~ /\S+ wakeup$/o;
5457 + # throttle
5458 + if ($left =~ /(\S+) throttled? /) {
5459 + $innd_control{"throttle"}++;
5460 + return 1;
5461 + }
5462 + # profile timer
5463 + # ME time X nnnn X(X) [...]
5464 + # The exact timers change from various versions of INN, so try to deal
5465 + # with this in a general fashion.
5466 + if ($left =~ m/^\S+\s+ # ME
5467 + time\ (\d+)\s+ # time
5468 + ((?:\S+\ \d+\(\d+\)\s*)+) # timer values
5469 + $/ox) {
5470 + $innd_time_times += $1;
5471 + my $timers = $2;
5472 +
5473 + while ($timers =~ /(\S+) (\d+)\((\d+)\)\s*/g) {
5474 + my $name = $timer_names{$1} || $1;
5475 + my $average = $2 / ($3 || 1);
5476 + $innd_time_time{$name} += $2;
5477 + $innd_time_num{$name} += $3;
5478 + $innd_time_min{$name} = $average
5479 + if ($3 && $innd_time_min{$name} > $average);
5480 + $innd_time_max{$name} = $average
5481 + if ($3 && $innd_time_max{$name} < $average);
5482 + }
5483 + return 1;
5484 + }
5485 + # ME time xx idle xx(xx) [ bug ? a part of timer ?]
5486 + return 1 if $left =~ m/^ME time \d+ idle \d+\(\d+\)\s*$/o;
5487 + # ME HISstats x hitpos x hitneg x missed x dne
5488 + #
5489 + # from innd/his.c:
5490 + # HIShitpos: the entry existed in the cache and in history.
5491 + # HIShitneg: the entry existed in the cache but not in history.
5492 + # HISmisses: the entry was not in the cache, but was in the history file.
5493 + # HISdne: the entry was not in cache or history.
5494 + if ($left =~ m/^ME\ HISstats # ME HISstats
5495 + \ (\d+)\s+hitpos # hitpos
5496 + \ (\d+)\s+hitneg # hitneg
5497 + \ (\d+)\s+missed # missed
5498 + \ (\d+)\s+dne # dne
5499 + $/ox) {
5500 + $innd_his{'Positive hits'} += $1;
5501 + $innd_his{'Negative hits'} += $2;
5502 + $innd_his{'Cache misses'} += $3;
5503 + $innd_his{'Do not exist'} += $4;
5504 + return 1;
5505 + }
5506 + # SERVER history cache final: 388656 lookups, 1360 hits
5507 + if ($left =~ m/^SERVER history cache final: (\d+) lookups, (\d+) hits$/) {
5508 + $innd_cache{'Lookups'} += $1;
5509 + $innd_cache{'Hits'} += $2;
5510 + return 1;
5511 + }
5512 + # added by Md 20000122
5513 + return 1 if $left =~ m/^Pre-commit cache initialized/;
5514 + # bad_hosts (appears after a "cant gesthostbyname" from a feed)
5515 + return 1 if $left =~ m/\S+ bad_hosts /o;
5516 + # cant read
5517 + return 1 if $left =~ m/\S+ cant read/o;
5518 + # cant write
5519 + return 1 if $left =~ m/\S+ cant write/o;
5520 + # cant flush
5521 + return 1 if $left =~ m/\S+ cant flush/o;
5522 + # spoolwake
5523 + return 1 if $left =~ m/\S+ spoolwake$/o;
5524 + # spooling
5525 + return 1 if $left =~ m/\S+ spooling/o;
5526 + # DEBUG
5527 + return 1 if $left =~ m/^DEBUG /o;
5528 + # NCmode
5529 + return 1 if $left =~ m/\S+ NCmode /o;
5530 + # outgoing
5531 + return 1 if $left =~ m/\S+ outgoing/o;
5532 + # inactive
5533 + return 1 if $left =~ m/\S+ inactive/o;
5534 + # timeout
5535 + return 1 if $left =~ m/\S+ timeout/o;
5536 + # lcsetup
5537 + return 1 if $left =~ m/\S+ lcsetup/o;
5538 + # rcsetup
5539 + return 1 if $left =~ m/\S+ rcsetup/o;
5540 + # flush_all
5541 + return 1 if $left =~ m/\S+ flush_all/o;
5542 + # buffered
5543 + return 1 if $left =~ m/\S+ buffered$/o;
5544 + # descriptors
5545 + return 1 if $left =~ m/\S+ descriptors/o;
5546 + # ccsetup
5547 + return 1 if $left =~ m/\S+ ccsetup/o;
5548 + # renumbering
5549 + return 1 if $left =~ m/\S+ renumbering/o;
5550 + # renumber
5551 + return 1 if $left =~ m/\S+ renumber /o;
5552 + # ihave from me
5553 + if ($left =~ m/\S+ ihave_from_me /o) {
5554 + $controlchan_ihave_site{'ME'}++;
5555 + return 1;
5556 + }
5557 + # sendme from me
5558 + if ($left =~ m/\S+ sendme_from_me /o) {
5559 + $controlchan_sendme_site{'ME'}++;
5560 + return 1;
5561 + }
5562 + # newgroup
5563 + if ($left =~ m/\S+ newgroup (\S+) as (\S)/o) {
5564 + $innd_newgroup{$1} = $2;
5565 + return 1;
5566 + }
5567 + # rmgroup
5568 + if ($left =~ m/\S+ rmgroup (\S+)$/o) {
5569 + $innd_rmgroup{$1}++;
5570 + return 1;
5571 + }
5572 + # changegroup
5573 + if ($left =~ m/\S+ change_group (\S+) to (\S)/o) {
5574 + $innd_changegroup{$1} = $2;
5575 + return 1;
5576 + }
5577 + # paused
5578 + if ($left =~ m/(\S+) paused /o) {
5579 + $innd_control{"paused"}++;
5580 + return 1;
5581 + }
5582 + # throttled
5583 + return 1 if $left =~ m/\S+ throttled/o;
5584 + # reload
5585 + if ($left =~ m/(\S+) reload/o) {
5586 + $innd_control{"reload"}++;
5587 + return 1;
5588 + }
5589 + # shutdown
5590 + if ($left =~ m/(\S+) shutdown/o) {
5591 + $innd_control{"shutdown"}++;
5592 + return 1;
5593 + }
5594 + # SERVER servermode paused
5595 + return 1 if ($left =~ /(\S+) servermode paused$/o);
5596 + # SERVER servermode running
5597 + return 1 if ($left =~ /(\S+) servermode running$/o);
5598 + # SERVER flushlogs paused
5599 + if ($left =~ /(\S+) flushlogs /) {
5600 + $innd_control{"flushlogs"}++;
5601 + return 1;
5602 + }
5603 + # think it's a dotquad
5604 + return 1 if $left =~ /think it\'s a dotquad: /o;
5605 + # bad_ihave
5606 + if ($left =~ /(\S+) bad_ihave /) {
5607 + my $server = $1;
5608 + $server =~ s/:\d+$//o;
5609 + $server = lc $server unless $CASE_SENSITIVE;
5610 + $innd_bad_ihave{$server}++;
5611 + return 1;
5612 + }
5613 + # bad_messageid
5614 + if ($left =~ /(\S+) bad_messageid/o) {
5615 + my $server = $1;
5616 + $server =~ s/:\d+$//o;
5617 + $server = lc $server unless $CASE_SENSITIVE;
5618 + $innd_bad_msgid{$server}++;
5619 + return 1;
5620 + }
5621 + # bad_sendme
5622 + if ($left =~ /(\S+) bad_sendme /o) {
5623 + my $server = $1;
5624 + $server =~ s/:\d+$//o;
5625 + $server = lc $server unless $CASE_SENSITIVE;
5626 + $innd_bad_sendme{$server}++;
5627 + return 1;
5628 + }
5629 + # bad_command
5630 + if ($left =~ /(\S+) bad_command /o) {
5631 + my $server = $1;
5632 + $server =~ s/:\d+$//o;
5633 + $server = lc $server unless $CASE_SENSITIVE;
5634 + $innd_bad_command{$server}++;
5635 + return 1;
5636 + }
5637 + # bad_newsgroup
5638 + if ($left =~ /(\S+) bad_newsgroup /o) {
5639 + my $server = $1;
5640 + $server =~ s/:\d+$//o;
5641 + $innd_bad_newsgroup{$server}++;
5642 + $server = lc $server unless $CASE_SENSITIVE;
5643 + return 1;
5644 + }
5645 + if ($left =~ m/ cant /o) {
5646 + # cant select Bad file number
5647 + if ($left =~ / cant select Bad file number/o) {
5648 + $innd_misc{"Bad file number"}++;
5649 + return 1;
5650 + }
5651 + # cant gethostbyname
5652 + if ($left =~ / cant gethostbyname/o) {
5653 + $innd_misc{"gethostbyname error"}++;
5654 + return 1;
5655 + }
5656 + # cant accept RCreader
5657 + if ($left =~ / cant accept RCreader /o) {
5658 + $innd_misc{"RCreader"}++;
5659 + return 1;
5660 + }
5661 + # cant sendto CCreader
5662 + if ($left =~ / cant sendto CCreader /o) {
5663 + $innd_misc{"CCreader"}++;
5664 + return 1;
5665 + }
5666 + # cant (other) skipped - not particularly interesting
5667 + return 1;
5668 + }
5669 + # bad_newsfeeds no feeding sites
5670 + return 1 if $left =~ /\S+ bad_newsfeeds no feeding sites/o;
5671 + # CNFS-sm: cycbuff rollover - possibly interesting
5672 + return 1 if $left =~ /CNFS-sm: cycbuff \S+ rollover to cycle/o;
5673 + # CNFS-sm: CNFSflushallheads: flushing - possibly interesting
5674 + return 1 if $left =~ /CNFS-sm: CNFSflushallheads: flushing /o;
5675 + # CNFS-sm: metacycbuff rollover with SEQUENTIAL
5676 + return 1 if $left =~ /CNFS-sm: metacycbuff \S+ cycbuff is moved to /o;
5677 + # Cleanfeed status reports
5678 + return 1 if $left =~ /^filter: status/o;
5679 + }
5680 + ########
5681 + ## innfeed
5682 + if ($prog eq "innfeed") {
5683 + # connected
5684 + if ($left =~ /(\S+):\d+ connected$/) {
5685 + my $server = $1;
5686 + $server = lc $server unless $CASE_SENSITIVE;
5687 + $innfeed_connect{$server}++;
5688 + return 1;
5689 + }
5690 + # closed periodic
5691 + return 1 if $left =~ m/\S+:\d+ closed periodic$/o;
5692 + # periodic close
5693 + return 1 if $left =~ m/\S+:\d+ periodic close$/o;
5694 + # final (child)
5695 + return 1 if $left =~ m/\S+:\d+ final seconds \d+ offered \d+ accepted \d+ refused \d+ rejected \d+/o;
5696 + # global (real)
5697 + return 1 if $left =~ m/\S+ global seconds \d+ offered \d+ accepted \d+ refused \d+ rejected \d+ missing \d+/o;
5698 + # final (real) (new format)
5699 + if ($left =~ /(\S+) final seconds (\d+) offered (\d+) accepted (\d+) refused (\d+) rejected (\d+) missing (\d+) accsize (\d+) rejsize (\d+) spooled (\d+)/o) {
5700 + my ($server, $seconds, $offered, $accepted, $refused, $rejected,
5701 + $missing, $accepted_size, $rejected_size, $spooled) = ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10);
5702 + $server = lc $server unless $CASE_SENSITIVE;
5703 + $innfeed_seconds{$server} += $seconds;
5704 + $innfeed_offered{$server} += $offered;
5705 + $innfeed_accepted{$server} += $accepted;
5706 + $innfeed_refused{$server} += $refused;
5707 + $innfeed_rejected{$server} += $rejected;
5708 + $innfeed_missing{$server} += $missing;
5709 + $innfeed_spooled{$server} += $spooled;
5710 + $innfeed_accepted_size{$server} += $accepted_size;
5711 + $innfeed_rejected_size{$server} += $rejected_size;
5712 + return 1;
5713 + } elsif ($left =~ /(\S+) final seconds (\d+) offered (\d+) accepted (\d+) refused (\d+) rejected (\d+) missing (\d+) spooled (\d+)/o) {
5714 + my ($server, $seconds, $offered, $accepted, $refused, $rejected,
5715 + $missing, $spooled) = ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10);
5716 + $server = lc $server unless $CASE_SENSITIVE;
5717 + $innfeed_seconds{$server} += $seconds;
5718 + $innfeed_offered{$server} += $offered;
5719 + $innfeed_accepted{$server} += $accepted;
5720 + $innfeed_refused{$server} += $refused;
5721 + $innfeed_rejected{$server} += $rejected;
5722 + $innfeed_missing{$server} += $missing;
5723 + $innfeed_spooled{$server} += $spooled;
5724 + return 1;
5725 + }
5726 + # final (only seconds & spooled)
5727 + if ($left =~ /(\S+) final seconds (\d+) spooled (\d+)/o) {
5728 + my ($server, $seconds, $spooled) = ($1, $2, $3);
5729 + $server = lc $server unless $CASE_SENSITIVE;
5730 + $innfeed_seconds{$server} += $seconds;
5731 + $innfeed_spooled{$server} += $spooled;
5732 + return 1;
5733 + }
5734 + # checkpoint
5735 + return 1 if $left =~ m/\S+ checkpoint seconds/o;
5736 + # ME file xxxx shrunk from yyyy to zzz
5737 + if ($left =~ /^ME file (.*)\.output shrunk from (\d+) to (\d+)$/) {
5738 + my ($file, $s1, $s2) = ($1, $2, $3);
5739 + $file =~ s|^.*/([^/]+)$|$1|; # keep only the server name
5740 + $innfeed_shrunk{$file} += $s1 - $s2;
5741 + return 1;
5742 + }
5743 + # profile timer
5744 + # ME time X nnnn X(X) [...]
5745 + return 1 if $left =~ m/backlogstats/;
5746 + if ($left =~ m/^\S+\s+ # ME
5747 + time\ (\d+)\s+ # time
5748 + ((?:\S+\ \d+\(\d+\)\s*)+) # timer values
5749 + $/ox) {
5750 + $innfeed_time_times += $1;
5751 + my $timers = $2;
5752 +
5753 + while ($timers =~ /(\S+) (\d+)\((\d+)\)\s*/g) {
5754 + my $name = $innfeed_timer_names{$1} || $1;
5755 + my $average = $2 / ($3 || 1);
5756 + $innfeed_time_time{$name} += $2;
5757 + $innfeed_time_num{$name} += $3;
5758 + $innfeed_time_min{$name} = $average
5759 + if ($3 && $innfeed_time_min{$name} > $average);
5760 + $innfeed_time_max{$name} = $average
5761 + if ($3 && $innfeed_time_max{$name} < $average);
5762 + }
5763 + return 1;
5764 + }
5765 + # xxx grabbing external tape file
5766 + return 1 if $left =~ m/ grabbing external tape file/o;
5767 + # hostChkCxns - maxConnections was
5768 + return 1 if $left =~ m/hostChkCxns - maxConnections was /o;
5769 + # cxnsleep
5770 + return 1 if $left =~ m/\S+ cxnsleep .*$/o;
5771 + # idle
5772 + return 1 if $left =~ m/\S+ idle tearing down connection$/o;
5773 + # remote
5774 + return 1 if $left =~ m/\S+ remote .*$/o;
5775 + # spooling
5776 + return 1 if $left =~ m/\S+ spooling no active connections$/o;
5777 + # ME articles total
5778 + return 1 if $left =~ m/(?:SERVER|ME) articles total \d+ bytes \d+/o;
5779 + # ME articles active
5780 + return 1 if $left =~ m/(?:SERVER|ME) articles active \d+ bytes \d+/o;
5781 + # connect : Connection refused
5782 + return 1 if $left =~ m/connect : Connection refused/o;
5783 + # connect : Network is unreachable
5784 + return 1 if $left =~ m/connect : Network is unreachable/o;
5785 + # connect : Address family not supported by protocol
5786 + return 1 if $left =~ m/connect : Address family not supported by protocol/o;
5787 + # connect : No route to host
5788 + return 1 if $left =~ m/connect : No route to host/o;
5789 + # connection vanishing
5790 + return 1 if $left =~ m/connection vanishing/o;
5791 + # can't resolve hostname
5792 + return 1 if $left =~ m/can\'t resolve hostname/o;
5793 + # new hand-prepared backlog file
5794 + return 1 if $left =~ m/new hand-prepared backlog file/o;
5795 + # flush re-connect failed
5796 + return 1 if $left =~ m/flush re-connect failed/o;
5797 + # internal QUIT while write pending
5798 + return 1 if $left =~ m/internal QUIT while write pending/o;
5799 + # ME source lost . Exiting
5800 + return 1 if $left =~ m/(?:SERVER|ME) source lost . Exiting/o;
5801 + # ME starting innfeed (+version & date)
5802 + return 1 if $left =~ m/(?:SERVER|ME) starting innfeed/o;
5803 + # ME finishing at (date)
5804 + return 1 if $left =~ m/(?:SERVER|ME) finishing at /o;
5805 + # mode no-CHECK entered
5806 + return 1 if $left =~ m/mode no-CHECK entered/o;
5807 + # mode no-CHECK exited
5808 + return 1 if $left =~ m/mode no-CHECK exited/o;
5809 + # closed
5810 + return 1 if $left =~ m/^(\S+) closed$/o;
5811 + # global (+ seconds offered accepted refused rejected missing)
5812 + return 1 if $left =~ m/^(\S+) global/o;
5813 + # idle connection still has articles
5814 + return 1 if $left =~ m/^(\S+) idle connection still has articles$/o;
5815 + # missing article for IHAVE-body
5816 + return 1 if $left =~ m/^(\S+) missing article for IHAVE-body$/o;
5817 + # cannot continue
5818 + return 1 if $left =~ m/^cannot continue/o;
5819 + if ($left =~ /^(?:SERVER|ME)/o) {
5820 + # ME dropping articles into ...
5821 + return 1 if $left = ~/ dropping articles into /o;
5822 + # ME dropped ...
5823 + return 1 if $left = ~/ dropped /o;
5824 + # ME internal bad data in checkpoint file
5825 + return 1 if $left =~ m/ internal bad data in checkpoint/o;
5826 + # ME two filenames for same article
5827 + return 1 if $left =~ m/ two filenames for same article/o;
5828 + # ME unconfigured peer
5829 + return 1 if $left =~ m/ unconfigured peer/o;
5830 + # exceeding maximum article size
5831 + return 1 if $left =~ m/ exceeding maximum article byte/o;
5832 + # no space left on device errors
5833 + return 1 if $left =~ m/ ioerr fclose/o;
5834 + return 1 if $left =~ m/ lock failed for host/o;
5835 + return 1 if $left =~ m/ lock file pid-write/o;
5836 + return 1 if $left =~ m/ locked cannot setup peer/o;
5837 + return 1 if $left =~ m/ received shutdown signal/o;
5838 + # unconfigured peer
5839 + return 1 if $left =~ m/ unconfigured peer/o;
5840 + # ME lock
5841 + return 1 if $left =~ m/ lock/o;
5842 + # ME exception: getsockopt (0): Socket operation on non-socket
5843 + return 1 if $left =~ m/ exception: getsockopt /o;
5844 + # ME config aborting fopen (...) Permission denied
5845 + return 1 if $left =~ m/ config aborting fopen /o;
5846 + # ME cant chmod innfeed.pid....
5847 + return 1 if $left =~ m/ cant chmod \S+\/innfeed.pid/o;
5848 + return 1 if $left =~ m/ tape open failed /o;
5849 + return 1 if $left =~ m/ oserr open checkpoint file:/o;
5850 + # ME finishing (quickly)
5851 + return 1 if $left =~ m/\(quickly\) /o;
5852 + # ME config: value of streaming is not a boolean
5853 + return 1 if $left =~ m/config: value of \S+ is not/o;
5854 + }
5855 + # hostChkCxn - now: x.xx, prev: x.xx, abs: xx, curr: x
5856 + return 1 if $left =~ m/ hostChkCxn - now/o;
5857 + # loading path_to_config_file/innfeed.conf
5858 + return 1 if $left =~ m/loading /o;
5859 + # Finnaly, to avoid problems with strange error lines, ignore them.
5860 + #return 1 if ($left =~ /ME /);
5861 + }
5862 + ########
5863 + ## innxmit
5864 + if ($prog eq "innxmit") {
5865 + # 437 Duplicate article
5866 + if ($left =~ /(\S+) rejected [^\s]+ \(.*?\) 437 Duplicate article$/o) {
5867 + my $server = $1;
5868 + $server = lc $server unless $CASE_SENSITIVE;
5869 + $innxmit_badart{$server}++;
5870 + $innxmit_duplicate{$server}++;
5871 + return 1;
5872 + }
5873 + # 437 Unapproved for
5874 + if ($left =~ /(\S+) rejected [^\s]+ \(.*\) 437 Unapproved for \"(.*?)\"$/o) {
5875 + my ($server, $group) = ($1, $2);
5876 + $server = lc $server unless $CASE_SENSITIVE;
5877 + $innxmit_badart{$server}++;
5878 + $innxmit_unapproved{$server}++;
5879 + $innxmit_unapproved_g{$group}++;
5880 + return 1;
5881 + }
5882 + # 437 Too old -- ...
5883 + if ($left =~ /(\S+) rejected [^\s]+ \(.*\) 437 Too old -- \".*?\"$/o) {
5884 + my $server = $1;
5885 + $server = lc $server unless $CASE_SENSITIVE;
5886 + $innxmit_badart{$server}++;
5887 + $innxmit_tooold{$server}++;
5888 + return 1;
5889 + }
5890 + # 437 Unwanted site ... in path
5891 + if ($left =~
5892 + /(\S+) rejected [^\s]+ \(.*?\) 437 Unwanted site (\S+) in path$/o) {
5893 + my ($server, $site) = ($1, $2);
5894 + $server = lc $server unless $CASE_SENSITIVE;
5895 + $innxmit_badart{$server}++;
5896 + $innxmit_uw_site{$server}++;
5897 + # $innxmit_site_path{$site}++;
5898 + return 1;
5899 + }
5900 + # 437 Unwanted newsgroup "..."
5901 + if ($left =~
5902 + /(\S+) rejected [^\s]+ \(.*?\) 437 Unwanted newsgroup \"(\S+)\"$/o) {
5903 + my ($server, $group) = ($1, $2);
5904 + $server = lc $server unless $CASE_SENSITIVE;
5905 + $innxmit_badart{$server}++;
5906 + $innxmit_uw_ng_s{$server}++;
5907 + $innxmit_uw_ng{$group}++;
5908 + return 1;
5909 + }
5910 + # 437 Unwanted distribution "..."
5911 + if ($left =~
5912 + /(\S+) rejected [^\s]+ \(.*?\) 437 Unwanted distribution \"(\S+)\"$/o) {
5913 + my ($server, $dist) = ($1, $2);
5914 + $server = lc $server unless $CASE_SENSITIVE;
5915 + $innxmit_badart{$server}++;
5916 + $innxmit_uw_dist_s{$server}++;
5917 + $innxmit_uw_dist{$dist}++;
5918 + return 1;
5919 + }
5920 + # xx rejected foo.bar/12345 (foo/bar/12345) 437 Unwanted distribution "..."
5921 + if ($left =~ /^(\S+) rejected .* 437 Unwanted distribution \"(\S+)\"$/o) {
5922 + my ($server, $dist) = ($1, $2);
5923 + $server = lc $server unless $CASE_SENSITIVE;
5924 + $innxmit_badart{$server}++;
5925 + $innxmit_uw_dist_s{$server}++;
5926 + $innxmit_uw_dist{$dist}++;
5927 + return 1;
5928 + }
5929 + # 437 Linecount x != y +- z
5930 + if ($left =~ /(\S+) rejected [^\s]+ \(.*?\) 437 Linecount/o) {
5931 + my $server = $1;
5932 + $server = lc $server unless $CASE_SENSITIVE;
5933 + $innxmit_badart{$server}++;
5934 + $innxmit_linecount{$server}++;
5935 + return 1;
5936 + }
5937 + # 437 Newsgroup name illegal -- "xxx"
5938 + if ($left =~ /(\S+) rejected .* 437 Newsgroup name illegal -- "[^\"]*"$/) {
5939 + my $server = $1;
5940 + $server = lc $server unless $CASE_SENSITIVE;
5941 + $innxmit_others{$server}++;
5942 + $innxmit_badart{$server}++;
5943 + return 1;
5944 + }
5945 + # Streaming retries
5946 + return 1 if ($left =~ /\d+ Streaming retries$/o);
5947 + # ihave failed
5948 + if ($left =~ /(\S+) ihave failed/o) {
5949 + my $server = $1;
5950 + $server = lc $server unless $CASE_SENSITIVE;
5951 + $innxmit_ihfail{$server} = 1;
5952 + if ($left = /436 \S+ NNTP \S+ out of space/o) {
5953 + $innxmit_nospace{$server}++;
5954 + return 1;
5955 + }
5956 + if ($left = /400 \S+ space/o) {
5957 + $innxmit_nospace{$server}++;
5958 + return 1;
5959 + }
5960 + if ($left = /400 Bad file/o) {
5961 + $innxmit_crefused{$server}++;
5962 + return 1;
5963 + }
5964 + if ($left = /480 Transfer permission denied/o) {
5965 + $innxmit_crefused{$server}++;
5966 + return 1;
5967 + }
5968 + }
5969 + # stats (new format)
5970 + if ($left =~
5971 + /(\S+) stats offered (\d+) accepted (\d+) refused (\d+) rejected (\d+) missing (\d+) accsize (\d+) rejsize (\d+)$/o) {
5972 + my ($server, $offered, $accepted, $refused, $rejected, $missing, $accbytes, $rejbytes) =
5973 + ($1, $2, $3, $4, $5, $6, $7, $8);
5974 + $server = lc $server unless $CASE_SENSITIVE;
5975 + $innxmit_offered{$server} += $offered;
5976 + $innxmit_offered{$server} -= $innxmit_ihfail{$server}
5977 + if ($innxmit_ihfail{$server});
5978 + $innxmit_accepted{$server} += $accepted;
5979 + $innxmit_refused{$server} += $refused;
5980 + $innxmit_rejected{$server} += $rejected;
5981 + $innxmit_missing{$server} += $missing;
5982 + $innxmit_accepted_size{$server} += $accbytes;
5983 + $innxmit_rejected_size{$server} += $rejbytes;
5984 + $innxmit_site{$server}++;
5985 + $innxmit_ihfail{$server} = 0;
5986 + return 1;
5987 + }
5988 + # stats
5989 + if ($left =~
5990 + /(\S+) stats offered (\d+) accepted (\d+) refused (\d+) rejected (\d+)$/o) {
5991 + my ($server, $offered, $accepted, $refused, $rejected) =
5992 + ($1, $2, $3, $4, $5);
5993 + $server = lc $server unless $CASE_SENSITIVE;
5994 + $innxmit_offered{$server} += $offered;
5995 + $innxmit_offered{$server} -= $innxmit_ihfail{$server}
5996 + if ($innxmit_ihfail{$server});
5997 + $innxmit_accepted{$server} += $accepted;
5998 + $innxmit_refused{$server} += $refused;
5999 + $innxmit_rejected{$server} += $rejected;
6000 + $innxmit_site{$server}++;
6001 + $innxmit_ihfail{$server} = 0;
6002 + return 1;
6003 + }
6004 + # times
6005 + if ($left =~ /(\S+) times user (\S+) system (\S+) elapsed (\S+)$/o) {
6006 + my ($server, $user, $system, $elapsed) = ($1, $2, $3, $4);
6007 + $server = lc $server unless $CASE_SENSITIVE;
6008 + $innxmit_times{$server} += $elapsed;
6009 + return 1;
6010 + }
6011 + # connect & no space
6012 + if ($left =~ /(\S+) connect \S+ 400 No space/o) {
6013 + my $server = $1;
6014 + $server = lc $server unless $CASE_SENSITIVE;
6015 + $innxmit_nospace{$server}++;
6016 + $innxmit_site{$server}++;
6017 + return 1;
6018 + }
6019 + # connect & NNTP no space
6020 + if ($left =~ /(\S+) connect \S+ 400 \S+ out of space/o) {
6021 + my $server = $1;
6022 + $server = lc $server unless $CASE_SENSITIVE;
6023 + $innxmit_nospace{$server}++;
6024 + $innxmit_site{$server}++;
6025 + return 1;
6026 + }
6027 + # connect & loadav
6028 + if ($left =~ /(\S+) connect \S+ 400 loadav/o) {
6029 + my $server = $1;
6030 + if ($left =~ /expir/i) {
6031 + $server = lc $server unless $CASE_SENSITIVE;
6032 + $innxmit_expire{$server}++;
6033 + $innxmit_site{$server}++;
6034 + return 1;
6035 + }
6036 + }
6037 + # connect 400 (other)
6038 + if ($left =~ /(\S+) connect \S+ 400/o) {
6039 + my $server = $1;
6040 + $server = lc $server unless $CASE_SENSITIVE;
6041 + $innxmit_crefused{$server}++;
6042 + $innxmit_site{$server}++;
6043 + return 1;
6044 + }
6045 + # connect failed
6046 + if ($left =~ /(\S+) connect failed/o) {
6047 + my $server = $1;
6048 + $server = lc $server unless $CASE_SENSITIVE;
6049 + $innxmit_cfail_host{$server}++;
6050 + $innxmit_site{$server}++;
6051 + return 1;
6052 + }
6053 + # authenticate failed
6054 + if ($left =~ /(\S+) authenticate failed/o) {
6055 + my $server = $1;
6056 + $server = lc $server unless $CASE_SENSITIVE;
6057 + $innxmit_afail_host{$server}++;
6058 + $innxmit_site{$server}++;
6059 + return 1;
6060 + }
6061 + # xxx ihave failed 400 loadav [innwatch:hiload] yyy gt zzz
6062 + if ($left =~ /^(\S+) ihave failed 400 loadav/o) {
6063 + my $server = $1;
6064 + $server = lc $server unless $CASE_SENSITIVE;
6065 + $innxmit_hiload{$server}++;
6066 + return 1;
6067 + }
6068 + # ihave failed
6069 + return 1 if ($left =~ /\S+ ihave failed/o);
6070 + # requeued (....) 436 No space
6071 + return 1 if ($left =~ /\S+ requeued \S+ 436 No space/o);
6072 + # requeued (....) 400 No space
6073 + return 1 if ($left =~ /\S+ requeued \S+ 400 No space/o);
6074 + # requeued (....) 436 Can't write history
6075 + return 1 if ($left =~ /\S+ requeued \S+ 436 Can\'t write history/o);
6076 + # unexpected response code
6077 + return 1 if ($left =~ /unexpected response code /o);
6078 + }
6079 +
6080 + ########
6081 + ## nntplink
6082 + if ($prog eq "nntplink") {
6083 + $left =~ s/^(\S+):/$1/;
6084 + # EOF
6085 + if ($left =~ /(\S+) EOF /o) {
6086 + my $server = $1;
6087 + $server = lc $server unless $CASE_SENSITIVE;
6088 + $nntplink_site{$server}++;
6089 + $nntplink_eof{$server}++;
6090 + return 1;
6091 + }
6092 + # Broken pipe
6093 + if ($left =~ /(\S+) Broken pipe$/o) {
6094 + my $server = $1;
6095 + $server = lc $server unless $CASE_SENSITIVE;
6096 + $nntplink_site{$server}++;
6097 + $nntplink_bpipe{$server}++;
6098 + return 1;
6099 + }
6100 + # already running - won't die
6101 + return 1 if $left =~ /\S+ nntplink.* already running /o;
6102 + # connection timed out
6103 + if ($left =~ /(\S+) connection timed out/o) {
6104 + my $server = $1;
6105 + $server = lc $server unless $CASE_SENSITIVE;
6106 + $nntplink_site{$server}++;
6107 + $nntplink_bpipe{$server}++;
6108 + return 1;
6109 + }
6110 + # greeted us with 400 No space
6111 + if ($left =~ /(\S+) greeted us with 400 No space/o) {
6112 + my $server = $1;
6113 + $server = lc $server unless $CASE_SENSITIVE;
6114 + $nntplink_site{$server}++;
6115 + $nntplink_nospace{$server}++;
6116 + return 1;
6117 + }
6118 + # greeted us with 400 loadav
6119 + if ($left =~ /(\S+) greeted us with 400 loadav/o) {
6120 + my $server = $1;
6121 + $server = lc $server unless $CASE_SENSITIVE;
6122 + $nntplink_site{$server}++;
6123 + $nntplink_hiload{$server}++;
6124 + return 1;
6125 + }
6126 + # greeted us with 400 (other)
6127 + if ($left =~ /(\S+) greeted us with 400/o) {
6128 + my $server = $1;
6129 + $server = lc $server unless $CASE_SENSITIVE;
6130 + $nntplink_site{$server}++;
6131 + if ($left =~ /expir/i) {
6132 + $nntplink_expire{$server}++;
6133 + } else {
6134 + $nntplink_fail{$server}++;
6135 + }
6136 + return 1;
6137 + }
6138 + # greeted us with 502
6139 + if ($left =~ /(\S+) greeted us with 502/o) {
6140 + my $server = $1;
6141 + $server = lc $server unless $CASE_SENSITIVE;
6142 + $nntplink_site{$server}++;
6143 + $nntplink_auth{$server}++;
6144 + return 1;
6145 + }
6146 + # sent authinfo
6147 + if ($left =~ /(\S+) sent authinfo/o) {
6148 + my $server = $1;
6149 + $server = lc $server unless $CASE_SENSITIVE;
6150 + $nntplink_site{$server}++;
6151 + $nntplink_auth{$server}++;
6152 + return 1;
6153 + }
6154 + # socket()
6155 + if ($left =~ /(\S+) socket\(\): /o) {
6156 + my $server = $1;
6157 + $server = lc $server unless $CASE_SENSITIVE;
6158 + $nntplink_site{$server}++;
6159 + $nntplink_sockerr{$server}++;
6160 + return 1;
6161 + }
6162 + # select()
6163 + if ($left =~ /(\S+) select\(\) /o) {
6164 + my $server = $1;
6165 + $server = lc $server unless $CASE_SENSITIVE;
6166 + $nntplink_site{$server}++;
6167 + $nntplink_selecterr{$server}++;
6168 + return 1;
6169 + }
6170 + # sent IHAVE
6171 + if ($left =~ /(\S+) sent IHAVE/o) {
6172 + my $server = $1;
6173 + $server = lc $server unless $CASE_SENSITIVE;
6174 + $nntplink_ihfail{$server}++;
6175 + if (($left =~ / 436 /) && ($left =~ / out of space /)) {
6176 + $nntplink_fake_connects{$server}++;
6177 + $nntplink_nospace{$server}++;
6178 + }
6179 + return 1;
6180 + }
6181 + # article .... failed(saved): 436 No space
6182 + if ($left =~ /(\S+) .* failed\(saved\): 436 No space$/o) {
6183 + my $server = $1;
6184 + $server = lc $server unless $CASE_SENSITIVE;
6185 + $nntplink_nospace{$server}++;
6186 + return 1;
6187 + }
6188 + # article .. 400 No space left on device writing article file -- throttling
6189 + if ($left =~ /(\S+) .* 400 No space left on device writing article file -- throttling$/o) {
6190 + my $server = $1;
6191 + $server = lc $server unless $CASE_SENSITIVE;
6192 + $nntplink_nospace{$server}++;
6193 + return 1;
6194 + }
6195 + # stats
6196 + if ($left =~ /(\S+) stats (\d+) offered (\d+) accepted (\d+) rejected (\d+) failed (\d+) connects$/o) {
6197 + my ($server, $offered, $accepted, $rejected, $failed, $connects) =
6198 + ($1, $2, $3, $4, $5, $6);
6199 + $server = lc $server unless $CASE_SENSITIVE;
6200 + $nntplink_offered{$server} += $offered - $nntplink_ihfail{$server}++;
6201 + $nntplink_accepted{$server} += $accepted;
6202 + $nntplink_rejected{$server} += $rejected;
6203 + $nntplink_failed{$server} += $failed;
6204 + $nntplink_connects{$server} += $connects;
6205 + $nntplink_ihfail{$server} = 0;
6206 + if ($nntplink_fake_connects{$server}) {
6207 + $nntplink_site{$server} += $nntplink_fake_connects{$server};
6208 + $nntplink_fake_connects{$server} = 0;
6209 + } else {
6210 + $nntplink_site{$server}++;
6211 + }
6212 + return 1;
6213 + }
6214 + # xmit
6215 + if ($left =~ /(\S+) xmit user (\S+) system (\S+) elapsed (\S+)$/o) {
6216 + my ($server, $user, $system, $elapsed) = ($1, $2, $3, $4);
6217 + $server = lc $server unless $CASE_SENSITIVE;
6218 + $nntplink_times{$server} += $elapsed;
6219 + return 1;
6220 + }
6221 + # xfer
6222 + return 1 if $left =~ /\S+ xfer/o;
6223 + # Links down .. x hours
6224 + if ($left =~ /(\S+) Links* down \S+ \d+/o) {
6225 + # Collected but not used
6226 + # my $server = $1;
6227 + # $server = lc $server unless $CASE_SENSITIVE;
6228 + # $nntplink_down{$server} += $hours;
6229 + return 1;
6230 + }
6231 + # 503 Timeout
6232 + if ($left =~ /^(\S+) \S+ \S+ \S+ 503 Timeout/o) {
6233 + # Collected but not used
6234 + # my $server = $1;
6235 + # $server = lc $server unless $CASE_SENSITIVE;
6236 + # $nntplink_timeout{$server}++;
6237 + return 1;
6238 + }
6239 + # read() error while reading reply
6240 + if ($left =~ /^(\S+): read\(\) error while reading reply/o) {
6241 + my $server = $1;
6242 + $server = lc $server unless $CASE_SENSITIVE;
6243 + $nntplink_failed{$server}++;
6244 + return 1;
6245 + }
6246 + # Password file xxxx not found
6247 + return 1 if $left =~ /^\S+ Password file \S+ not found/;
6248 + # No such
6249 + return 1 if $left =~ /^\S+ \S+ \S+ No such/;
6250 + # already running
6251 + return 1 if $left =~ /^\S+ \S+ already running/;
6252 + # error reading version from datafile
6253 + return 1 if $left =~ /error reading version from datafile/;
6254 + }
6255 + ########
6256 + ## nnrpd
6257 + if ($prog eq "nnrpd")
6258 + {
6259 + # Fix a small bug of nnrpd (inn 1.4*)
6260 + $left =~ s/^ /\? /o;
6261 + # Another bug (in INN 1.5b1)
6262 + return 1 if $left =~ /^\020\002m$/o; # ^P^Bm
6263 + # bad_history at num for <ref>
6264 + return 1 if $left =~ /bad_history at \d+ for /o;
6265 + # timeout short
6266 + return 1 if $left =~ /\S+ timeout short$/o;
6267 + # < or > + (blablabla)
6268 + return 1 if $left =~ /^\S+ [\<\>] /o;
6269 + # cant opendir ... I/O error
6270 + return 1 if $left =~ /\S+ cant opendir \S+ I\/O error$/o;
6271 + # perl filtering enabled
6272 + return 1 if $left =~ /perl filtering enabled$/o;
6273 + # connect
6274 + if ($left =~ /(\S+) (\([0-9a-fA-F:.]*\) )?connect$/o) {
6275 + my $cust = $1;
6276 + $cust = lc $cust unless $CASE_SENSITIVE;
6277 + my $dom = &host2dom($cust);
6278 + $nnrpd_dom_connect{$dom}++;
6279 + $nnrpd_connect{$cust}++;
6280 + return 1;
6281 + }
6282 + # group
6283 + if ($left =~ /(\S+) group (\S+) (\d+)$/o) {
6284 + my ($cust, $group, $num) = ($1, $2, $3);
6285 + if ($num) {
6286 + $nnrpd_group{$group} += $num;
6287 + my ($hierarchy) = $group =~ /^([^\.]+).*$/o;
6288 + $nnrpd_hierarchy{$hierarchy} += $num;
6289 + }
6290 + return 1;
6291 + }
6292 + # post failed
6293 + if ($left =~ /(\S+) post failed (.*)$/o) {
6294 + my ($cust, $error) = ($1, $2);
6295 + $nnrpd_post_error{$error}++;
6296 + return 1;
6297 + }
6298 + # post ok
6299 + return 1 if $left =~ /\S+ post ok/o;
6300 + # posts
6301 + if ($left =~ /(\S+) posts received (\d+) rejected (\d+)$/o) {
6302 + my ($cust, $received, $rejected) = ($1, $2, $3);
6303 + $cust = lc $cust unless $CASE_SENSITIVE;
6304 + my $dom = &host2dom($cust);
6305 + $nnrpd_dom_post_ok{$dom} += $received;
6306 + $nnrpd_dom_post_rej{$dom} += $rejected;
6307 + $nnrpd_post_ok{$cust} += $received;
6308 + $nnrpd_post_rej{$cust} += $rejected;
6309 + return 1;
6310 + }
6311 + # noperm post without permission
6312 + if ($left =~ /(\S+) noperm post without permission/o) {
6313 + my $cust = $1;
6314 + $cust = lc $cust unless $CASE_SENSITIVE;
6315 + my $dom = &host2dom($cust);
6316 + $nnrpd_dom_post_rej{$dom} ++;
6317 + $nnrpd_post_rej{$cust} ++;
6318 + return 1;
6319 + }
6320 + # no_permission
6321 + if ($left =~ /(\S+) no_(permission|access)$/o) {
6322 + my $cust = $1;
6323 + $cust = lc $cust unless $CASE_SENSITIVE;
6324 + my $dom = &host2dom($cust);
6325 + $nnrpd_no_permission{$cust}++;
6326 + $nnrpd_dom_no_permission{$dom}++;
6327 + return 1;
6328 + }
6329 + # bad_auth
6330 + if ($left =~ /(\S+) bad_auth$/o) {
6331 + my $cust = $1;
6332 + $cust = lc $cust unless $CASE_SENSITIVE;
6333 + my $dom = &host2dom($cust);
6334 + $nnrpd_dom_no_permission{$dom}++;
6335 + $nnrpd_no_permission{$cust}++;
6336 + return 1;
6337 + }
6338 + # authinfo
6339 + if ($left =~ /\S+ user (\S+)$/o) {
6340 + my $user = $1;
6341 + $nnrpd_auth{$user}++;
6342 + return 1;
6343 + }
6344 + # unrecognized + command
6345 + if ($left =~ /(\S+) unrecognized (.*)$/o) {
6346 + my ($cust, $error) = ($1, $2);
6347 + $cust = lc $cust unless $CASE_SENSITIVE;
6348 + my $dom = &host2dom($cust);
6349 + $error = "_null command_" if ($error !~ /\S/);
6350 + $error =~ s/^(xmotd) .*$/$1/i if ($error =~ /^xmotd .*$/i);
6351 + $nnrpd_dom_unrecognized{$dom}++;
6352 + $nnrpd_unrecognized{$cust}++;
6353 + $nnrpd_unrecogn_cmd{$error}++;
6354 + return 1;
6355 + }
6356 + # exit
6357 + if ($left =~ /(\S+) exit articles (\d+) groups (\d+)$/o) {
6358 + my ($cust, $articles, $groups) = ($1, $2, $3);
6359 + $cust = lc $cust unless $CASE_SENSITIVE;
6360 + my $dom = &host2dom($cust) || '?';
6361 + $nnrpd_connect{$cust}++, $nnrpd_dom_connect{$dom}++ if $cust eq '?';
6362 + $nnrpd_groups{$cust} += $groups;
6363 + $nnrpd_dom_groups{$dom} += $groups;
6364 + $nnrpd_articles{$cust} += $articles;
6365 + $nnrpd_dom_articles{$dom} += $articles;
6366 + return 1;
6367 + }
6368 + # times
6369 + if ($left =~ /(\S+) times user (\S+) system (\S+) idle (\S+) elapsed (\S+)$/o) {
6370 + my ($cust, $user, $system, $idle, $elapsed) = ($1, $2, $3, $4, $5);
6371 + $cust = lc $cust unless $CASE_SENSITIVE;
6372 + my $dom = &host2dom($cust);
6373 + $nnrpd_times{$cust} += $elapsed;
6374 + $nnrpd_resource_user{$cust} += $user;
6375 + $nnrpd_resource_system{$cust} += $system;
6376 + $nnrpd_resource_idle{$cust} += $idle;
6377 + $nnrpd_resource_elapsed{$cust} += $elapsed;
6378 + $nnrpd_dom_times{$dom} += $elapsed;
6379 + return 1;
6380 + }
6381 + # artstats
6382 + if ($left =~ /(\S+) artstats get (\d+) time (\d+) size (\d+)$/o) {
6383 + my ($cust, $articles, $time, $bytes) = ($1, $2, $3, $4);
6384 + $cust = lc $cust unless $CASE_SENSITIVE;
6385 + my $dom = &host2dom($cust);
6386 + $nnrpd_bytes{$cust} += $bytes;
6387 + $nnrpd_dom_bytes{$dom} += $bytes;
6388 + return 1;
6389 + }
6390 + # timeout
6391 + if ($left =~ /(\S+) timeout$/o) {
6392 + my $cust = $1;
6393 + $cust = lc $cust unless $CASE_SENSITIVE;
6394 + my $dom = &host2dom($cust);
6395 + $nnrpd_dom_timeout{$dom}++;
6396 + $nnrpd_timeout{$cust}++;
6397 + return 1;
6398 + }
6399 + # timeout in post
6400 + if ($left =~ /(\S+) timeout in post$/o) {
6401 + my $cust = $1;
6402 + $cust = lc $cust unless $CASE_SENSITIVE;
6403 + my $dom = &host2dom($cust);
6404 + $nnrpd_dom_timeout{$dom}++;
6405 + $nnrpd_timeout{$cust}++;
6406 + return 1;
6407 + }
6408 + # cant read Connection timed out
6409 + if ($left =~ /(\S+) cant read Connection timed out$/o) {
6410 + my $cust = $1;
6411 + $cust = lc $cust unless $CASE_SENSITIVE;
6412 + my $dom = &host2dom($cust);
6413 + $nnrpd_dom_timeout{$dom}++;
6414 + $nnrpd_timeout{$cust}++;
6415 + return 1;
6416 + }
6417 + # cant read Operation timed out
6418 + if ($left =~ /(\S+) cant read Operation timed out$/o) {
6419 + my $cust = $1;
6420 + $cust = lc $cust unless $CASE_SENSITIVE;
6421 + my $dom = &host2dom($cust);
6422 + $nnrpd_dom_timeout{$dom}++;
6423 + $nnrpd_timeout{$cust}++;
6424 + return 1;
6425 + }
6426 + # cant read Connection reset by peer
6427 + if ($left =~ /(\S+) cant read Connection reset by peer$/o) {
6428 + my $cust = $1;
6429 + $cust = lc $cust unless $CASE_SENSITIVE;
6430 + my $dom = &host2dom($cust);
6431 + $nnrpd_dom_reset_peer{$dom}++;
6432 + $nnrpd_reset_peer{$cust}++;
6433 + return 1;
6434 + }
6435 + # gethostbyaddr: xxx.yyy.zzz != a.b.c.d
6436 + if ($left =~ /^gethostbyaddr: (.*)$/o) {
6437 + my $msg = $1;
6438 + $nnrpd_gethostbyaddr{$msg}++;
6439 + return 1;
6440 + }
6441 + # cant gethostbyaddr
6442 + if ($left =~ /\? cant gethostbyaddr (\S+) .*$/o) {
6443 + my $ip = $1;
6444 + $nnrpd_gethostbyaddr{$ip}++;
6445 + return 1;
6446 + }
6447 + # cant getpeername
6448 + if ($left =~ /\? cant getpeername/o) {
6449 + # $nnrpd_getpeername++;
6450 + $nnrpd_gethostbyaddr{"? (can't getpeername)"}++;
6451 + return 1;
6452 + }
6453 + # profile timer
6454 + # ME time X nnnn X(X) [...]
6455 + # The exact timers change from various versions of INN, so try to deal
6456 + # with this in a general fashion.
6457 + if ($left =~ m/^\S+\s+ # ME
6458 + time\ (\d+)\s+ # time
6459 + ((?:\S+\ \d+\(\d+\)\s*)+) # timer values
6460 + $/ox) {
6461 + $nnrpd_time_times += $1;
6462 + my $timers = $2;
6463 +
6464 + while ($timers =~ /(\S+) (\d+)\((\d+)\)\s*/g) {
6465 + my $name = $nnrpd_timer_names{$1} || $1;
6466 + my $average = $2 / ($3 || 1);
6467 + $nnrpd_time_time{$name} += $2;
6468 + $nnrpd_time_num{$name} += $3;
6469 + $nnrpd_time_min{$name} = $average
6470 + if ($3 && $nnrpd_time_min{$name} > $average);
6471 + $nnrpd_time_max{$name} = $average
6472 + if ($3 && $nnrpd_time_max{$name} < $average);
6473 + }
6474 + return 1;
6475 + }
6476 + # ME dropping articles into ...
6477 + return 1 if $left = ~/ME dropping articles into /o;
6478 + # newnews (interesting but ignored till now)
6479 + return 1 if $left =~ /^\S+ newnews /o;
6480 + # cant fopen (ignored too)
6481 + return 1 if $left =~ /^\S+ cant fopen /o;
6482 + # cant read No route to host
6483 + return 1 if $left =~ /cant read No route to host/o;
6484 + # cant read Broken pipe
6485 + return 1 if $left =~ /cant read Broken pipe/o;
6486 + # ioctl: ...
6487 + return 1 if $left =~ /^ioctl: /o;
6488 + }
6489 + ########
6490 + ## inndstart
6491 + if ($prog eq "inndstart") {
6492 + # cant bind Address already in use
6493 + # cant bind Permission denied
6494 + return 1 if $left =~ /cant bind /o;
6495 + # cant setgroups Operation not permitted
6496 + return 1 if $left =~ /cant setgroups /o;
6497 + }
6498 + ########
6499 + ## overchan
6500 + if ($prog eq "overchan") {
6501 + # times
6502 + if ($left =~ /timings (\d+) arts (\d+) of (\d+) ms$/o) {
6503 + my ($articles, $work_time, $run_time) = ($1, $2, $3);
6504 + # ??? What to do with numbers
6505 + return 1;
6506 + }
6507 + }
6508 + ########
6509 + ## batcher
6510 + if ($prog eq "batcher") {
6511 + # times
6512 + if ($left =~ /(\S+) times user (\S+) system (\S+) elapsed (\S+)$/o) {
6513 + my ($server, $user, $system, $elapsed) = ($1, $2, $3, $4);
6514 + $server = lc $server unless $CASE_SENSITIVE;
6515 + # $batcher_user{$server} += $user;
6516 + # $batcher_system{$server} += $system;
6517 + $batcher_elapsed{$server} += $elapsed;
6518 + return 1;
6519 + }
6520 + # stats
6521 + if ($left =~ /(\S+) stats batches (\d+) articles (\d+) bytes (\d+)$/o) {
6522 + my ($server, $batches, $articles, $bytes) = ($1, $2, $3, $4);
6523 + $server = lc $server unless $CASE_SENSITIVE;
6524 + $batcher_offered{$server} += $batches;
6525 + $batcher_articles{$server} += $articles;
6526 + $batcher_bytes{$server} += $bytes;
6527 + return 1;
6528 + }
6529 + }
6530 + ########
6531 + ## rnews
6532 + if ($prog eq "rnews") {
6533 + # rejected connection
6534 + if ($left =~ /rejected connection (.*)$/o) {
6535 + $rnews_rejected{$1}++;
6536 + return 1;
6537 + }
6538 + # cant open_remote
6539 + if ($left =~ /(cant open_remote .*)$/o) {
6540 + $rnews_rejected{$1}++;
6541 + return 1;
6542 + }
6543 + # rejected 437 Unwanted newsgroup
6544 + if ($left =~ /rejected 437 Unwanted newsgroup \"(.*)\"$/o) {
6545 + $rnews_bogus_ng{$1}++;
6546 + return 1;
6547 + }
6548 + # rejected 437 Unapproved for "xx"
6549 + if ($left =~ /rejected 437 Unapproved for \"(.*)\"$/o) {
6550 + $rnews_unapproved{$1}++;
6551 + return 1;
6552 + }
6553 + # rejected 437 Unwanted distribution
6554 + if ($left =~ /rejected 437 Unwanted distribution (.*)$/o) {
6555 + $rnews_bogus_dist{$1}++;
6556 + return 1;
6557 + }
6558 + # rejected 437 Bad "Date"
6559 + if ($left =~ /rejected 437 Bad \"Date\" (.*)$/o) {
6560 + $rnews_bogus_date{$1}++;
6561 + return 1;
6562 + }
6563 + # rejected 437 Article posted in the future
6564 + if ($left =~ /rejected 437 Article posted in the future -- \"(.*)\"$/o) {
6565 + $rnews_bogus_date{"(future) $1"}++;
6566 + return 1;
6567 + }
6568 + # rejected 437 Too old -- "..."
6569 + if ($left =~ /rejected 437 Too old -- (.*)$/o) {
6570 + $rnews_too_old++;
6571 + return 1;
6572 + }
6573 + # rejected 437 Linecount...
6574 + if ($left =~ /rejected 437 (Linecount) \d+ \!= \d+/o) {
6575 + $rnews_linecount++;
6576 + return 1;
6577 + }
6578 + # rejected 437 Duplicate
6579 + if ($left =~ /rejected 437 Duplicate$/o) {
6580 + $rnews_duplicate++;
6581 + return 1;
6582 + }
6583 + # rejected 437 Duplicate article
6584 + if ($left =~ /rejected 437 (Duplicate article)/o) {
6585 + $rnews_duplicate++;
6586 + return 1;
6587 + }
6588 + # rejected 437 No colon-space ...
6589 + if ($left =~ /rejected 437 No colon-space in \"(.*)\" header$/o) {
6590 + $rnews_no_colon_space++;
6591 + return 1;
6592 + }
6593 + # duplicate <msg-id> path..
6594 + if ($left =~ /^duplicate /o) {
6595 + $rnews_duplicate++;
6596 + return 1;
6597 + }
6598 + # offered <msg-id> feed
6599 + if ($left =~ /^offered \S+ (\S+)/o) {
6600 + my $host = $1;
6601 + $host = lc $host unless $CASE_SENSITIVE;
6602 + # Small hack used to join article spooled when innd is throttle.
6603 + # In this situation, the hostname is a 8 hex digits string
6604 + # To avoid confusions with real feeds, the first character is forced
6605 + # to be a '3' or a '4' (will work between 9/7/1995 and 13/7/2012).
6606 + $host = "Local postings" if $host =~ /^[34][0-9a-f]{7}$/;
6607 + $rnews_host{$host}++;
6608 + return 1;
6609 + }
6610 + # rejected 437 ECP rejected
6611 + return 1 if $left =~ m/rejected 437 ECP rejected/o;
6612 + # rejected 437 "Subject" header too long
6613 + return 1 if $left =~ m/header too long/o;
6614 + # bad_article missing Message-ID
6615 + return 1 if $left =~ m/bad_article missing Message-ID/o;
6616 + # cant unspool saving to xxx
6617 + return 1 if $left =~ m/cant unspool saving to/o;
6618 + }
6619 +
6620 + ###########
6621 + ## ncmspool
6622 + if ($prog eq "ncmspool") {
6623 + # <article> good signature from [email protected]
6624 + if ($left =~ /good signature from (.*)/o) {
6625 + $nocem_goodsigs{$1}++;
6626 + $nocem_totalgood++;
6627 + $nocem_lastid = $1;
6628 + return 1;
6629 + }
6630 + # <article> bad signature from [email protected]
6631 + if ($left =~ /bad signature from (.*)/o) {
6632 + $nocem_badsigs{$1}++;
6633 + $nocem_goodsigs{$1} = 0 unless ($nocem_goodsigs{$1});
6634 + $nocem_totalbad++;
6635 + $nocem_lastid = $1;
6636 + return 1;
6637 + }
6638 + # <article> contained 123 new 456 total ids
6639 + if ($left =~ /contained (\d+) new (\d+) total ids/o) {
6640 + $nocem_newids += $1;
6641 + $nocem_newids{$nocem_lastid} += $1;
6642 + $nocem_totalids += $2;
6643 + $nocem_totalids{$nocem_lastid} += $2;
6644 + return 1;
6645 + }
6646 + return 1;
6647 + }
6648 +
6649 + ###########
6650 + ## controlchan
6651 + if ($prog eq "controlchan") {
6652 + # loaded /x/y/z/foo.pl
6653 + return 1 if $left =~ m/^loaded /;
6654 + # starting
6655 + return 1 if $left =~ m/^starting/;
6656 + # skipping rmgroup x@y (pgpverify failed) in <foo@bar>
6657 + if ($left =~ m/^skipping \S+ (\S+) \(pgpverify failed\) in /) {
6658 + $controlchan_skippgp{$1}++;
6659 + $controlchan_who{$1}++;
6660 + return 1;
6661 + }
6662 + if ($left =~ m/^control_(sendme|ihave), [^,]+, (\S+), doit,/o) {
6663 + if ($1 eq "sendme") {
6664 + $controlchan_sendme_site{$2}++;
6665 + } else {
6666 + $controlchan_ihave_site{$2}++;
6667 + }
6668 + return 1;
6669 + }
6670 + # control_XXgroup, foo.bar [moderated] who who /x/y/12, peer, action, 1
6671 + #
6672 + # Various other random junk can end up in the moderated field, like y,
6673 + # unmoderated, m, etc. depending on what the control message says. It
6674 + # can even have multiple words, which we still don't handle.
6675 + if ($left =~ m/^control_(\S+), # type of msg
6676 + \s(?:\S+)? # newsgroup name
6677 + (\s\S+)? # optional
6678 + \s(\S+) # email
6679 + \s\S+ # email
6680 + \s\S+, # filename
6681 + \s\S+, # server
6682 + \s([^=,]+(?:=\S+)?), # action
6683 + \s*(.*) # code
6684 + /x) {
6685 + if ($1 eq 'newgroup') {
6686 + $controlchan_new{$3}++;
6687 + } elsif ($1 eq 'rmgroup') {
6688 + $controlchan_rm{$3}++;
6689 + } else {
6690 + $controlchan_other{$3}++;
6691 + }
6692 + $controlchan_who{$3}++;
6693 + $controlchan_ok{$3} += $5;
6694 + my $action = $4;
6695 + my $email = $3;
6696 + $action =~ s/=.*//;
6697 + $controlchan_doit{$email}++ if $action eq 'doit';
6698 + return 1;
6699 + }
6700 + }
6701 +
6702 + ###########
6703 + ## crosspost
6704 + if ($prog eq "crosspost") {
6705 + # seconds 1001 links 3182 0 symlinks 0 0 mkdirs 0 0
6706 + # missing 13 toolong 0 other 0
6707 + if ($left =~ /^seconds\ (\d+)
6708 + \ links\ (\d+)\ (\d+)
6709 + \ symlinks\ (\d+)\ (\d+)
6710 + \ mkdirs\ (\d+)\ (\d+)
6711 + \ missing\ (\d+)
6712 + \ toolong\ (\d+)
6713 + \ other\ (\d+)
6714 + $/ox) {
6715 + $crosspost_time += $1;
6716 + $crosspost{'Links made'} += $2;
6717 + $crosspost{'Links failed'} += $3;
6718 + $crosspost{'Symlinks made'} += $4;
6719 + $crosspost{'Symlinks failed'} += $5;
6720 + $crosspost{'Mkdirs made'} += $6;
6721 + $crosspost{'Mkdirs failed'} += $7;
6722 + $crosspost{'Files missing'} += $8;
6723 + $crosspost{'Paths too long'} += $9;
6724 + $crosspost{'Others'} += $10;
6725 + return 1;
6726 + }
6727 + }
6728 +
6729 + ###########
6730 + ## cnfsstat
6731 + if ($prog eq "cnfsstat") {
6732 + # Class ALT for groups matching "alt.*" article size min/max: 0/1048576
6733 + # Buffer T3, len: 1953 Mbytes, used: 483.75 Mbytes (24.8%) 0 cycles
6734 + if ($left =~ m|^Class\ (\S+)\ for\ groups\ matching\ \S+
6735 + (\ article\ size\ min/max:\ \d+/\d+)?
6736 + \ Buffer\ (\S+),
6737 + \ len:\ (\d+)\s+Mbytes,
6738 + \ used:\ ([\d.]+)\ Mbytes\ \(\s*[\d.]+%\)
6739 + \s+(\d+)\ cycles\s*
6740 + $|ox) {
6741 + my ($class, $buffer, $size, $used, $cycles) = ($1, $3, $4, $5, $6);
6742 + my ($h, $m, $s) = $hour =~ m/^(\d+):(\d+):(\d+)$/;
6743 + my $time = $h * 3600 + $m * 60 + $s;
6744 + $size *= 1024 * 1024;
6745 + $used *= 1024 * 1024;
6746 + $cnfsstat{$buffer} = $class;
6747 +
6748 + # If the size changed, invalidate all of our running fill rate stats.
6749 + if ($size != $cnfsstat_size{$buffer}) {
6750 + delete $cnfsstat_rate{$buffer};
6751 + delete $cnfsstat_samples{$buffer};
6752 + delete $cnfsstat_time{$buffer};
6753 + $cnfsstat_size{$buffer} = $size;
6754 + }
6755 + elsif ($cnfsstat_time{$buffer}) {
6756 + # We want to gather the rate at which cycbuffs fill. Store a
6757 + # running total of bytes/second and a total number of samples.
6758 + # Ideally we'd want a weighted average of those samples by the
6759 + # length of the sample period, but we'll ignore that and assume
6760 + # cnfsstat runs at a roughly consistent interval.
6761 + my ($period, $added);
6762 + $period = $time - $cnfsstat_time{$buffer};
6763 + $period = 86400 - $cnfsstat_time{$buffer} + $time if $period <= 0;
6764 + $added = $used - $cnfsstat_used{$buffer};
6765 + if ($cycles > $cnfsstat_cycles{$buffer}) {
6766 + $added += $size * ($cycles - $cnfsstat_cycles{$buffer});
6767 + }
6768 + if ($added > 0) {
6769 + $cnfsstat_rate{$buffer} += $added / $period;
6770 + $cnfsstat_samples{$buffer}++;
6771 + }
6772 + }
6773 + $cnfsstat_used{$buffer} = $used;
6774 + $cnfsstat_cycles{$buffer} = $cycles;
6775 + $cnfsstat_time{$buffer} = $time;
6776 + return 1;
6777 + }
6778 + }
6779 +
6780 + # Ignore following programs :
6781 + return 1 if ($prog eq "uxfxn");
6782 + return 1 if ($prog eq "beverage");
6783 + return 1 if ($prog eq "newsx");
6784 + return 1 if ($prog eq "demmf");
6785 + return 1 if ($prog eq "nnnn");
6786 + return 1 if ($prog eq "slurp");
6787 + return 0;
6788 +}
6789 +
6790 +#################################
6791 +# Adjust some values..
6792 +
6793 +sub adjust {
6794 + my ($first_date, $last_date) = @_;
6795 +
6796 + my $nnrpd_doit = 0;
6797 + my $curious;
6798 +
6799 + {
6800 + my $serv;
6801 + if (%nnrpd_connect) {
6802 + my $c = keys (%nnrpd_connect);
6803 + foreach $serv (keys (%nnrpd_connect)) {
6804 + my $dom = &host2dom($serv);
6805 + if ($nnrpd_no_permission{$serv}) {
6806 + $nnrpd_dom_connect{$dom} -= $nnrpd_connect{$serv}
6807 + if defined $nnrpd_dom_connect{$dom};
6808 + $nnrpd_dom_groups{$dom} -= $nnrpd_groups{$serv}
6809 + if defined $nnrpd_dom_groups{$dom};
6810 + $nnrpd_dom_times{$dom} -= $nnrpd_times{$serv}
6811 + if defined $nnrpd_dom_times{$dom};
6812 + $nnrpd_connect{$serv} -= $nnrpd_no_permission{$serv};
6813 + $nnrpd_groups{$serv} -= $nnrpd_no_permission{$serv}
6814 + if defined $nnrpd_groups{$serv};
6815 + delete $nnrpd_connect{$serv} unless $nnrpd_connect{$serv};
6816 + delete $nnrpd_groups{$serv} unless $nnrpd_groups{$serv};
6817 + delete $nnrpd_times{$serv} unless $nnrpd_times{$serv};
6818 + delete $nnrpd_usr_times{$serv} unless $nnrpd_usr_times{$serv};
6819 + delete $nnrpd_sys_times{$serv} unless $nnrpd_sys_times{$serv};
6820 + delete $nnrpd_dom_connect{$dom} unless $nnrpd_dom_connect{$dom};
6821 + delete $nnrpd_dom_groups{$dom} unless $nnrpd_dom_groups{$dom};
6822 + delete $nnrpd_dom_times{$dom} unless $nnrpd_dom_times{$dom};
6823 + $c--;
6824 + }
6825 + $nnrpd_doit++
6826 + if $nnrpd_groups{$serv} || $nnrpd_post_ok{$serv};
6827 + }
6828 + undef %nnrpd_connect unless $c;
6829 + }
6830 + foreach $serv (keys (%nnrpd_groups)) {
6831 + $curious = "ok" unless $nnrpd_groups{$serv} || $nnrpd_post_ok{$serv} ||
6832 + $nnrpd_articles{$serv};
6833 + }
6834 + }
6835 +
6836 + # Fill some hashes
6837 + {
6838 + my $key;
6839 + foreach $key (keys (%innd_connect)) {
6840 + $innd_offered{$key} = ($innd_accepted{$key} || 0)
6841 + + ($innd_refused{$key} || 0)
6842 + + ($innd_rejected{$key} || 0);
6843 + $innd_offered_size{$key} = ($innd_stored_size{$key} || 0)
6844 + + ($innd_duplicated_size{$key} || 0);
6845 + }
6846 +
6847 +
6848 + # adjust min/max of innd timer stats.
6849 + if (%innd_time_min) {
6850 + foreach $key (keys (%innd_time_min)) {
6851 + $innd_time_min{$key} = 0 if ($innd_time_min{$key} == $MIN);
6852 + $innd_time_max{$key} = 0 if ($innd_time_max{$key} == $MAX);
6853 +
6854 + #$innd_time_min{$key} /= 1000;
6855 + #$innd_time_max{$key} /= 1000;
6856 + }
6857 + }
6858 + if (%innfeed_time_min) {
6859 + foreach $key (keys (%innfeed_time_min)) {
6860 + $innfeed_time_min{$key} = 0 if ($innfeed_time_min{$key} == $MIN);
6861 + $innfeed_time_max{$key} = 0 if ($innfeed_time_max{$key} == $MAX);
6862 + }
6863 + }
6864 + if (%nnrpd_time_min) {
6865 + foreach $key (keys (%nnrpd_time_min)) {
6866 + $nnrpd_time_min{$key} = 0 if ($nnrpd_time_min{$key} == $MIN);
6867 + $nnrpd_time_max{$key} = 0 if ($nnrpd_time_max{$key} == $MAX);
6868 + }
6869 + }
6870 + # remove the innd timer stats if not used.
6871 + unless ($innd_time_times) {
6872 + undef %innd_time_min;
6873 + undef %innd_time_max;
6874 + undef %innd_time_num;
6875 + undef %innd_time_time;
6876 + }
6877 + # same thing for innfeed timer
6878 + unless ($innfeed_time_times) {
6879 + undef %innfeed_time_min;
6880 + undef %innfeed_time_max;
6881 + undef %innfeed_time_num;
6882 + undef %innfeed_time_time;
6883 + }
6884 + # same thing for nnrpd timer
6885 + unless ($nnrpd_time_times) {
6886 + undef %nnrpd_time_min;
6887 + undef %nnrpd_time_max;
6888 + undef %nnrpd_time_num;
6889 + undef %nnrpd_time_time;
6890 + }
6891 +
6892 + # adjust the crosspost stats.
6893 + if (%crosspost) {
6894 + foreach $key (keys (%crosspost)) {
6895 + $crosspost_times{$key} = $crosspost_time ?
6896 + sprintf "%.2f", $crosspost{$key} / $crosspost_time * 60 : "?";
6897 + }
6898 + }
6899 + }
6900 +
6901 + if (%inn_flow) {
6902 + my ($prev_dd, $prev_d, $prev_h) = ("", -1, -1);
6903 + my $day;
6904 + foreach $day (sort datecmp keys (%inn_flow)) {
6905 + my ($r, $h) = $day =~ /^(.*) (\d+)$/;
6906 + my $d = index ("JanFebMarAprMayJunJulAugSepOctNovDec",
6907 + substr ($r,0,3)) / 3 * 31 + substr ($r, 4, 2);
6908 + $prev_h = $h if ($prev_h == -1);
6909 + if ($prev_d == -1) {
6910 + $prev_d = $d;
6911 + $prev_dd = $r;
6912 + }
6913 + if ($r eq $prev_dd) { # Same day and same month ?
6914 + if ($h != $prev_h) {
6915 + if ($h == $prev_h + 1) {
6916 + $prev_h++;
6917 + }
6918 + else {
6919 + my $j;
6920 + for ($j = $prev_h + 1; $j < $h; $j++) {
6921 + my $t = sprintf "%02d", $j;
6922 + $inn_flow{"$r $t"} = 0;
6923 + }
6924 + $prev_h = $h;
6925 + }
6926 + }
6927 + }
6928 + else {
6929 + my $j;
6930 + # then end of the first day...
6931 + for ($j = ($prev_h == 23) ? 24 : $prev_h + 1; $j < 24; $j++) {
6932 + my $t = sprintf "%02d", $j;
6933 + $inn_flow{"$prev_dd $t"} = 0;
6934 + }
6935 +
6936 + # all the days between (if any)
6937 + # well, we can forget them as it is supposed to be a tool
6938 + # launched daily.
6939 +
6940 + # the beginning of the last day..
6941 + for ($j = 0; $j < $h; $j++) {
6942 + my $t = sprintf "%02d", $j;
6943 + $inn_flow{"$r $t"} = 0;
6944 + }
6945 + $prev_dd = $r;
6946 + $prev_d = $d;
6947 + $prev_h = $h;
6948 + }
6949 + }
6950 + my $first = 1;
6951 + my (%hash, %hash_time, %hash_size, $date, $delay);
6952 + foreach $day (sort datecmp keys (%inn_flow)) {
6953 + my ($r, $h) = $day =~ /^(.*) (\d+)$/o;
6954 + if ($first) {
6955 + $first = 0;
6956 + my ($t) = $first_date =~ m/:(\d\d:\d\d)$/o;
6957 + $date = "$day:$t - $h:59:59";
6958 + $t =~ m/(\d\d):(\d\d)/o;
6959 + $delay = 3600 - $1 * 60 - $2;
6960 + }
6961 + else {
6962 + $date = "$day:00:00 - $h:59:59";
6963 + $delay = 3600;
6964 + }
6965 + $hash{$date} = $inn_flow{$day};
6966 + $hash_size{$date} = $inn_flow_size{$day};
6967 + $inn_flow_labels{$date} = $h;
6968 + $hash_time{$date} = $delay;
6969 + }
6970 + my ($h, $t) = $last_date =~ m/ (\d+):(\d\d:\d\d)$/o;
6971 + my ($h2) = $date =~ m/ (\d+):\d\d:\d\d /o;
6972 + my $date2 = $date;
6973 + $date2 =~ s/$h2:59:59$/$h:$t/;
6974 + $hash{$date2} = $hash{$date};
6975 + delete $hash{"$date"};
6976 + $hash_size{$date2} = $hash_size{$date};
6977 + delete $hash_size{"$date"};
6978 + $t =~ m/(\d\d):(\d\d)/o;
6979 + $hash_time{$date2} = $hash_time{$date} - ($h2 == $h) * 3600 + $1 * 60 + $2;
6980 + delete $hash_time{"$date"};
6981 + $inn_flow_labels{$date2} = $h;
6982 + %inn_flow = %hash;
6983 + %inn_flow_time = %hash_time;
6984 + %inn_flow_size = %hash_size;
6985 + }
6986 +
6987 + if (%innd_bad_ihave) {
6988 + my $key;
6989 + my $msg = 'Bad ihave control messages received';
6990 + foreach $key (keys %innd_bad_ihave) {
6991 + $innd_misc_stat{$msg}{$key} = $innd_bad_ihave{$key};
6992 + }
6993 + }
6994 + if (%innd_bad_msgid) {
6995 + my $key;
6996 + my $msg = 'Bad Message-ID\'s offered';
6997 + foreach $key (keys %innd_bad_msgid) {
6998 + $innd_misc_stat{$msg}{$key} = $innd_bad_msgid{$key};
6999 + }
7000 + }
7001 + if (%innd_bad_sendme) {
7002 + my $key;
7003 + my $msg = 'Ignored sendme control messages received';
7004 + foreach $key (keys %innd_bad_sendme) {
7005 + $innd_misc_stat{$msg}{$key} = $innd_bad_sendme{$key};
7006 + }
7007 + }
7008 + if (%innd_bad_command) {
7009 + my $key;
7010 + my $msg = 'Bad command received';
7011 + foreach $key (keys %innd_bad_command) {
7012 + $innd_misc_stat{$msg}{$key} = $innd_bad_command{$key};
7013 + }
7014 + }
7015 + if (%innd_bad_newsgroup) {
7016 + my $key;
7017 + my $msg = 'Bad newsgroups received';
7018 + foreach $key (keys %innd_bad_newsgroup) {
7019 + $innd_misc_stat{$msg}{$key} = $innd_bad_newsgroup{$key};
7020 + }
7021 + }
7022 + if (%innd_posted_future) {
7023 + my $key;
7024 + my $msg = 'Article posted in the future';
7025 + foreach $key (keys %innd_posted_future) {
7026 + $innd_misc_stat{$msg}{$key} = $innd_posted_future{$key};
7027 + }
7028 + }
7029 + if (%innd_no_colon_space) {
7030 + my $key;
7031 + my $msg = 'No colon-space in header';
7032 + foreach $key (keys %innd_no_colon_space) {
7033 + $innd_misc_stat{$msg}{$key} = $innd_no_colon_space{$key};
7034 + }
7035 + }
7036 + if (%innd_huge) {
7037 + my $key;
7038 + my $msg = 'Huge articles';
7039 + foreach $key (keys %innd_huge) {
7040 + $innd_misc_stat{$msg}{$key} = $innd_huge{$key};
7041 + }
7042 + }
7043 + if (%innd_blocked) {
7044 + my $key;
7045 + my $msg = 'Blocked server feeds';
7046 + foreach $key (keys %innd_blocked) {
7047 + $innd_misc_stat{$msg}{$key} = $innd_blocked{$key};
7048 + }
7049 + }
7050 + if (%innd_strange_strings) {
7051 + my $key;
7052 + my $msg = 'Including strange strings';
7053 + foreach $key (keys %innd_strange_strings) {
7054 + $innd_misc_stat{$msg}{$key} = $innd_strange_strings{$key};
7055 + }
7056 + }
7057 + if (%rnews_bogus_ng) {
7058 + my $key;
7059 + my $msg = 'Unwanted newsgroups';
7060 + foreach $key (keys %rnews_bogus_ng) {
7061 + $rnews_misc{$msg}{$key} = $rnews_bogus_ng{$key};
7062 + }
7063 + }
7064 + if (%rnews_bogus_dist) {
7065 + my $key;
7066 + my $msg = 'Unwanted distributions';
7067 + foreach $key (keys %rnews_bogus_dist) {
7068 + $rnews_misc{$msg}{$key} = $rnews_bogus_dist{$key};
7069 + }
7070 + }
7071 + if (%rnews_unapproved) {
7072 + my $key;
7073 + my $msg = 'Articles unapproved';
7074 + foreach $key (keys %rnews_unapproved) {
7075 + $rnews_misc{$msg}{$key} = $rnews_unapproved{$key};
7076 + }
7077 + }
7078 + if (%rnews_bogus_date) {
7079 + my $key;
7080 + my $msg = 'Bad Date';
7081 + foreach $key (keys %rnews_bogus_date) {
7082 + $rnews_misc{$msg}{$key} = $rnews_bogus_date{$key};
7083 + }
7084 + }
7085 +
7086 + $rnews_misc{'Too old'}{'--'} = $rnews_too_old if $rnews_too_old;
7087 + $rnews_misc{'Bad linecount'}{'--'} = $rnews_linecount if $rnews_linecount;
7088 + $rnews_misc{'Duplicate articles'}{'--'} = $rnews_duplicate
7089 + if $rnews_duplicate;
7090 + $rnews_misc{'No colon-space'}{'--'} = $rnews_no_colon_space
7091 + if $rnews_no_colon_space;
7092 +
7093 + if (%nnrpd_groups) {
7094 + my $key;
7095 + foreach $key (keys (%nnrpd_connect)) {
7096 + unless ($nnrpd_groups{"$key"} || $nnrpd_post_ok{"$key"} ||
7097 + $nnrpd_articles{"$key"}) {
7098 + $nnrpd_curious{$key} = $nnrpd_connect{$key};
7099 + undef $nnrpd_connect{$key};
7100 + }
7101 + }
7102 + }
7103 +}
7104 +
7105 +sub report_unwanted_ng {
7106 + my $file = shift;
7107 + open (FILE, "$file") && do {
7108 + while (<FILE>) {
7109 + my ($c, $n) = $_ =~ m/^\s*(\d+)\s+(.*)$/;
7110 + next unless defined $n;
7111 + $n =~ s/^newsgroup //o; # for pre 1.8 logs
7112 + $inn_uw_ng{$n} += $c;
7113 + }
7114 + close (FILE);
7115 + };
7116 +
7117 + unlink ("${file}.old");
7118 + rename ($file, "${file}.old");
7119 +
7120 + open (FILE, "> $file") && do {
7121 + my $g;
7122 + foreach $g (sort {$inn_uw_ng{$b} <=> $inn_uw_ng{$a}} (keys (%inn_uw_ng))) {
7123 + printf FILE "%d %s\n", $inn_uw_ng{$g}, $g;
7124 + }
7125 + close (FILE);
7126 + chmod(0660, "$file");
7127 + };
7128 + unlink ("${file}.old");
7129 +}
7130 +
7131 +###########################################################################
7132 +
7133 +# Compare 2 dates (+hour)
7134 +sub datecmp {
7135 + # ex: "May 12 06" for May 12, 6:00am
7136 + # The 2 dates are near. The range is less than a few days that's why we
7137 + # can cheat to determine the order. It is only important if one date
7138 + # is in January and the other in December.
7139 +
7140 + my($date1) = substr($a, 4, 2) * 24;
7141 + my($date2) = substr($b, 4, 2) * 24;
7142 + $date1 += index("JanFebMarAprMayJunJulAugSepOctNovDec",substr($a,0,3)) * 288;
7143 + $date2 += index("JanFebMarAprMayJunJulAugSepOctNovDec",substr($b,0,3)) * 288;
7144 + if ($date1 - $date2 > 300 * 24) {
7145 + $date2 += 288 * 3 * 12;
7146 + }
7147 + elsif ($date2 - $date1 > 300 * 24) {
7148 + $date1 += 288 * 3 * 12;
7149 + }
7150 + $date1 += substr($a, 7, 2);
7151 + $date2 += substr($b, 7, 2);
7152 + $date1 - $date2;
7153 +}
7154 +
7155 +sub host2dom {
7156 + my $host = shift;
7157 +
7158 + $host =~ m/^[^\.]+(.*)/;
7159 + $host =~ m/^[\d\.]+$/ ? "unresolved" : $1 ? "*$1" : "?";
7160 +}
7161 +
7162 +1;