How to install MRTG on CentOS 6.5

Standard

ก่อนอื่นก็ต้อง yum กันก่อนหลักๆคือ mrtg, snmp, http, cron, ในส่วนนี้เหลือแต่ mrtg และ snmp

yum install mrtg net-snmp net-snmp-utils

แก้ในส่วนของ snmp.conf

# Here is a commented out example configuration that allows less
# restrictive access.

##       sec.name  source          community
com2sec  local     localhost       public

##     group.name sec.model  sec.name
group MyRWGroup v1         local
group MyRWGroup v2c        local
group MyRWGroup usm        local

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

## context             sec.model sec.level prefix read   write  notif
access MyRWGroup ""    any       noauth    exact  all    all    none

start and turn on run level snmpd service:

chkconfig snmpd on
service snmpd restart

ทดสอบว่าเจอ interface และ ip นั้นๆ

snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex

create mrtg.cfg by this command:

cfgmaker --global 'WorkDir: /var/www/mrtg' --global 'Options[_]: bits,growright' --no-down --zero-speed=1000000000 --noreversedns --output /etc/mrtg/mrtg.cfg --ifdesc=name --snmp-options=:::::2 public@localhost

สุดท้ายใช้คำสั่ง indexmaker เพื่อ create web pages:

indexmaker /etc/mrtg/mrtg.cfg > /var/www/mrtg/index.html

Verify Cronjob

cat /etc/cron.d/mrtg

 

ถ้าหากเข้าในหน้า http:///mrtg/ ไม่ได้เพราะ permission ให้เข้าไปแก้ httpd.conf

   
 
    Order allow,deny
    Allow from all
    Allow from 127.0.0.1
    Allow from ::1

 

REF:
http://www.cyberciti.biz/faq/centos-fedora-linux-multi-router-traffic-grapher-tutorial/
http://www.icez.net/blog/28/ลง-mrtg-บน-centosfedora-แบบง่ายๆ
http://www.pmoghadam.com/homepage/HTML/MRTG-cpu-mem-hdd-linux.html
https://wiki.archlinux.org/index.php/Multi_Router_Traffic_Grapher
http://net-snmp.sourceforge.net/tutorial/tutorial-4/mrtg/

Leave a Reply

Your email address will not be published. Required fields are marked *