[Home][Back][Next]

Webサーバ構築済みが前提

1.NET-SNMPのインストール

# yum -y install net-snmp
Setting up Install Process
Setting up Repos
base 100% |=========================| 1.1 kB 00:00
updates-released 100% |=========================| 951 B 00:00
Reading repository metadata in from local files
base : ################################################## 2622/2622
primary.xml.gz 100% |=========================| 349 kB 00:00
MD Read : ################################################## 899/899
updates-re: ################################################## 899/899
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for net-snmp to pack into transaction set.
net-snmp-5.2.1-10.FC3.i38 100% |=========================| 41 kB 00:00
---> Package net-snmp.i386 0:5.2.1-10.FC3 set to be updated
--> Running transaction check
--> Processing Dependency: libsensors.so.3 for package: net-snmp
--> Processing Dependency: libnetsnmpmibs.so.5 for package: net-snmp
--> Processing Dependency: libnetsnmptrapd.so.5 for package: net-snmp
--> Processing Dependency: libnetsnmpagent.so.5 for package: net-snmp
--> Processing Dependency: libnetsnmp.so.5 for package: net-snmp
--> Processing Dependency: libnetsnmphelpers.so.5 for package: net-snmp
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for net-snmp-libs to pack into transaction set.
net-snmp-libs-5.2.1-10.FC 100% |=========================| 21 kB 00:00
---> Package net-snmp-libs.i386 0:5.2.1-10.FC3 set to be updated
---> Downloading header for lm_sensors to pack into transaction set.
lm_sensors-2.8.7-2.i386.r 100% |=========================| 22 kB 00:00
---> Package lm_sensors.i386 0:2.8.7-2 set to be updated
--> Running transaction check

Dependencies Resolved
Transaction Listing:
Install: net-snmp.i386 0:5.2.1-10.FC3 - updates-released

Performing the following to resolve dependencies:
Install: lm_sensors.i386 0:2.8.7-2 - base
Install: net-snmp-libs.i386 0:5.2.1-10.FC3 - updates-released
Total download size: 2.8 M
Downloading Packages:
(1/3): net-snmp-libs-5.2. 100% |=========================| 1.8 MB 00:05
(2/3): lm_sensors-2.8.7-2 100% |=========================| 426 kB 00:00
(3/3): net-snmp-5.2.1-10. 100% |=========================| 585 kB 00:01
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: lm_sensors 100 % done 1/3
Installing: net-snmp-libs 100 % done 2/3
Installing: net-snmp 100 % done 3/3

Installed: net-snmp.i386 0:5.2.1-10.FC3
Dependency Installed: lm_sensors.i386 0:2.8.7-2 net-snmp-libs.i386 0:5.2.1-10.FC3
Complete!
# yum clean packages
Cleaning up Packages
14 packages removed

2.NET-SNMPの設定

# vi /etc/snmp/snmpd.conf
変更前 変更後 説明
# sec.name source community
com2sec notConfigUser default public
# sec.name source community
# com2sec notConfigUser default public
com2sec local localhost private
com2sec mynetwork 192.168.1.0/24 public

コメントアウト
追加
追加
# groupName securityModel securityName
group notConfigGroup v1 notConfigUser
group notConfigGroup v2c notConfigUser
# groupName securityModel securityName
# group notConfigGroup v1 notConfigUser
# group notConfigGroup v2c notConfigUser
group MyROGroup v1 mynetwork
group MyROGroup v2c mynetwork

コメントアウト
コメントアウト
追加
追加
# Make at least snmpwalk -v 1 localhost -c public system fast again.
# name incl/excl subtree mask(optional)
view systemview included .1.3.6.1.2.1.1
view systemview included .1.3.6.1.2.1.25.1.1
# Make at least snmpwalk -v 1 localhost -c public system fast again.
# name incl/excl subtree mask(optional)
# view systemview included .1.3.6.1.2.1.1
# view systemview included .1.3.6.1.2.1.25.1.1
view all included .1 80



コメントアウト
コメントアウト
追加
# Finally, grant the group read-only access to the systemview view.

# group context sec.model sec.level prefix read write notif
access notConfigGroup "" any noauth exact systemview none none
# Finally, grant the group read-only access to the systemview view.

# group context sec.model sec.level prefix read write notif
# access notConfigGroup "" any noauth exact systemview none none
access MyROGroup "" any noauth exact all none none
access MyRWGroup "" any noauth exact all all none



コメントアウト

追加
追加
# Check the / partition and make sure it contains at least 10 megs.

#disk / 10000
# Check the / partition and make sure it contains at least 10 megs.

disk / 10000


コメント削除

NET-SNMPの起動
# /etc/init.d/snmpd start
snmpd を起動中: [ OK ]

3.MRTGのインストール

# yum -y install mrtg
Setting up Install Process
Setting up Repos
base 100% |=========================| 1.1 kB 00:00
updates-released 100% |=========================| 951 B 00:00
Reading repository metadata in from local files
base : ################################################## 2622/2622
updates-re: ################################################## 899/899
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for mrtg to pack into transaction set.
mrtg-2.10.15-1.i386.rpm 100% |=========================| 57 kB 00:00
---> Package mrtg.i386 0:2.10.15-1 set to be updated
--> Running transaction check

Dependencies Resolved
Transaction Listing:
Install: mrtg.i386 0:2.10.15-1 - base
Total download size: 914 k
Downloading Packages:
(1/1): mrtg-2.10.15-1.i38 100% |=========================| 914 kB 00:01
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: mrtg 100 % done 1/1

Installed: mrtg.i386 0:2.10.15-1
Complete!
# yum clean packages
Cleaning up Packages
1 packages removed

4.MRTGの設定

MRTG設定ファイル作成
# cfgmaker --ifref=descr --ifdesc=descr public@192.168.1.1 > /etc/mrtg/mrtg.cfg

MRTG設定ファイル編集
# vi /etc/mrtg/mrtg.cfg
変更前 変更後 説明
for UNIX
# WorkDir: /home/http/mrtg
for UNIX
# WorkDir: /home/http/mrtg
WorkDir: /var/www/mrtg


追加
# Options[_]: growright, bits

EnableIPv6: no
# Options[_]: growright, bits

EnableIPv6: no
Language:eucjp
コメントアウト


追加(日本語許可)
### Interface 2 >> Descr: 'eth0' | Name: '' | Ip: '' | Eth: '00-30-05-3e-ce-4c' ###
### The following interface is commented out because:
### * it is administratively DOWN
### * it is operationally DOWN
#
# Target[192.168.1.1_eth0]: \eth0:public@192.168.1.1:
# SetEnv[192.168.1.1_eth0]: MRTG_INT_IP="" MRTG_INT_DESCR="eth0"

# MaxBytes[192.168.1.1_eth0]: 12500000
# Title[192.168.1.1_eth0]: eth0 -- ataru01.kkataru.mine.nu
# PageTop[192.168.1.1_eth0]: <H1>eth0 -- ataru01.kkataru.mine.nu</H1>


(以下削除)
# <TABLE>
# <TR><TD>System:</TD> <TD>den08.apl.dyndns.org in Unknown (edit /etc/snmp/snmpd.conf)</TD></TR>
# <TR><TD>Maintainer:</TD> <TD>Root &lt;root@localhost&gt; (configure /etc/snmp/snmp.local.conf)</TD></TR>
# <TR><TD>Description:</TD><TD>eth0 </TD></TR>
# <TR><TD>ifType:</TD> <TD>ethernetCsmacd (6)</TD></TR>
# <TR><TD>ifName:</TD> <TD></TD></TR>
# <TR><TD>Max Speed:</TD> <TD>12.5 MBytes/s</TD></TR>
# </TABLE>
(ここまで削除)
### Interface 2 >> Descr: 'eth0' | Name: '' | Ip: '' | Eth: '00-30-05-3e-ce-4c' ###
### The following interface is commented out because:
### * it is administratively DOWN
### * it is operationally DOWN
#
# Target[eth0]: \eth0:public@192.168.1.1:
# SetEnv[eth0]: MRTG_INT_IP="" MRTG_INT_DESCR="eth0"
# MaxBytes[eth0]: 12500000
# Title[eth0]: eth0 トラフィック
# PageTop[eth0]: <H1>eth0 トラフィック</H1>

CPU使用率表示設定の追加
vi /etc/mrtg/mrtg.cfg
変更前 変更後 説明
最終行から追加 ### CPU Load Average ###
Target[cpu]: .1.3.6.1.4.1.2021.10.1.5.1&.1.3.6.1.4.1.2021.10.1.5.2:public@192.168.1.1
MaxBytes[cpu]: 100
Unscaled[cpu]: dwmy
Options[cpu]: gauge, absolute, growright, noinfo, nopercent
YLegend[cpu]: CPU Load(%)
ShortLegend[cpu]: (%)
LegendI[cpu]: 1分間平均
LegendO[cpu]: 5分間平均
Legend1[cpu]: 1分間平均(%)
Legend2[cpu]: 5分間平均(%)
Title[cpu]: CPU使用率
PageTop[cpu]: <H1>CPU使用率</H1>
追加
空きメモリ量表示設定追加
# free
             total       used       free     shared    buffers     cached
Mem:        644864     576440      68424          0      96960     185796
-/+ buffers/cache:     293684     351180
Swap:      1052248        224    1052024
vi /etc/mrtg/mrtg.cfg
変更前 変更後 説明
最終行から追加 ### Memory Free ####
Target[mem]: .1.3.6.1.4.1.2021.4.6.0&.1.3.6.1.4.1.2021.4.4.0:public@192.168.1.1
MaxBytes1[mem]: 644864
MaxBytes2[mem]: 1052248
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]: 空き物理メモリ[MBytes]
Legend2[mem]: 空きスワップメモリ[MBytes]
Title[mem]: 空きメモリ量
PageTop[mem]: <H1>空きメモリ量</H1>
追加
ディスク使用率表示設定の追加
vi /etc/mrtg/mrtg.cfg
変更前 変更後 説明
最終行から追加 ### Disk Used ####
Target[disk]: .1.3.6.1.4.1.2021.9.1.9.1&.1.3.6.1.4.1.2021.9.1.9.1:public@192.168.1.1
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]: ディスク使用率
PageTop[disk]: <H1>ディスク使用率</H1>
追加

5.MRTGの起動

# mrtg /etc/mrtg/mrtg.cfg (1回)
Rateup WARNING: /usr/bin//rateup could not read the primary log file for disk
Rateup WARNING: /usr/bin//rateup The backup log file for disk was invalid as well
Rateup WARNING: /usr/bin//rateup Can't remove disk.old updating log file
Rateup WARNING: /usr/bin//rateup Can't rename disk.log to disk.old updating log file

# mrtg /etc/mrtg/mrtg.cfg (2回)
Rateup WARNING: /usr/bin//rateup Can't remove disk.old updating log file
# mrtg /etc/mrtg/mrtg.cfg (3回)

*3回以上は起動しましょうね。

6.MRTGの確認

# vi /etc/httpd/conf.d/mrtg.conf

(外部アクセス可能にする場合)
Alias /mrtg /var/www/mrtg

<Location /mrtg>
Order deny,allow
Deny from all
Allow from All
#Allow from 127.0.0.1
Allow from ::1
# Allow from .example.com
</Location>

# /etc/init.d/httpd reload
httpd を再読み込み中: [ OK ]

7.Indexページの作成

# indexmaker --columns=1 --addhead="<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=euc-jp\">" /etc/mrtg/mrtg.cfg > /var/www/mrtg/index.html
*以上でhttp://(ドメイン)/mrtg/にて閲覧ができれば成功です。

[Home][Back][Next]

Copyright (C) 2005 ataru