`

mrtg snmp监控网络流量的简单安装配置文档

阅读更多

mrtg snmp安装配置文档

1、net-snmp安装在被监测的机器上,并启动服务。
2、mrtg安装在提供web服务的机器上,放在计划任务里,定时向被监测的机器获取信息
3、当然提供web服务是需要web服务器的,简单的httpd就可以了。


================centOS 安装net-snmp 和 mrtg ======================================
参考文档:
http://wiki.centos.org/TipsAndTricks/MRTG
http://oss.oetiker.ch/mrtg/
http://oss.oetiker.ch/mrtg/doc/mrtg-unix-guide.en.html
http://wiki.centos.org/TipsAndTricks/MRTG

我的实践:
1、如果没有apache httpd请安装
yum install httpd

2、yum -y install mrtg

3、yum -y install net-snmp-utils


4、vi /etc/snmp/snmpd.conf
{

4.1、取消下面的注释
#view mib2   included  .iso.org.dod.internet.mgmt.mib-2 fc
4、2
#       group          context sec.model sec.level prefix read   write  notif
access  notConfigGroup ""      any       noauth    exact  systemview none none
修改为
access  notConfigGroup ""      any       noauth    exact  mib2 none none

}

5、/etc/init.d/snmpd start

6、cfgmaker --global 'WorkDir: /var/www/mrtg'  \
          --global 'Options[_]: bits,growright' \
          --output /var/www/mrtg/mrtg.cfg    \
           public@192.168.0.129;

这第6步需要说明,这里会生成配置文件
web服务目录:WorkDir: /var/www/mrtg
单位等:Options[_]: bits,growright
配置文件生成位置:output /var/www/mrtg/mrtg.cfg (我方这里很不明智,会暴露配置http://192.168.0.129/mrtg/mrtg.cfg,不过也不关紧要,要求高的话可以换个地方)

在mrtg.cfg中,举个监控某网卡的例子:
{{{

Target[192.168.0.129_2]: 2:public@192.168.0.129:
SetEnv[192.168.0.129_2]: MRTG_INT_IP="192.168.0.129" MRTG_INT_DESCR="eth0"
MaxBytes[192.168.0.129_2]: 12500000
Title[192.168.0.129_2]: Traffic Analysis for 192.168.0.129 -- eth0
PageTop[192.168.0.129_2]: <h1>Traffic Analysis for 192.168.0.129 -- eth0</h1>
                <div id="sysdetails">
                        <table>
                                <tr>
                                        <td>System:</td>
                                        <td>nfs129 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>eth0</td>
                                </tr>
                                <tr>
                                        <td>Max Speed:</td>
                                        <td>100.0 Mbits/s</td>
                                </tr>
                                <tr>
                                        <td>Ip:</td>
                                        <td>192.168.0.129 (home0.hadoop)</td>
                                </tr>
                        </table>
                </div>

}}}
想监控安装了snmpd服务的机器,可以仿照上面的写法增加。

7、indexmaker --output=/var/www/mrtg/index.html /var/www/mrtg/mrtg.cfg
这是生成页面的,每次配置改变了,可以执行这个,或者手动去改也行(按照里面的格式)。

8、执行三次(报错不管)
env LANG=C /usr/bin/mrtg /var/www/mrtg/mrtg.cfg
env LANG=C /usr/bin/mrtg /var/www/mrtg/mrtg.cfg
env LANG=C /usr/bin/mrtg /var/www/mrtg/mrtg.cfg

9、crontab -e
 */2 * * * *  /usr/bin/mrtg /var/www/mrtg/mrtg.cfg --logging /var/log/mrtg.log

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

{{{
Alias /mrtg /var/www/mrtg

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

}}}

11、访问http://192.168.0.129/mrtg 就可以看见监控页面。


================gentoo 安装snmpd服务======================================
# emerge mrtg
emerge net-snmp


# cp /etc/snmp/snmpd.conf.example /etc/snmp/snmpd.conf
nano /etc/snmp/snmpd.conf
{{{
#       sec.name  source          community
com2sec notConfigUser  default       public
com2sec local     localhost       COMMUNITY
com2sec mynetwork NETWORK/24      COMMUNITY

#               sec.model  sec.name
group   notConfigGroup v1           notConfigUser
group MyRWGroup v1         local
group MyRWGroup v2c        local
group MyRWGroup usm        local
group MyROGroup v1         mynetwork
group MyROGroup v2c        mynetwork
group MyROGroup usm        mynetwork

#           incl/excl subtree                          mask
view all    included  .1                               80

#                context sec.model sec.level match  read   write  notif
access  notConfigGroup ""      any       noauth    exact  mib2 none none
access MyROGroup ""      any       noauth    exact  all    none   none
access MyRWGroup ""      any       noauth    exact  all    all    none

# -----------------------------------------------------------------------------
# status of notWritable.
view mib2   included  .iso.org.dod.internet.mgmt.mib-2 fc

syslocation Right here, right now.
syscontact Me <me@somewhere.org>

#  Make sure mountd is running
proc mountd

#  Make sure there are no more than 4 ntalkds running, but 0 is ok too.
proc ntalkd 4

#  Make sure at least one sendmail, but less than or equal to 10 are running.
proc sendmail 10 1

# a simple hello world
exec echotest /bin/echo hello world

#exec shelltest /bin/sh /tmp/shtest

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

disk / 10000

# Check for loads:
load 12 14 14

}}}


/etc/init.d/snmpd start

0
1
分享到:
评论

相关推荐

    MRTG.rar_MRTG_应用 网络流量 监控_流量统计_监控交换机_网络流量统计

    MRTG(MultiRouter Traffic Grapher, MRTG)是基于SNMP的典型网络流量统计分析工具。它不仅耗用的系统资源小,而且是完全免费的。它通过SNMP协议从设备得到其流量信息,并将流量负载以包含JPEG格式图形的HTML文档的...

    mrtg网络监控

    MRTG(Multi Router Traffic Grapher),通常讲是一个监控网络链路流量负载的开源软件,它可以从所有运行SNMP协议的设备上(包括服务器、路由器、交换机等)抓取信息。事实 上它不仅可以监控网络设备,任何其它的支持...

    mrtg网络流量v2.15.2绿色版

    MRTG(Multi Router Traffic Grapher),通常讲是一个监控网络链路流量负载的开源软件,它可以从所有运行SNMP协议的设备上(包括服务器、路由器、交换机等)抓取信息。事实 上它不仅可以监控网络设备,任何其它的支持...

    MRTG安装文档

    MRTG(Multi Router Traffic Grapher),通常讲是一个监控网络链路流量负载的开源软件,它可以从所有运行SNMP协议的设备上(包括服务器、路由器、交换机等)抓取信息。事实 上它不仅可以监控网络设备,任何其它的支持...

    网络监控mrtg实施细则

    Mrtg(Multi Router Traffic Grapher,MRTG)是一个监控网络链路流量负载的工具软件, 它通过snmp协议从设备得到设备的流量信息,并将流量负载以包含PNG格式的图形的HTML 文档方式显示给用户,以非常直观的形式显示流量...

    MRTG的高级使用

    MRTG(Multi Router Traffic Grapher),通常讲是一个监控网络链路流量负载的开源软件,它可以从所有运行SNMP协议的设备上(包括服务器、路由器、交换机等)抓取信息。事实 上它不仅可以监控网络设备,任何其它的支持...

    Windows版MRTG安裝

    Mrtg (Multi Router Traffic Grapher,MRTG) 是一个监控网络链路流量负载的工具软件,它可以从所有运行SNMP协议的设备(包括服务器、路由器、交换机等)抓取到信息,并自动生成包含PNG格式的图形以HTML文档方式显示给...

    mrtg 网络分析

    一个监控网络链路流量负载的工具软件,利用snmp协议得到设备的流量信息,并将流量负载以包含PNG格式的图形的HTML 文档方式显示给用户,用非常直观的形式显示

    mrtg文档 windows系统下的(带软件和自配批处理文件)

    Mrtg(Multi Router Traffic Grapher,MRTG)是一个监控网络链路流量负载的工具软件,它通过snmp协议从设备得到设备的流量信息,并将流量负载以包含PNG格式的图形的HTML文档方式显示给用户,以非常直观的形式显示流量...

    mrtg-2.17.2.zip

    -MRTG是一个监控网络链路流量负载的工具软件,通过snmp协议得到设备的流量信息,并将流量负载以包含PNG格式的图形的HTML 文档方式显示给用户,以非常直观的形式显示流量负载

    WINMRTG下载

    选择“简单网络管理协议( SNMP ) ”安装: 安装的过程中,如果本地没有“ I386 ”文件的话,就要插入光盘,系统才能继续安装组件。 6. 打开“控制面板” \ “管理工具” \ “服务” ,选在“ SNMP 服务” ...

Global site tag (gtag.js) - Google Analytics