mrtgのインストール

mrtgのインストールと設定

2009/06/18(木) 22:38 ― taki

debianの場合はいつもの

# aptitude install mrtg

cfgmakerにsnmpdのコミュニティ名とホスト名を指定して下記のように。

# /usr/bin/cfgmaker private@localhost> /etc/mrtg.cfg

ここでメモリの容量をチェックしておきます。

# free
             total       used       free     shared    buffers     cached
Mem:        248140     220840      27300          0      42444      61028
-/+ buffers/cache:     117368     130772
Swap:       345356        360     344996

248140がメモリの容量、345356がスワップの容量。 これを覚えておいてmrtg.cfgを編集。

# vi /etc/mrtg.cfg

Target[mem]: のところのMaxBytes1[mem]:とMaxBytes2[mem]:にメモリとスワップの最大値を書き込んでおくこと。 とりあえず、こんな感じにしました。

# Created by 
# /usr/bin/cfgmaker --no-down private@localhost


### Global Config Options

#  for UNIX
# WorkDir: /home/http/mrtg

#  for Debian
WorkDir: /var/www/mrtg

#  or for NT
# WorkDir: c:\mrtgdata

### Global Defaults

#  to get bits instead of bytes and graphs growing to the right
# Options[_]: growright, bits

EnableIPv6: no

######################################################################
# System: ft
# Description: Linux ft 2.6.26-2-686 #1 SMP Thu Mar 26 01:08:11 UTC 2009 i686
# Contact: Root  (configure /etc/snmp/snmpd.local.conf)
# Location: Unknown (configure /etc/snmp/snmpd.local.conf)
######################################################################


### Interface 1 >> Descr: 'lo' | Name: 'lo' | Ip: '127.0.0.1' | Eth: '' ###
### The following interface is commented out because:
### * it is a Software Loopback interface
# 

### Interface 2 >> Descr: 'eth0' | Name: 'eth0' | Ip: '192.168.1.2' | Eth: まっくあどれす' ###

Target[localhost_2]: 2:private@localhost:
SetEnv[localhost_2]: MRTG_INT_IP="192.168.1.2" MRTG_INT_DESCR="eth0"
MaxBytes[localhost_2]: 1250000
Title[localhost_2]: Traffic Analysis for 2 -- ft
PageTop[localhost_2]: <h1>Traffic Analysis for 2 -- ft</h1>
Options[localhost_2]: growright, noinfo

Target[cpu]: .1.3.6.1.4.1.2021.11.50.0&.1.3.6.1.4.1.2021.11.52.0:private@localhost
MaxBytes[cpu]: 100
Options[cpu]: growright, noinfo, nopercent
YLegend[cpu]: CPU usage(%)
ShortLegend[cpu]: (%)
LegendI[cpu]: user
LegendO[cpu]: system
Legend1[cpu]: CPU usage(user)(%)
Legend2[cpu]: CPU usage(system)(%)
Title[cpu]: CPU usage
PageTop[cpu]:<h1>CPU usage</h>

Target[mem]: .1.3.6.1.4.1.2021.4.6.0&.1.3.6.1.4.1.2021.4.4.0:private@localhost
MaxBytes1[mem]: 248140
MaxBytes2[mem]: 345356
Unscaled[mem]: dwmy
Options[mem]: gauge, absolute, growright, noinfo
YLegend[mem]: Mem Free(Bytes)
ShortLegend[mem]: Bytes
kilo[mem]: 1024
kMG[mem]: k,M,G,T,P
LegendI[mem]: Real
LegendO[mem]: Swap
Legend1[mem]: free physical memory[MBytes]
Legend2[mem]: free swap[MBytes]
Title[mem]: free memory
PageTop[mem]: <h1>Free memory</h1>

Target[disk]: .1.3.6.1.4.1.2021.9.1.9.1&.1.3.6.1.4.1.2021.9.1.9.1:private@localhost
MaxBytes[disk]: 100
Unscaled[disk]: dwmy
Options[disk]: gauge, absolute, growright, nopercent, noinfo
YLegend[disk]: Disk Used(%)
ShortLegend[disk]: (%)
LegendI[disk]: / Disk used
LegendO[disk]: / Disk Used
Legend1[disk]: / Disk used
Legend2[disk]: / Disk used
Title[disk]: Disk usage
PageTop[disk]: <h1>Disk usage</h1>

あとは、indexmakerで

# indexmaker /etc/mrtg.cfg > /var/www/mrtg/index.html

これで、こんな感じで表示されます。 普通は公開しないんデスが、別に隠しておく必要も無いので公開しちゃいます。

更新日時:2010/12/16 19:34:46
キーワード:
参照:[本日のメニュー]
このページは凍結されています。