On 09-Jan-99 06:12:52, Peter Samuel wrote something about "Re: MRTG?". I just couldn't
help replying to it, thus:
> Attached is a PostScript dump of the web page.
Wouldn't it have been much better with a URL to the page instead?
If less that MRTG can do, another way is to use the status lines logged by
qmail 1.03. I wrote a script (complete with comments in danish :-) to do this
on an hourly basis, plotting the local and remote concurrencies:
----------
#!/bin/sh
# Det ta'r syv lange og syv brede hvis "sed" skal filtrere det alene,
# derfor "grep" til at g�re det grove arbejde.
# Awk omregner tidspunkter fra sekunder siden 1970 til timer efter
# fremstilling af grafen (dvs. tallene bliver negative, af hensyn til
# gnuplot).
grep --no-filename -F -e " status: local " /var/log/qmail/* \
| sed -n -e 's_^\(.*\..*\)\( status: local \)\(.*\)/\(.*\)\( remote
|\)\(.*\)/\(.*\)$_\1 \3 \4 \6 \7_gp' \
| awk ' \
BEGIN { FS = "\t"; OFS = FS; "date +%s" | getline nu; close ("date +%s"); } \
{ print ($1 - nu) / 3600, $2, $3, $4, $5; }' >/tmp/concurrency.tsv
# Plot data.
gnuplot <<SLUTP�PLOT
set output "/tmp/concurrency.pnm"
set terminal pbm small color
plot "/tmp/concurrency.tsv" using 1:3 title "Lokal max" with lines,
"/tmp/concurrency.tsv" using 1:5 title "Fjern max" with lines, "/tmp/concurrency.tsv"
using 1:4 title "Fjern" with lines, "/tmp/concurrency.tsv" using 1:2 title "Lokal"
with lines
SLUTP�PLOT
# Konverter plot til PNG format.
/usr/local/bin/pnmtopng -transparent "#FFFFFF" -compression 9 -hist
/tmp/concurrency.pnm >/tmp/concurrency.png
cp /tmp/concurrency.png /home/httpd/html-eising
# Slet midlertidige filer.
rm -f /tmp/concurrency.tsv /tmp/concurrency.pnm /tmp/concurrency.png
----------
The use of grep is only to lower the used CPU time from 15 minutes to 15
seconds. /var/logs/qmail/* are the log files, /tmp is /tmp and
/home/httpd/html-eising is where the web server looks for the image. The
resulting graph can be seen on <URL:http://eising.k-net.dk/>. The figures at
the bottom are the number of hours _after_ generation of the graph.
Flames for not doing this in Perl >/dev/null.
Regards,
/������������������������������T�����������������������������������������\
| Rask Ingemann Lambertsen | [EMAIL PROTECTED] |
| Registered Phase5 developer | WWW: http://www.gbar.dtu.dk/~c948374/ |
| A4000, 775 kkeys/s (RC5-64) | "ThrustMe" on XPilot and EFnet IRC |
| Everytime you throw dirt you loose a little ground. |