[mrtg] Re: Two sets of graphs from same data?

Alex van den Bogaerdt alex at ergens.op.het.net
Sat Sep 28 14:00:09 MEST 2002

On Fri, Sep 27, 2002 at 08:59:09PM -0600, Jim McAtee wrote:
> Is there a way I could generate two sets of graphs, one with peaks and one
> without peaks, from the same set of data?  I know I could just set up mrtg to
> retrieve data from the device twice in two individual device setups, but I'd
> rather the graphs were working off of exactly the same database.
> I was thinking of setting up a cron job that would simply copy the database from
> one file/directory to another, but how could I then get mrtg to generate its
> graphs?

Think of MRTG as a wrapper for rateup.  One of its many tasks is
to generate a rateup command line to produce an image.

Now *you* create another wrapper for rateup.  It will do nothing
more than log what MRTG is generating.  When you've done that, you
can see what MRTG is telling rateup to do.  

Let MRTG do its stuff a couple of times, with peaks and without peaks
(so: you have to modify the config file inbetween).

Next step:  Adjust your wrapper so that it duplicates some of the
commands that MRTG is giving to rateup.  Make it so that another
set of images is produced, with a slightly different file name for
the resulting images and of course with the corresponding command

Depending on what you prefer you can do this in bash, perl, windows
command.com or whatever other language you prefer.

I would do it like this:

Move rateup to another file, say "rateup.real".  
Write a new "rateup" file that does this:

    echo "$@" >> rateup.log
    rateup.real $@

After a couple of MRTG runs, including the changed config file,
I take a peek at "rateup.log".  One of the changes immediately
visible to me is that the images are generated using a command
"i" or "p".  "i" is for "image" and "p" is for "image w/peaks"
(*the* reason to use free software: you can read the source!)

Now it is just a matter of altering the rateup-wrapper so that
it generates an extra rateup-command, with the appropriate
parameters.  For instance, if MRTG calls rateup and gives it
an "i target-day.png ...." command, you do another call to
rateup and give it a "p target-peak-day.png ..." command.


Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

More information about the mrtg mailing list