Subscribe:

2011/01/27

ネットワークトラフィック監視ツール導入(さくらVPS)

こんな感じのグラフが出るツールを導入する。(5分毎のネットワークトラフィック)
eth0-day
まずは「NET-SNMP」をインストール
# yum -y install net-snmp
[plain toolbar="false" gutter="false"]Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
* addons: www.ftp.ne.jp
* base: www.ftp.ne.jp
* extras: www.ftp.ne.jp
* rpmforge: fr2.rpmfind.net
* updates: www.ftp.ne.jp
addons | 951 B 00:00
base | 2.1 kB 00:00
extras | 2.1 kB 00:00
rpmforge | 1.1 kB 00:00
updates | 1.9 kB 00:00
utterramblings | 951 B 00:00
185 packages excluded due to repository priority protections
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package net-snmp.x86_64 1:5.3.2.2-9.el5_5.1 set to be updated
--> Processing Dependency: net-snmp-libs = 1:5.3.2.2-9.el5_5.1 for package: net-snmp
--> Processing Dependency: libnetsnmpmibs.so.10()(64bit) for package: net-snmp
--> Processing Dependency: libnetsnmpagent.so.10()(64bit) for package: net-snmp
--> Processing Dependency: libnetsnmp.so.10()(64bit) for package: net-snmp
--> Processing Dependency: libsensors.so.3()(64bit) for package: net-snmp
--> Processing Dependency: libnetsnmptrapd.so.10()(64bit) for package: net-snmp
--> Processing Dependency: libnetsnmphelpers.so.10()(64bit) for package: net-snmp
--> Running transaction check
---> Package lm_sensors.x86_64 0:2.10.7-9.el5 set to be updated
---> Package net-snmp-libs.x86_64 1:5.3.2.2-9.el5_5.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================
Package Arch Version Repository Size
==========================================================================================
Installing:
net-snmp x86_64 1:5.3.2.2-9.el5_5.1 updates 702 k
Installing for dependencies:
lm_sensors x86_64 2.10.7-9.el5 base 525 k
net-snmp-libs x86_64 1:5.3.2.2-9.el5_5.1 updates 1.3 M

Transaction Summary
==========================================================================================
Install 3 Package(s)
Upgrade 0 Package(s)

Total download size: 2.5 M
Downloading Packages:
(1/3): lm_sensors-2.10.7-9.el5.x86_64.rpm | 525 kB 00:00
(2/3): net-snmp-5.3.2.2-9.el5_5.1.x86_64.rpm | 702 kB 00:00
(3/3): net-snmp-libs-5.3.2.2-9.el5_5.1.x86_64.rpm | 1.3 MB 00:00
------------------------------------------------------------------------------------------
Total 7.7 MB/s | 2.5 MB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : lm_sensors 1/3
Installing : net-snmp-libs 2/3
Installing : net-snmp 3/3
Installed:
net-snmp.x86_64 1:5.3.2.2-9.el5_5.1
Dependency Installed:
lm_sensors.x86_64 0:2.10.7-9.el5 net-snmp-libs.x86_64 1:5.3.2.2-9.el5_5.1

Complete![/plain]
# vi /etc/snmp/snmpd.conf ← NET-SNMP設定ファイル編集
40行目位から~
# sec.name source community
#com2sec notConfigUser default public ← コメントアウト
com2sec local localhost private ← 追加
com2sec mynetwork 59.106.178.0/23 public ← 追加(IPアドレスを環境にあわせる)
####
# Second, map the security name into a group name:

# groupName securityModel securityName
#group notConfigGroup v1 notConfigUser ← コメントアウト
#group notConfigGroup v2c notConfigUser ← コメントアウト
group MyROGroup v1 mynetwork ← 追加
group MyROGroup v2c mynetwork ← 追加
####
# Third, create a view for us to let the group have rights to:

# 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 ← コメントアウト
access MyROGroup "" any noauth exact all none none ← 追加
access MyRWGroup "" any noauth exact all all none ← 追加

314行目位から
# Check the / partition and make sure it contains at least 10 megs.

#disk / 10000 ← コメントを削除
# /etc/init.d/snmpd start ← SNMP起動
snmpd を起動中: [ OK ]
# chkconfig snmpd on ← S自動起動オン
# chkconfig --list snmpd
snmpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off

「mrtg」をインストール
# yum -y install mrtg
[TEXT toolbar="false" gutter="false"]Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
* addons: www.ftp.ne.jp
* base: www.ftp.ne.jp
* extras: www.ftp.ne.jp
* rpmforge: fr2.rpmfind.net
* updates: www.ftp.ne.jp
185 packages excluded due to repository priority protections
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mrtg.x86_64 0:2.14.5-2 set to be updated
--> Processing Dependency: perl-IO-Socket-INET6 for package: mrtg
--> Processing Dependency: perl-Socket6 for package: mrtg
--> Running transaction check
---> Package perl-IO-Socket-INET6.noarch 0:2.51-2.fc6 set to be updated
---> Package perl-Socket6.x86_64 0:0.19-3.fc6 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================
Package Arch Version Repository Size
==========================================================================================
Installing:
mrtg x86_64 2.14.5-2 base 840 k
Installing for dependencies:
perl-IO-Socket-INET6 noarch 2.51-2.fc6 base 13 k
perl-Socket6 x86_64 0.19-3.fc6 base 21 k

Transaction Summary
==========================================================================================
Install 3 Package(s)
Upgrade 0 Package(s)

Total download size: 875 k
Downloading Packages:
(1/3): perl-IO-Socket-INET6-2.51-2.fc6.noarch.rpm | 13 kB 00:00
(2/3): perl-Socket6-0.19-3.fc6.x86_64.rpm | 21 kB 00:00
(3/3): mrtg-2.14.5-2.x86_64.rpm | 840 kB 00:00
------------------------------------------------------------------------------------------
Total 3.7 MB/s | 875 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : perl-Socket6 1/3
Installing : perl-IO-Socket-INET6 2/3
Installing : mrtg 3/3
Installed:
mrtg.x86_64 0:2.14.5-2
Dependency Installed:
perl-IO-Socket-INET6.noarch 0:2.51-2.fc6 perl-Socket6.x86_64 0:0.19-3.fc6

Complete![/TEXT]

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

0 件のコメント: