Background: Know: INTEGER, Recognize:

Up | ||

Previous | Next | |

Down |

**Defined Types: Counters and Gauges.**
This page discusses two basic types of objects: counters and gauges. They can be used by MRTG (Multi Router Traffic Grapher) to monior the traffic load on network-links.

**COUNTERS**

A counter is an object that returns an unsigned integer that grows over time. It has the following characteristics.

–non-negative.

–monotonically increasing.

–wrap around.

*For example:*

It can be used to track the TCP connections. The number in the counter will increase by 1 every time a new connection is established. This number is always incrementing. MRTG will poll a configured counter every 5 minutes, subtract the last number it got, and divides it by the number of seconds in 5 minutes. This gives us the number of new TCP connections per second in the 5 minutes. It can be seen from the following figure:

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)

**GAUGES:**

A gauge is a different type of variable. A gauge integer will go up an down according the variable it tracks. It has the following characteristics:

–non-negative

–increase or decrease

–capped at extremes

*For instance,* concurrent TCP sessions on a given device can be considered as a gauge. MRTG just takes the number polled and graphs that number, without math done.

**COUNTERS vs GAUGES**

Counters and gauges are good for measure different types of metrics. However, concurrent sessions can only be measured by a gauge. It tells how many active TCP sessions there are at a specific moment in time. Bandwidthe is best measured by a counter. Every time a bit passes an interface, the interface counter is incremented.

Simply speaking, any item that we need in something per second, we need to have a counter. If we just need a variable graphed, then we need a gauge.

**See also**