Re: ref: qmail+mrtg+multilog mods

2000-08-03 Thread Cedric Fontaine

Peter Green said in June 12, that he modified the qmailmrtg stuff to work
with multilog format

Do you have some infos on it ??? Where can I find that ???
Or what shall I do if I want to use the qmailmrtg stuff ??

Thanks




Re: ref: qmail+mrtg+multilog mods

2000-08-03 Thread Magnus Bodin

On Thu, Aug 03, 2000 at 04:21:00PM +0200, Cedric Fontaine wrote:
 Peter Green said in June 12, that he modified the qmailmrtg stuff to work
 with multilog format
 
 Do you have some infos on it ??? Where can I find that ???
 Or what shall I do if I want to use the qmailmrtg stuff ??

Have some patience. Or pay somebody.
I've just returned from a vacation from the midnight-sun-zone. 

I'll deal with this Very Soon Now. 

/magnus

--
http://x42.com/



Re: ref: qmail+mrtg+multilog mods

2000-06-12 Thread Peter Green

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... :)

Diffs are easy: assuming you're in your working source dir, the original
qmail-mrtg stuff is in a dir called qmail-mrtg.orig/ and your new stuff is
in qmail-mrtg/, just do:

  diff -ru qmail-mrtg.orig/ qmail-mrtg/  patchfile

There are other options, but I've found this to be the easiest.

/pg
-- 
Peter Green : Gospel Communications Network, SysAdmin : [EMAIL PROTECTED]
---
I can picture in my mind a world without war, a world without hate. And I can 
picture us attacking that world, because they'd never expect it.
 (Jack Handey)




Re: ref: qmail+mrtg+multilog mods

2000-06-12 Thread Peter Green

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;
+}