munin を Fedora で使う

munin とは MRTG のようにマシンの状態をグラフ化するもので、MRTG よりも手軽ということなので入れてみます。

Fedora には munin パッケージがあるので、yum でインストールできます。また、追加で必要な Perl パッケージも合わせてインストールされます。

# yum -y install munin munin-node

GIGAZINE の記事のとおりにやれば、大体大丈夫っぽいですが、あらかじめ munin のディレクトリの下に localhost というディレクトリを作ってから起動させました。
munin 自身で index.html を作ってくれるのは嬉しいかもしれません。以下はうちの環境です。

Perl に慣れているということもあって、Perl のアプリケーションは何だか安心ができるので好きです。

結論ですが、MRTG よりも設定が簡単ということもあり、個人的には munin を採用したいです。

話は変わって、自分の環境で、どこでも重宝しているのが sar + awk + gnuplot です。

#! /bin/sh
sar | awk '
/^[0-9][0-9]:/ {
    print $1, $3, $4, $5, $6, $7, $8;
}' > cpu.txt
gnuplot cpu.gp > /dev/null

set xdata time
set timefmt "%H:%M:%S"
set terminal png
set yrange [0:100]
set xlabel 'Time'
set ylabel 'System Activity (%)'
set noxtics
set size 1,1
plot   "cpu.txt" using 1:2 title 'User' with lines
replot "cpu.txt" using 1:3 title 'Nice' with lines
replot "cpu.txt" using 1:4 title 'System' with lines
replot "cpu.txt" using 1:5 title 'I/O Wait' with lines
replot "cpu.txt" using 1:6 title 'Steal' with lines
set output "cpu.png"
replot "cpu.txt" using 1:7 title 'Idol' with lines
quit

のようなファイルを用意しておけば PNG 画像に落としてくれます。お手軽です。