免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1112 | 回复: 0
打印 上一主题 下一主题

mrtg [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-12-22 15:29 |只看该作者 |倒序浏览
MRTG的安装:
1、需要的套件 net-snmp    libpng  libpng-devel  gd zlib   mrtg

2、首先设置snmpd.conf  (/etc/snmp/snmpd.conf)  ,注意以下几项设置:
   
   ####
# First, map the community name "public" into a "security name"
#       sec.name  source          community
# com2sec notConfigUser  default       public
com2sec mynetwork  192.168.92.68       mymrtg
####
# Second, map the security name into a group name:
#       groupName      securityModel securityName
# group   notConfigGroup v1           notConfigUser
# group   notConfigGroup v2c           notConfigUser
group   notConfigGroup v1           mynetwork
group   notConfigGroup 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.2
view    systemview    included   .1.3.6.1.2.1.25.1.1
####
# Finally, grant the group read-only access to the systemview view.
#       group          context sec.model sec.level prefix read   write
##           incl/excl subtree                          mask
#view all    included  .1                               80
view all    included  .1                               80
## -or just the mib2 tree-

## -or just the mib2 tree-35414912
#view mib2   included  .iso.org.dod.internet.mgmt.mib-2 fc
view mib2   included  .iso.org.dod.internet.mgmt.mib-2 fc
##                context sec.model sec.level prefix read   writ
notif
#access  notConfigGroup ""      any       noauth    exact  roview rwview
none
access  notConfigGroup ""      any       noauth    exact  mib2 none
none

3、service snmpd start
4、测试 snmpwalk -c mymrtg -v 1 192.168.92.68

5、制作MRTG
   cfgmaker
mymrtg@192.168.92.68
> /etc/mrtg/mrtg.cfg
  修改mrtg.cfg   vi /etc/mrtg/mrtg.cfg

     Workdir: /var/www/html/mrtg
     Options[ ]: growright
     Refresh: 300
     Interval: 5
    Language:gb2312
6、执行 env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg (连结执行三次,最后没有错误出现,要将这一条命令放到计划中,假设每5分钟执行一次 */5 * * * * root env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg)
(如果你认为有必要,请注解掉/etc/httpd/conf.d/mrtg.conf的值)
7、产生index.html:
   indexmaker --columns=1 --output=/var/www/html/mrtg/index.hmtl --title='traffic info' /etc/mrtg/mrtg.cfg

(想简单也可以这样 indexmaker /etc/mrtg/mrtg.cfg > /var/www/html/index.html)

8、修改/etc/httpd/conf/httpd.conf的值,因为mrtg不支持UTF-8,找到AddDefaultCharset UTF-8改为AddDefaultCharset gb2312





本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/88611/showart_1734699.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP