Linux自宅サーバーの設定
RRDtoolとHotSaNICを使いsnmp経由で取得した
MIB-IIの各種情報をHTML化する(その1)
Vine2.5 + 815Eマザー自作マシン
RRDtool − http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/download.html rrdtool-1.0.38-1
HotSaNIC − http://hotsanic.sourceforge.net/
HotSaNIC-0.4.0
まずはrrdtooから、今回はsrc.rpmからやったので rpm --rebuild
rrdtool-1.0.38-1.src.rpm
してrpmを作成。(結構時間かかる)
/root/rpm/RPMS/i386/ あたりに出来た rrdtool-1.0.38-1.i386.rpm
をrpm -ivhでバイナリのインストール。
次にRRDtoolのフロントエンドであるHotSaNIC。こちらは tar -xzvf HotSaNIC-0.4.0.tgz で解凍した後 mv ./HotSaNIC /usr/local してファイル一式を移動する。
/usr/local/HotSaNIC/setup.pl
を実行する。実行した結果は /usr/local/HotSaNIC/settings
に保存れる。
MIB-IIのOIDサブツリー情報を読み、組み込むモジュールを聞いてくる。ここでの設定結果は後でもsettingsファイルを修正すれば良いので、どのモジュールを入れるか深く考えなくてオッケー(笑)取りあえず全部yesとでもしておこう。
代表で最初に聞かれるSENSORSサブツリーの例。まずは該当サブツリー用のモジュールの組み込みをするか聞いてくるのでデータを取得するのであればyes(Y)、取得しないのであればno(N)とタイプする。
Module found: SENSORS
----------------------------------------
Do you want to use this module ? (Y)es / (n)o > Y
yesとした場合は取得したデータをHTML化するか聞いてくる。HTML化するのであればyes(Y)、しないのであればno(N)とタイプする。
Do you want to show this module's graphs on the webpage ? (Y)es / (n)o >
y
setting up data-sensors ...
Please check the settings file and adapt it to satisfy your needs.
for your info: this configuration is a bit tricky
うちの環境の場合モジュールはSENSORS、DNET、PART、PING、TRAFFIC、NETWORKS、DISKIO、SYSTEM、WORMSの9個、いずれも上記の様にモジュール組み込み・HTML化のする/しないを答えてゆけば良い。
ただしTRAFFICだけは下記の様にネットワークインターフェイス別にHTML化するかどうか聞かれる。ここではeth0とeth1をHTML化している。
----------------------------------------
Configuring local interfaces. Please answer these:
found: eth0 - (y)es or (n)o ?
y
found: eth1 - (y)es or (n)o ?
y
found: lo - (y)es or (n)o ?
n
Please check the settings file and adapt it to satisfy your needs.
If you have any interfaces slower than 100 MBit, please change the
corrosponding default values.
Maybe there are some additional interfaces or SNMP hosts you want
to query.
次にHTML化したファイルを吐き出すディレクトリを指定するため
/usr/local/HotSaNIC/settings
を編集し以下の様にディレクトリを書き込む。
# web-directory for all graphs
# this directory must be writeable for the rrdgraph tool
# because each plugin will create its own subdir here.
#
WEBDIR="not configured" ←ここをHTML出力先のディレクトリに書き換える
HTMLファイルを作成するため
./makeindex.pl
を実行する。
./rrdgraph start でデーモンモードで起動する。止めるときは./rrdgraph
stop で停止。
起動時に自動実行するのであれば /etc/rc.d/rc.local
あたりに /usr/local/HotSaNIC/rrdgraph start
を追加しよう。
表示されるHTMLファイルはこんな感じになる。