Prev / Next

2013-02-13 / fieldname.cdef

Munin Plugin を書くとき、何らかのコマンドで取得できる値の単位が byte で
これを bit になおしたいことがある。

Plugin の中で計算してもいいんだけど、
shell script で書いているのでちょっと面倒という時に、
fieldname.cdef を使うと便利。

- fieldname.cdef – Munin
  http://munin-monitoring.org/wiki/fieldname.cdef

 Fieldname.cdef allows you to manipulate the data collected in an rrd. Things like turning bytes into bits, making numbers negative, and a host of other operations.

ということなので、rrd に格納したデータをグラフ作成のときにいじってくれるもののよう。

if_ plugin で byte で取得したデータを bit になおしてグラフを作成するのに使われている。

        echo 'rbytes.label received'
        echo 'rbytes.type DERIVE'
        echo 'rbytes.graph no'
        echo 'rbytes.cdef rbytes,8,*'
        echo 'rbytes.min 0'


逆ポーランド記法(operand,operand,operator)の形で書く。

rrd にためこんだ数値をいじらずにグラフで利用する値を変更できるので、
すでにあるデータを活かせるのがいい。

fieldname.cdef 以外については以下。

- fieldnames – Munin
  http://munin-monitoring.org/wiki/fieldnames

comments powered by Disqus