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

Related Items

ripienaar edited this page Oct 16, 2011 · 1 revision

Some times you have a lot of related items like these:

devco_net
`-- munin
    `-- cpu
        |-- idle
        |-- iowait
        |-- irq
        |-- nice
        |-- softirq
        |-- steal
        |-- system
        `-- user

To save on some typing there is a helper that helps you rapidly create fields for these items:

title   "CPU IRQ Usage"
vtitle  "percent"

service :munin, :cpu do
     field :irq, :derivative => true,
                 :scale => 0.001,
                 :color => "red",
                 :alias => "IRQ"

     field :softirq, :derivative => true,
                     :scale => 0.001,
                     :color => "yellow",
                     :alias => "Batched IRQ"         
end

line :caption => "Critical", :value => 2, :color => "red"
line :caption => "Warning",  :value =>  1.5, :color => "orange", :dashed => true

As you can see you can combine this with other field creation methods, here we draw 2 lines on the graph but you can create any arbitrary field.

In order to support this kind of usage when you access the data from Ruby you need to provide a hostname:

g = GraphiteGraph.new("cpu/irq.graph", {}, :hostname => "devco_net")
puts g.url
Clone this wiki locally