[mrtg] mrtg log formula known, but don't understand it.

Robin Butler Robin.Butler at ioko.com
Fri Mar 5 12:40:35 MET 2004


I am trying to configure MRTG to monitor a number of routers and
switches but so far I have encountered some problems.

This problem seems to be caused when MRTG is processing data for its log
entry, it multiplies the data by 1000 which causes the entry to exceed
the maximum bandwidth for a given interface and is therefore discarded
by the MRTG logs.


I understand the format of the MRTG log files is as follows:


First line:           <UNIX_time_in_seconds_since_epoch>
<current_input_value_in_bytes> <current_output_value_in_bytes>

Data:                < UNIX_time_in_seconds_since_epoch>
<input_during_time_interval_in_bytes> <input_average_in_bytes>
<output_during_time_interval_in_bytes> <output_average_in_bytes>



Initially no data was being recorded in the logs.

After debugging MRTG I understand this was caused by the amount of data
(input and output) exceeding the MaxBytes option. This option was
correctly configured by cfgmaker for the interface bandwidth. 

By replacing this value with an insanely high value MRTG started
recording data.


I understand that MRTG (cfgmaker) calculates MaxBytes as follows:

Interface speed 256Kbps            (Kilo bits) 

256 / 8 = 32KBps                       (Kilo Bytes)

32 * 1000 = 32000 B/s                (Bytes per second)

MaxBytes = 32000

However, data logged by MRTG seems to massively exceed this threshold.


On further analysis, the following equation seems to be used by MRTG to
calculate a log entry. 


((current_input_value_in_bytes - previous_input_value_in_bytes) /
time_interval) * 1K) = data entry


Most of which makes sense except the last multiplication. Why multiply
the data by 1000 when it is already in Bps?


My mrtg.cfg test config file is as follows:



Interval: 5

WorkDir: /mrtg-test

Options[_]: bits,nobanner,growright


Target[]: 3:COMSTR at

SetEnv[]: MRTG_INT_IP="" MRTG_INT_DESCR="Serial3/0"

#MaxBytes[]: 32000

MaxBytes[]: 32000000

Title[]: Traffic Analysis for 3 - host.domain.com



Thanks in advance,




Robin Butler

Firewall and Network Engineer


Tel: 01904 438000

Mob: 07776 198142

Fax: 01904 435450

Email: robin.butler at ioko.com


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