OPENBSD上安装SNMP和MRTG

发表于:2007-06-21来源:作者:点击数: 标签:
安装ucd-snmp # pkg_add http://ftp.it.net.au/OpenBSD/3.6/packages/i386/ucd-snmp-4.2.6.tgz 配置ucd-snmp # cp /usr/local/share/examples/ucd-snmp/EXAMPLE.conf /etc/snmpd.conf # vi /usr/local/share/snmp/snmpd.conf 增加如下的内容: rocommunity b

   
  安装ucd-snmp
   
  # pkg_add http://ftp.it.net.au/OpenBSD/3.6/packages/i386/ucd-snmp-4.2.6.tgz

  配置ucd-snmp
   
  # cp /usr/local/share/examples/ucd-snmp/EXAMPLE.conf /etc/snmpd.conf

  # vi /usr/local/share/snmp/snmpd.conf
  增加如下的内容:
  rocommunity  bsd 192.168.0.1
  sysservices 77
  syscontact  llzqq@126.com
  syslocation  hebei,china


  启动snmpd (适用于无PPP网络接口的情况)


  # vi /etc/rc.local


  if [ -x /usr/local/sbin/snmpd ]; then
          /usr/local/sbin/snmpd -c /etc/snmpd.conf
  fi


  启动snmpd (适用于有PPP网络接口的情况)


  # vi /etc/ppp/ppp.linkup


  MYADDR:
  !bg /usr/local/sbin/snmpd -c /etc/snmpd.conf


  注意看看/var/log/snmpd有没有错误日志


  安装mrtg 


  # pkg_add http://ftp.it.net.au/OpenBSD/3.6/packages/i386/mrtg-2.10.13.tgz


  建立工作目录


  # mkdir /var/www/htdocs/mrtg


  生成/etc/mrtg.cfg 


  # cfgmaker --output /etc/mrtg.cfg --global "WorkDir: /var/www/htdocs/mrtg"


  修改/etc/mrtg.cfg加入: 


  #RunAsDaemon:yes
  Options[_]: growright, bits
  EnableIPv6: no
  WorkDir: /var/www/htdocs/mrtg
  WriteExpires: Yes
  Refresh: 300
  Language:chinese


  生成首页面: 


  # indexmaker -output /var/www/htdocs/mrtg/index.html --columns=1 /etc/mrtg.cfg


  设置每5分钟运行一次MRTG


  # crontab -e


  */5 * * * * /usr/local/bin/mrtg --logging=/var/log/mrtg.log /etc/mrtg.cfg


  至此,大功告成。
   
  访问http://IP/mrtg/就可要看到图表了。


  Mrtg的参考配置文件是/usr/local/share/examples/mrtg/mrtg.cfg在配置mrtg时可以参考

原文转自:http://www.ltesting.net