also sprach pcg:
> also sprach drummond-m:
> > Hi all. A while back I mentioned modifying the qmailmrtg stuff to work
> > with multilog formatted files and some of you have asked me about them.
> > They are almost complete .. the mods seem pretty easy really, though I
> > am not much of a programmer. I think I have it working. The queue script
> > did not require any changing of course ... and the concurrency script
> > was easy to fix up. Just a change in the regexp that matches log files.
> > I am having some trouble with the message bandwidth script though ... it
> > seems to work when I run it by hand but not when run from cron.
>
> I've attached the diff to alter the message file. This should make it work
> with multilog files. Works for me anyway... :)
Oops, no diff. Sorry, here it is.
/pg
--
Peter Green : Gospel Communications Network, SysAdmin : [EMAIL PROTECTED]
---
This message was brought to you by Linux, the free unix.
Windows without the X is like making love without a partner.
Sex, Drugs & Linux Rules
win-nt from the people who invented edlin
apples have meant trouble since eden
Linux, the way to get rid of boot viruses
(By [EMAIL PROTECTED], MaDsen Wikholm)
--- qmail-mrtg-mess Sat Oct 9 13:31:44 1999
+++ /usr/local/bin/qmail-mrtg-mess Mon May 29 20:57:23 2000
@@ -21,18 +21,18 @@
# the range of timestamps in a file by looking at its name and its mtime.
# we simply presume that the latest file contains timestamps < $stop.
opendir(DIR, $qmail_log_dir) or die;
-@_ = sort readdir(DIR);
+@_ = reverse sort readdir(DIR);
for(;;) {
$_ = pop(@_);
die "Not enough log files to cover $logperiod seconds" unless $_;
- next unless s/^\@//;
- unshift(@ARGV, "$qmail_log_dir/\@$_");
- last if $_ < $start - 10; # give cyclog ten seconds to roll over the log file.
+ next unless (/^\@/ || /^current$/);
+ unshift(@ARGV, "$qmail_log_dir/$_");
+ last if $_ < tai64n2time($start) - 10; # give cyclog ten seconds to roll over
+the log file.
}
closedir(DIR);
# process the two files, and run them through matchup.
-open(QA, "|$qa/matchup >/tmp/out.$$ 5>$holdingfile.new") or die;
+open(QA, "|/usr/local/bin/tai64n2time|$qa/matchup >/tmp/out.$$ 5>$holdingfile.new")
+or die;
if (-e "$holdingfile") {
open(P, "<$holdingfile") or die;
while(<P>) { print QA; }
@@ -40,7 +40,8 @@
}
while(<>) {
split;
- next if ($_[0] < $start || $_[0] >= $stop);
+ $n = tai64n2time($_[0]);
+ next if ($n < $start || $n >= $stop);
print QA;
}
close(QA);
@@ -63,3 +64,16 @@
# cleanup.
rename("$holdingfile.new", "$holdingfile") or die;
unlink("/tmp/out.$$");
+
+sub tai64n2time {
+ $src = shift;
+ if (($s,$t) = /^\@.(\w{15})(\w{8})/) {
+ $s = hex($s);
+ $t = hex($t); $t =~ s/500$//;
+ $tgt = "$s.$t";
+ }
+ else {
+ $tgt = $src;
+ }
+ return $tgt;
+}