[mrtg] Re: Discard weekends?

Alex van den Bogaerdt alex at ergens.op.HET.NET
Thu Feb 28 00:01:43 MET 2002


Jason Lau wrote:

> Is there any way to configure MRTG to NOT calculate and graph data that fall 
> within a certain time period, whether it be a specific hourly-time range, 
> day or range of days?

Not in MRTG that I know of.  It can be done with RRDtool, if you care to
write your own customized grapher script.

> I work for a company that religiously works from 8 to 5, Monday through 
> Friday (can we say government?).  From non-business hours (5PM to 8AM) 
> weekdays and all day on the weekends, there is indefinately 0% utilization.  
> To me, this seems like it would skew my data and drop my average utilization 
> during business hours, which is the time I need to focus on.

The trick is to set those values to unknown (in your script, not in
the database).  These unknown values will be ignored while calculating
averages.

With RRDtool you can do things like this:

    DEF:ds0=/path/to/your/router.rrd:ds0:AVERAGE

This defines variable ds0 from database router.rrd, averages.


    CDEF:workhours=

This defines variable workhours which we will calculate further:


    ds0,LTIME,28801,61200,LIMIT

This will return a number (representing time of day) inbetween 8am and 5pm
while returning NaN (unknown) outside those hours.  Then:


    ,UN

This will take the number we just calculated and check if it is unknown.
If it is, return 1, else 0.


This 1 or 0 can be used in an if-then-else construct that returns either
the value or an unknown value:

     ,UNKN,ds0,IF


The complete string is:

    CDEF:workhours=ds0,LTIME,28801,61200,LIMIT,UN,UNKN,ds0,IF

(the ... ,UN,UNKN,ds0 ... part could be written as ... ,ds0,UNKN ...
but this would rely on large numbers being processed as if they were 1).

Now you can process workhours as if you were processing ds0.  To
also skip saturday and sunday is an excercise left to the reader.
It can be done using the same approach.  Also skipping public
holydays will be more difficult.

Notes:
1) This is from memory.  I didn't check it so there may be errors
   and/or typos.  Even for serious design flaws: use at own risk.
2) 28801 is *not* a typo.  You don't want the interval that is stored
   at time 28800.  This would be the interval from 7:55 to 8:00 am.
3) If you want to continue this message thread please do so on the
   rrdtool users list.

HTH
-- 
   __________________________________________________________________
 / 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