Chapter 15. Variables

Table of Contents
Graph Variables
Host Variables

Graph Variables

The following variables can be used in the Text Format and Value graph item fields. Below is a description of each of these variables.

Date/Time

|date_time|

This variable will place the date and time of the last poller run on the graph. It can be used to replicate MRTG's "graph last updated" feature.

Data Query Fields

|query_field_name|

You can place the value of any data query field on the by including this variable. Make sure to substitute "field_name" with the actual data query field name.

Example 15-1. Print the IP Address on a traffic graph

|query_ifIP|

Example 15-2. Print the mount point on net-snmp disk graph

|query_dskPath|

95th Percentile

|95:(bits|bytes):[0-9]:(current|total|max):[0-9]|

95th percentile is often used by hosting providers to bill customers based on their peak traffic usage while ignoring their top 5 percent. This way if a customer has a fairly consistent traffic pattern and decides to download a huge file one day, the large spike will be ignored.

In Cacti, 95th percentile works just like any other graph variable. To use this variable you must give it four arguments:

Table 15-1. 95th Percentile Argument Description

Name Description
(bits|bytes) Choose whether you want to represent your 95th percentile in bits or bytes. The only valid values for this field are 'bits' and 'bytes'.
[0-9] This field determines the power of 10 divisor that will be applied to your 95th percentile number. Enter '0' to leave the number alone, '3' for kilo or '6' for mega, etc.
(current|total|max) You can choose to calculate the 95th percentile based on the current data source or a total of all data sources used on the graph. The only valid values for this field are 'current' and 'total'.
[0-9] Enter the number of digits to use for floating point precision when printing out the final number. The default value for this field is two decimal places.

Example 15-3. Output in the following format: 42.58 mbit

|95:bits:6:max:2|

Bandwidth Summation

|sum:([0-9]|auto):(current|total):([0-9]):([0-9]+|auto)|

Bandwidth summation is useful for summing up all values in an RRD file for a given time range. This is typically useful on traffic graphs where you can see a total of all traffic that has gone through an interface in a given time period.

In Cacti, bandwidth summation works just like any other graph variable. To use this variable you must give it three arguments:

Table 15-2. Bandwidth Summation Argument Description

Name Description
([0-9]|auto) This field determines the power of 10 divisor that will be applied to your number. Enter '0' to leave the number alone, '3' for kilo or '6' for mega, etc. You can also enter 'auto' for this field to have Cacti automatically scale the number and insert the appropriate label.
(current|total) You can choose to calculate the summation based on the current data source or a total of all data sources used on the graph. The only valid values for this field are 'current' and 'total'.
[0-9] Enter the number of digits to use for floating point precision when printing out the final number. The default value for this field is two decimal places.
([0-9]+|auto) Enter the number of seconds in the past to perform the summation calculation for. For instance '86400' for 24 hours, '172800' for 48 hours, etc. You can also enter 'auto' for this field to have Cacti use the graph timespan.

Example 15-4. Output in the following format: 36.47 GB

|sum:auto:current:2:auto|