How It Works
MRTG is a powerful tool that allow you to graph just about everything we
want. In this context, the context of load balancers, we can graph two basic
types of data: Counters and gauges.
A counter is an OID variable that grows over time (for an explanation on
OIDs, check the concepts page). For example, for a counter OID that tracks
TCP connections, the number in the counter will increment by 1 every time a
new connection is established. This number never gets smaller, it is always
incrementing. MRTG polls a configured counter every 5 minutes, subtracts the
last number it got, and devides it by the number of seconds in 5 minutes.
This gives us a number, in instances per second, that this event (TCP
connection being opened) has occured. Here is an example:
10:10am: 123394 connections
10:15am: 138854 connections
138854 - 123394 = 15460 connections in the past 5 minutes
15460 connections / 300 seconds (in 5 minutes) = 52 connections per second
(rounded)
|
|
The number is rounded because MRTG only deals in positive integers.
A Gauge is a different type of variable. A gauge integer will go up an
down according the variable it tracks. For instance, concurrent TCP sessions
on a given device is considered a gauge. There is no math done on a guage
OID, it just takes the number polled and graphs that number.
Counters and gauges are good for measure different types of metrics.
Concurrent sessions, for instance, can only really be measured by a gauge.
At a specific moment in time, we are measuring how many active TCP sessions
there are. Bandwidth is best measured by a counter. Every time a bit passes
an interface, the interface counter is incremented. We can then use the
formula above to calculate the average number of bits/s that occured between
those 5 minute intervals.
To put it simply, any item that we need in something per second, we need
to have a counter. If we just need a varialbe graphed, then we need a gauge.
|