[mrtg] Re: How do I just monitor working hours?

Alex van den Bogaerdt alex at slot.hollandcasino.nl
Thu Nov 23 01:41:38 MET 2000

> > So, what I need help with is there any way to use MRTG to calculate the
> > average network utilization only between 6:00 AM and 4:00PM?

> nope. 
> If you need to do this, you should look into rrdtool
> (http://www.rrdtool.org/)


Warning: you will need to do some work when you convert MRTG to use
RRDtool.  It will also affect the way that the graphs are created;
the user interface is different (graphs are made on demand) and they
will look slightly different.

Start with using RRDtool as a back end for MRTG (see the manuals and
see 14all in the contrib directory).  When this works, get to know
how to use RRDtool without using MRTG (the tutorial should help you
here).  Don't try to focus on your problem yet, start using simple
scripts.  Just make sure not to alter the databases when doing your
queries ("rrdtool graph" won't, "rrdtool update" will!).

You will need to write a CDEF with a fairly complex rpn-expression
in it.  Use TIME to get the time a sample was taken, use % (modulo)
86400 to convert it to time-of-day (UTC time!) and LIMIT it to the
desired time window.  IF the result is UNKNown, EXChange the last two
values on the stack, else leave them as they are.

Now you are ready to POP one element from the stack, keeping either
an unknown value or a known, desired, value.  The result is a series
of samples that are either unknown (when outside the window) or known.
This series can be plotted, printed, averaged etcetera just like any
other series of data in RRDtool graph.

This will probably not make sense to you right now but it will when
you look into RRDtool.  You will then also be able to correct the
bugs (if any) in above program.

One thing I'm not sure of:  the resulting unknown periods may or may
not be used when averaging the data.  It may prove necessary to correct
the output of the CDEF or else it will show only 1/3 of the real average
during that period.

 / alex at slot.hollandcasino.nl                  alex at ergens.op.het.net \
| work                                                         private |
| My employer is capable of speaking therefore I speak only for myself |
| Technical questions sent directly to me will be nuked. Use the list. | 
| http://faq.mrtg.org/                                                 |
| http://rrdtool.eu.org  --> tutorial                                  |

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