Skip to content
This repository has been archived by the owner on Dec 6, 2022. It is now read-only.

Graph Fields

ripienaar edited this page Dec 22, 2012 · 7 revisions

Each item shown on a graph is known as a field, fields have a lot of possible properties.

First we'll start with a few common examples and later have a reference of all the properties

title "Test Graph"

field :iowait, :data => "sumSeries(example.munin.load.load)",
               :color => "red",
               :alias => "Load Average",
               :derivative => true

basic-field.png

## Field Properties The following properties can be applied to any single field and applies to that field only. Fields appear in the graph in the order they are in the file.

The first argument - :iowait above - is the field name and should be unique for this graph.

data

The main data for the field, this can be anything graphite will accept as a target. There are a number of properties that you can apply to this data so you can generally keep this pretty simple even for derived data etc.

field :foo, :data => "fqdn.load.load"

field :load, :data => "sumSeries(*.load.load)"

derivative

The data is of an ever increasing type, you can derive the rate of change using this property.

field :foo, :data => "fqdn.cpu.iowait",
            :derivative => true

Corresponds to the graphite function derivative()

scale

Some data are in milliseconds and you might want it in seconds, this let you scale the data by some fraction.

field :foo, :data => "fqdn.cpu.iowait",
            :scale => 0.001

Corresponds to the graphite function scale()

scale_to_seconds

With derivative data, scale the data automatically to the desired rate in seconds. For example, put 60 to display the rate per minute.

field :foo, :data => "fqdn.disk.reads",
            :derivative => true,
            :scale_to_seconds => 1

Corresponds to the graphite function scaleToSeconds()

line

Sometimes you have infrequent data like git commits. This allow you to draw any non zero value as a vertical line.

field :foo, :data => "site.deploy",
            :line => true

Corresponds to the graphite function drawAsInfinite()

color

Sets the line color either to one of graphites well known types or a hex value

field :foo, :data => "site.deploy",
            :line => true,
            :color => "red"

Corresponds to the graphite function color()

dashed

Causes a line to be drawn as a dashed line rather than solid

field :foo, :data => "site.deploy",
            :line => true,
            :dashed => true

Corresponds to the graphite function dashed()

second_y_axis

Since graphite 0.9.9 you can draw data using both y axis, this allows you to set a specific field on the 2nd y axis

field :foo, :data => "fqdn.cpu.iowait",
            :scale => 0.001,
            :second_y_axis => true

Corresponds to the graphite function secondYAxis()

alias

You can set a custom legend caption for this field. By default this will be the graph name capitalized but you can adjust that easily.

field :io_wait, :data => "fqdn.cpu.iowait",
            :scale => 0.001,
            :alias => "IO Wait"

Without the alias property the graph caption would have been Io_wait.

Corresponds to the graphite function alias()

no_alias

Disables automatic aliasing of targets

cacti_style

Renders a data item in the same style as Cacti using current, min and max legends.

field :io_wait, :data => "fqdn.cpu.iowait",
            :scale => 0.001,
            :alias => "IO Wait",
            :cacti_style => true

highest_average

Draws the top n servers with the highest average value.

field :io_wait, :data => "*.cpu.iowait",
            :scale => 0.001,
            :alias => "IO Wait",
            :highest_average => 5

alias_by_node

Alias values based on a sub part of the data item names. For a negative index value, the number of the sub parts is added to the index.

field :io_wait, :data => "*.cpu.iowait",
            :scale => 0.001,
            :alias_by_node => 0

This will create graphs with items aliased by the first part of each data item

alias_sub

Run series names through a regex search/replace.

field :io_wait, :data => "*.disk.*.reads"
            :alias_sub_search => '.*(\w+)\.reads',
            :alias_sub_replace => 'disk \1'

Corresponds to the graphite function aliasSub()

legend_value

Appends a value to the metric, one of last, avg, total, min or max. Mutually exclusive to the above cacti_style option

field :io_wait, :data => "*.cpu.iowait",
            :scale => 0.001,
            :legend_value => "avg"

field_linewidth

The linewidth for this one specific field

field :io_wait, :data => "*.cpu.iowait",
            :field_linewidth => 2,
            :legend_value => "avg"