2个命令:
- cfgmaker public@192.168.0.206 public@192.168.0.205 public@192.168.0.233 --global 'WorkDir: /var/www/mrtg/' --global 'Options[_]: growright, bits' --output /etc/mrtg/mrtg_tmp.cfg
- indexmaker /etc/mrtg/mrtg.cfg --output=/var/www/mrtg/index.html
1个 crontab
[/data]#crontab -l
*/5 * * * * LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg
[/data]#
[/etc/mrtg]#more /etc/snmp/snmpd.conf
com2sec local localhost public
com2sec local 127.0.0.1 public
com2sec mynetwork 192.168.0.0/24 public
group MyRWGroup v1 local
group MyRWGroup v2c local
group MyRWGroup usm local
group MyROGroup v1 mynetwork
group MyROGroup v2c mynetwork
group MyROGroup usm mynetwork
view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc
view all included .1 80
access MyROGroup "" any noauth exact mib2 none none
access MyROGroup "" any noauth exact all none none
access MyRWGroup "" any noauth exact all all none
access MyRWGroup "" any noauth exact mib2 none none
com2sec local localhost public
com2sec mynetwork 192.168.0.0/24 public
syslocation Linux6.
syscontact Vivek G Gite <vivek@nixcraft.com>
dontLogTCPWrappersConnects yes
[/etc/mrtg]#
-----------------
{
去掉#之后,行头不能留空
Target[192.168.0.206_1]: 1:public@192.168.0.206:
SetEnv[192.168.0.206_1]: MRTG_INT_IP="127.0.0.1" MRTG_INT_DESCR="lo"
MaxBytes[192.168.0.206_1]: 1250000
Title[192.168.0.206_1]: Traffic Analysis for 1 -- Centos206
PageTop[192.168.0.206_1]: <h1>Traffic Analysis for 1 -- Centos206</h1>
}
[/etc/mrtg]#more mrtg.cfg
# Created by
# /usr/bin/cfgmaker public@192.168.0.206 public@192.168.0.205 public@192.168.0.233 --global "WorkDir: /var/www/mrtg/" --global "Options[_]: growright, bits"
--global "MaxBytes[_]: 1250000" --output /etc/mrtg/mrtg23.cfg
### Global Config Options
# for UNIX
# WorkDir: /home/http/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: Centos206
# Description: Linux Centos206 2.6.32-71.el6.i686 #1 SMP Fri Nov 12 04:17:17 GMT 2010 i686
# Contact: Vivek G Gite <vivek@nixcraft.com>
# Location: Linux6.
######################################################################
### 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
#
Target[192.168.0.206_1]: 1:public@192.168.0.206:
SetEnv[192.168.0.206_1]: MRTG_INT_IP="127.0.0.1" MRTG_INT_DESCR="lo"
MaxBytes[192.168.0.206_1]: 1250000
Title[192.168.0.206_1]: Traffic Analysis for 1 -- Centos206
PageTop[192.168.0.206_1]: <h1>Traffic Analysis for 1 -- Centos206</h1>
<div id="sysdetails">
<table>
<tr>
<td>System:</td>
<td>Centos206 in Linux6.</td>
</tr>
<tr>
<td>Maintainer:</td>
<td>Vivek G Gite <vivek@nixcraft.com></td>
</tr>
<tr>
<td>Description:</td>
<td>lo </td>
</tr>
<tr>
<td>ifType:</td>
<td>softwareLoopback (24)</td>
</tr>
<tr>
<td>ifName:</td>
<td>lo</td>
</tr>
<tr>
<td>Max Speed:</td>
<td>1250.0 kBytes/s</td>
</tr>
<tr>
<td>Ip:</td>
<td>127.0.0.1 (localhost.localdomain)</td>
</tr>
</table>
</div>
### Interface 2 >> Descr: 'eth0' | Name: 'eth0' | Ip: '192.168.0.206' | Eth: '00-0c-29-0d-8a-f7' ###
### The following interface is commented out because:
### * has a speed of 0 which makes no sense
#
Target[192.168.0.206_2]: 2:public@192.168.0.206:
SetEnv[192.168.0.206_2]: MRTG_INT_IP="192.168.0.206" MRTG_INT_DESCR="eth0"
MaxBytes[192.168.0.206_2]: 1250000
Title[192.168.0.206_2]: Traffic Analysis for 2 -- Centos206
PageTop[192.168.0.206_2]: <h1>Traffic Analysis for 2 -- Centos206</h1>
<div id="sysdetails">
<table>
<tr>
<td>System:</td>
<td>Centos206 in Linux6.</td>
</tr>
<tr>
<td>Maintainer:</td>
<td>Vivek G Gite <vivek@nixcraft.com></td>
</tr>
<tr>
<td>Description:</td>
<td>eth0 </td>
</tr>
<tr>
<td>ifType:</td>
<td>ethernetCsmacd (6)</td>
</tr>
<tr>
<td>ifName:</td>
<td>eth0</td>
</tr>
<tr>
<td>Max Speed:</td>
<td>0.0 Bytes/s</td>
</tr>
<tr>
<td>Ip:</td>
<td>192.168.0.206 (Centos206)</td>
</tr>
</table>
</div>
### Interface 3 >> Descr: 'eth1' | Name: 'eth1' | Ip: '192.168.149.206' | Eth: '00-0c-29-0d-8a-01' ###
### The following interface is commented out because:
### * has a speed of 0 which makes no sense
#
# Target[192.168.0.206_3]: 3:public@192.168.0.206:
# SetEnv[192.168.0.206_3]: MRTG_INT_IP="192.168.149.206" MRTG_INT_DESCR="eth1"
# MaxBytes[192.168.0.206_3]: 0
# Title[192.168.0.206_3]: Traffic Analysis for 3 -- Centos206
# PageTop[192.168.0.206_3]: <h1>Traffic Analysis for 3 -- Centos206</h1>
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>Centos206 in Linux6.</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>Vivek G Gite <vivek@nixcraft.com></td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>eth1 </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>ethernetCsmacd (6)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>eth1</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>0.0 Bytes/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>192.168.149.206 ()</td>
# </tr>
# </table>
# </div>
### Interface 4 >> Descr: 'eth2' | Name: 'eth2' | Ip: '' | Eth: '00-0c-29-0d-8a-0b' ###
### The following interface is commented out because:
### * has a speed of 0 which makes no sense
#
# Target[192.168.0.206_4]: 4:public@192.168.0.206:
# SetEnv[192.168.0.206_4]: MRTG_INT_IP="" MRTG_INT_DESCR="eth2"
# MaxBytes[192.168.0.206_4]: 0
# Title[192.168.0.206_4]: Traffic Analysis for 4 -- Centos206
# PageTop[192.168.0.206_4]: <h1>Traffic Analysis for 4 -- Centos206</h1>
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>Centos206 in Linux6.</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>Vivek G Gite <vivek@nixcraft.com></td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>eth2 </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>ethernetCsmacd (6)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>eth2</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>0.0 Bytes/s</td>
# </tr>
# </table>
# </div>
### Interface 5 >> Descr: 'sit0' | Name: 'sit0' | Ip: '' | Eth: '' ###
### The following interface is commented out because:
### * it is administratively DOWN
### * it is operationally DOWN
### * has a speed of 0 which makes no sense
#
# Target[192.168.0.206_5]: 5:public@192.168.0.206:
# SetEnv[192.168.0.206_5]: MRTG_INT_IP="" MRTG_INT_DESCR="sit0"
# MaxBytes[192.168.0.206_5]: 0
# Title[192.168.0.206_5]: Traffic Analysis for 5 -- Centos206
# PageTop[192.168.0.206_5]: <h1>Traffic Analysis for 5 -- Centos206</h1>
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>Centos206 in Linux6.</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>Vivek G Gite <vivek@nixcraft.com></td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>sit0 </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>Encapsulation Interface (131)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>sit0</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>0.0 Bytes/s</td>
# </tr>
# </table>
# </div>
######################################################################
# System: VG
# Description: Hardware: x86 Family 15 Model 107 Stepping 1 AT/AT COMPATIBLE - Software: Windows Version 5.2 (Build 3790 Uniprocessor Free)
# Contact:
# Location:
######################################################################
### Interface 1 >> Descr: 'MS-TCP-Loopback-interface' | Name: '' | Ip: '127.0.0.1' | Eth: '' ###
### The following interface is commented out because:
### * it is a Software Loopback interface
#
# Target[192.168.0.205_1]: 1:public@192.168.0.205:
# SetEnv[192.168.0.205_1]: MRTG_INT_IP="127.0.0.1" MRTG_INT_DESCR="MS-TCP-Loopback-interface"
# MaxBytes[192.168.0.205_1]: 1250000
# Title[192.168.0.205_1]: Traffic Analysis for 1 -- VG
# PageTop[192.168.0.205_1]: <h1>Traffic Analysis for 1 -- VG</h1>
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>VG in </td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td></td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>MS-TCP-Loopback-interface </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>softwareLoopback (24)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td></td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>1250.0 kBytes/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>127.0.0.1 (localhost.localdomain)</td>
# </tr>
# </table>
# </div>
### Interface 2 >> Descr: 'Microsoft-Loopback-Adapter' | Name: '' | Ip: '121.207.253.49' | Eth: '02-00-4c-4f-4f-50' ###
Target[192.168.0.205_2]: 2:public@192.168.0.205:
SetEnv[192.168.0.205_2]: MRTG_INT_IP="121.207.253.49" MRTG_INT_DESCR="Microsoft-Loopback-Adapter"
MaxBytes[192.168.0.205_2]: 1250000
Title[192.168.0.205_2]: Traffic Analysis for 2 -- VG
PageTop[192.168.0.205_2]: <h1>Traffic Analysis for 2 -- VG</h1>
<div id="sysdetails">
<table>
<tr>
<td>System:</td>
<td>VG in </td>
</tr>
<tr>
<td>Maintainer:</td>
<td></td>
</tr>
<tr>
<td>Description:</td>
<td>Microsoft-Loopback-Adapter </td>
</tr>
<tr>
<td>ifType:</td>
<td>ethernetCsmacd (6)</td>
</tr>
<tr>
<td>ifName:</td>
<td></td>
</tr>
<tr>
<td>Max Speed:</td>
<td>1250.0 kBytes/s</td>
</tr>
<tr>
<td>Ip:</td>
<td>121.207.253.49 ()</td>
</tr>
</table>
</div>
### Interface 131076 >> Descr: 'Intel(R)-PRO/1000-MT-Network-Connection' | Name: '' | Ip: '192.168.0.205' | Eth: '00-0c-29-57-40-16' ###
Target[192.168.0.205_131076]: 131076:public@192.168.0.205:
SetEnv[192.168.0.205_131076]: MRTG_INT_IP="192.168.0.205" MRTG_INT_DESCR="Intel(R)-PRO/1000-MT-Network-Connection"
MaxBytes[192.168.0.205_131076]: 125000000
Title[192.168.0.205_131076]: Traffic Analysis for 131076 -- VG
PageTop[192.168.0.205_131076]: <h1>Traffic Analysis for 131076 -- VG</h1>
<div id="sysdetails">
<table>
<tr>
<td>System:</td>
<td>VG in </td>
</tr>
<tr>
<td>Maintainer:</td>
<td></td>
</tr>
<tr>
<td>Description:</td>
<td>Intel(R)-PRO/1000-MT-Network-Connection </td>
</tr>
<tr>
<td>ifType:</td>
<td>ethernetCsmacd (6)</td>
</tr>
<tr>
<td>ifName:</td>
<td></td>
</tr>
<tr>
<td>Max Speed:</td>
<td>125.0 MBytes/s</td>
</tr>
<tr>
<td>Ip:</td>
<td>192.168.0.205 ()</td>
</tr>
</table>
</div>
######################################################################
# System: FJLTDAS
# Description: Linux FJLTDAS 2.6.18-238.el5 #1 SMP Thu Jan 13 16:24:47 EST 2011 i686
# Contact: Vivek G Gite <vivek@nixcraft.com>
# Location: Linux6.
######################################################################
### 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
#
# Target[192.168.0.233_1]: 1:public@192.168.0.233:
# SetEnv[192.168.0.233_1]: MRTG_INT_IP="127.0.0.1" MRTG_INT_DESCR="lo"
# MaxBytes[192.168.0.233_1]: 1250000
# Title[192.168.0.233_1]: Traffic Analysis for 1 -- FJLTDAS
# PageTop[192.168.0.233_1]: <h1>Traffic Analysis for 1 -- FJLTDAS</h1>
# <div id="sysdetails">
# <table>
# <tr>
# <td>System:</td>
# <td>FJLTDAS in Linux6.</td>
# </tr>
# <tr>
# <td>Maintainer:</td>
# <td>Vivek G Gite <vivek@nixcraft.com></td>
# </tr>
# <tr>
# <td>Description:</td>
# <td>lo </td>
# </tr>
# <tr>
# <td>ifType:</td>
# <td>softwareLoopback (24)</td>
# </tr>
# <tr>
# <td>ifName:</td>
# <td>lo</td>
# </tr>
# <tr>
# <td>Max Speed:</td>
# <td>1250.0 kBytes/s</td>
# </tr>
# <tr>
# <td>Ip:</td>
# <td>127.0.0.1 (localhost.localdomain)</td>
# </tr>
# </table>
# </div>
### Interface 2 >> Descr: 'eth0' | Name: 'eth0' | Ip: '192.168.0.233' | Eth: '08-00-27-5a-cd-98' ###
Target[192.168.0.233_2]: 2:public@192.168.0.233:
SetEnv[192.168.0.233_2]: MRTG_INT_IP="192.168.0.233" MRTG_INT_DESCR="eth0"
MaxBytes[192.168.0.233_2]: 125000000
Title[192.168.0.233_2]: Traffic Analysis for 2 -- FJLTDAS
PageTop[192.168.0.233_2]: <h1>Traffic Analysis for 2 -- FJLTDAS</h1>
<div id="sysdetails">
<table>
<tr>
<td>System:</td>
<td>FJLTDAS in Linux6.</td>
</tr>
<tr>
<td>Maintainer:</td>
<td>Vivek G Gite <vivek@nixcraft.com></td>
</tr>
<tr>
<td>Description:</td>
<td>eth0 </td>
</tr>
<tr>
<td>ifType:</td>
<td>ethernetCsmacd (6)</td>
</tr>
<tr>
<td>ifName:</td>
<td>eth0</td>
</tr>
<tr>
<td>Max Speed:</td>
<td>125.0 MBytes/s</td>
</tr>
<tr>
<td>Ip:</td>
<td>192.168.0.233 ()</td>
</tr>
</table>
</div>
WorkDir: /var/www/mrtg/
Options[_]: growright, bits
[/etc/mrtg]#

本文介绍了MRTG在网络流量监控中的配置与使用方法。详细展示了针对不同主机的配置细节,包括目标设置、环境变量、最大流量限制及图表标题等。同时提供了Crontab任务示例,用于定期执行MRTG更新。
9120

被折叠的 条评论
为什么被折叠?



