วันพฤหัสบดีที่ 1 มีนาคม พ.ศ. 2555

การติดตั้ง mrtg on Centos

1. ติดตั้ง mrtg

#yum install mrtg net-snmp net-snmp-utils

2. เปิด snmpd

#chkconfig snmpd on
#service snmpd start



3. config mrtg

#cfgmaker --global "WorkDir: /var/www/mrtg" --global "Options[_]: growright,bits" --ifref=name public@localhost > /etc/mrtg/mrtg.cfg

ให้ แก้ไขไฟล์ /etc/mrtg/mrtg.cfg โดยเพิ่มข้อมูลดังนี้


### Load CPU Average ###
Target[cpu]: .1.3.6.1.4.1.2021.10.1.5.1&.1.3.6.1.4.1.2021.10.1.5.2:public@localhost
MaxBytes[cpu]: 100
Unscaled[cpu]: dwmy
Options[cpu]: gauge, absolute, growright, noinfo, nopercent
YLegend[cpu]: CPU Load(%)
ShortLegend[cpu]: (%)
LegendI[cpu]:   CPU System
LegendO[cpu]:   CPU User
Title[cpu]: CPU Analysis
PageTop[cpu]:

CPU Analysis



### Memory Free ###
Target[mem]: .1.3.6.1.4.1.2021.4.6.0&.1.3.6.1.4.1.2021.4.4.0:public@localhost
MaxBytes1[mem]: 8362754048
MaxBytes2[mem]: 8587182080
#Unscaled[mem]: dwmy
Options[mem]: gauge, absolute, growright, noinfo
YLegend[mem]: Memory Free
ShortLegend[mem]: Bytes
#kilo[mem]: 1024
#kMG[mem]: G
LegendI[mem]: Real
LegendO[mem]: Swap
Legend1[mem]: (MBytes)
Legend2[mem]: (MBytes)
Title[mem]: Memory Analysis
PageTop[mem]:

Free Memory Analysis




### Established TCP Connections ###
Target[public.newconns]: tcpPassiveOpens.0&tcpActiveOpens.0:public@localhost
Title[public.newconns]: Newly Created TCP Connections
PageTop[public.newconns]:

New TCP Connections


MaxBytes[public.newconns]: 10000000000
ShortLegend[public.newconns]: c/s
YLegend[public.newconns]: Conns / Min
LegendI[public.newconns]: In
LegendO[public.newconns]: Out
Legend1[public.newconns]: New inbound connections
Legend2[public.newconns]: New outbound connections
Options[public.newconns]: growright,nopercent,perminute

### Established TCP Connections ###
Target[public.estabcons]: tcpCurrEstab.0&tcpCurrEstab.0:public@localhost
Title[public.estabcons]: Currently Established TCP Connections
PageTop[public.estabcons]:

Established TCP Connections


MaxBytes[public.estabcons]: 10000000000
ShortLegend[public.estabcons]:
YLegend[public.estabcons]: Connections
LegendI[public.estabcons]: In
LegendO[public.estabcons]:
Legend1[public.estabcons]: Established connections
Legend2[public.estabcons]:
Options[public.estabcons]: growright,nopercent,gauge

4. Gen ไฟล์ index.html

indexmaker --columns=2 --sort=title --output=/var/www/mrtg/index.html /etc/mrtg/mrtg.cfg

5. ให้เรียก mrtg ผ่าน web ได้

#nano /etc/httpd/conf.d/mrtg.conf

เพิ่มใน Allow from all #add by attasit


Order deny,allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
# Allow from .example.com
Allow from all #add by attasit


6. restart apache

#service httpd restart

7. ทดสอบเรียกหน้า web]

http://ip-address/mrtg