สารบัญ

ติดตั้ง MRTG บน CentOS ที่ใช้ Directadmin เป็น CP 

การติดตั้งโปรแกรม MRTG บน CentOS ที่ใช้ Directadmin CP
การติดตั้งโปรแกรม MRTG บน CentOS ที่ใช้ Directadmin CP


MRTG คือโปรแกรมทีทำงานอยู่บนโปรโตคอล SNMP ซึ่งเรา ติดตั้ง MRTG Server ไว้เพื่อคอยตรวจข้อมูล ที่ Request และ Respone ผ่าน HTTP ของจากรายการ สถิติของ Network แล้ว MRTG ยังสามารถรายงาน Memory, CPU Load, TCP Connections, Server load average ได้อีกด้วย

วิธีการติดตั้งโปรแกรม MRTG บน CentOS


ในการใช้งาน MRTG เราต้อง snmpd ลงไปด้วยเพื่อไว้ตรวจจับการทำงานของ Network
วิธีการติดตั้ง snmpd กับ mrtg
#yum -y install net-snmp net-snmp-utils mrtg
แก้ไข config ของ  snmpd
#nano /etc/snmp/snmpd.confเพิ่มข้อความ
syslocation  Thailand
syscontact  admin
sysservices 79
rocommunity  public 127.0.0.1
agentaddress 127.0.0.1


ตั้งค่าให้ snmpd ทำงานทุกครั้งเมื่อเปิดเครื่อง
#chkconfig snmpd on*** ถ้าเจอข้อความแจ้ง "Error bash: chkconfig: command not found"
ให้แก้โดย
# rpm -qa |grep chkconfig
chkconfig-1.3.11.1-1

# whereis chkconfig
chkconfig: /sbin/chkconfig /usr/share/man/man8/chkconfig.8.gz
แล้วรันคำสั่งเดิมอีกครั้ง

Start snmpd

#/etc/init.d/snmpd restart



ตั้งค่า config mrtg
แก้ไขไฟล์ /etc/mrtg/mrtg.cfg
#nano /etc/mrtg/mrtg.cfgเพิ่มข้อความ
LoadMIBs: /usr/share/snmp/mibs/UCD-SNMP-MIB.txt,/usr/share/snmp/mibs/TCP-MIB.txt,/usr/share/snmp/mibs/UDP-MIB.txt

WorkDir: /var/www/mrtg

Options[_]: growright

EnableIPv6: no

Target[server.traffic]: 2:[email protected]:
SetEnv[server.traffic]: MRTG_INT_IP="{IP เครื่องของเรา}" MRTG_INT_DESCR="eth0"
MaxBytes[server.traffic]: 125000000
Title[server.traffic]: Traffic Load
PageTop[server.traffic]: <h1>Traffic Load</h1>
Options[server.traffic]: growright, bits

Target[public.estabcons]: tcpCurrEstab.0&tcpCurrEstab.0:[email protected]
Title[public.estabcons]: Currently Established TCP Connections
PageTop[public.estabcons]: <H1>Established TCP Connections</H1>
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

Target[public.memory]: memAvailReal.0&memTotalReal.0:[email protected]
Title[public.memory]: Free Memory
PageTop[public.memory]: <H1>Free Memory</H1>
MaxBytes[public.memory]: 2147483648
ShortLegend[public.memory]: B
YLegend[public.memory]: Bytes
LegendI[public.memory]: Free
LegendO[public.memory]: Total
Legend1[public.memory]: Free memory, not including swap, in bytes
Legend2[public.memory]: Total memory
Options[public.memory]: gauge,growright,nopercent
#kMG[public.memory]: k,M,G,T,P,X
สร้าง folder ไฟล์สำหรับเข้ามาดูสถิติผ่านหน้าเว็บ
#mkdir /var/www/html/mrtg
#indexmaker --columns=2 --output=/var/www/mrtg/index.html /etc/mrtg/mrtg.cfg
แก้ไขไฟล์ เพือชี้ url
#nano /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>

ลองสั่ง
cat /var/log/mrtg.logถ้าไม่มีอะไรผิดพลาดให้ลองเข้า
ลอง สั่ง /etc/init.d/httpd restart เพื่อ restart apache
เข้า Browser พิมพ์ URL
http://{ipเครื่อง}/mrgt
เราก็จะได้กราฟตามต้องการ

Target[public.estabcons]: tcpCurrEstab.0&tcpCurrEstab.0:public@localhost
Title[public.estabcons]: Currently Established TCP Connections
PageTop[public.estabcons]: <H1>Established TCP Connections</H1>
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
กระทู้ล่าสุดจากเว็บบอร์ด
หัวข้อกระทู้
ตอบ
เปิดดู
ล่าสุด
เช็คขนาดพื้นที่ฐานข้อมูล แต่ละก้อน แต่ละฐานข้อมูลว่าใช้พื้นที่ไปเท่าไหร่ ด้วย Comamnd Line
โดย mindphp จ 15 เม.ย. 2024 11:10 pm บอร์ด PostgreSQL
1
22
จ 15 เม.ย. 2024 11:14 pm โดย mindphp View Topic เช็คขนาดพื้นที่ฐานข้อมูล แต่ละก้อน แต่ละฐานข้อมูลว่าใช้พื้นที่ไปเท่าไหร่ ด้วย Comamnd Line
การติดตั้ง WSL เพื่อใช้งาน Linux Terminal บน Windows
โดย tsukasaz ศ 12 เม.ย. 2024 2:25 pm บอร์ด Share Knowledge
0
119
ศ 12 เม.ย. 2024 2:25 pm โดย tsukasaz View Topic การติดตั้ง WSL เพื่อใช้งาน Linux Terminal บน Windows
Super Сasual Dating - Real Women
โดย heroxbay ศ 12 เม.ย. 2024 8:55 am บอร์ด Microsoft Office Knowledge & line & Etc
0
86
ศ 12 เม.ย. 2024 8:55 am โดย heroxbay View Topic Super Сasual Dating - Real Women
Unsurpassed Сasual Dating - True Females
โดย pongsu1968 ศ 12 เม.ย. 2024 5:47 am บอร์ด Microsoft Office Knowledge & line & Etc
0
109
ศ 12 เม.ย. 2024 5:47 am โดย pongsu1968 View Topic Unsurpassed Сasual Dating - True Females
Question Tag ใช้อย่างไรในภาษาอังกฤษ
โดย internTk21 พฤ 11 เม.ย. 2024 10:46 pm บอร์ด Microsoft Office Knowledge & line & Etc
0
57
พฤ 11 เม.ย. 2024 10:46 pm โดย internTk21 View Topic Question Tag ใช้อย่างไรในภาษาอังกฤษ
มารู้จัก Clause in English กันเถอะ
โดย internTk21 พฤ 11 เม.ย. 2024 4:26 pm บอร์ด Microsoft Office Knowledge & line & Etc
0
72
พฤ 11 เม.ย. 2024 4:26 pm โดย internTk21 View Topic มารู้จัก Clause in English กันเถอะ
เรียนรู้การเปลี่ยน single noun เป็น plural noun
โดย internTk21 พฤ 11 เม.ย. 2024 3:29 pm บอร์ด Microsoft Office Knowledge & line & Etc
0
55
พฤ 11 เม.ย. 2024 3:29 pm โดย internTk21 View Topic เรียนรู้การเปลี่ยน single noun เป็น plural noun
แจ้งปัญหา ติดบัคในการลงบทความในเว็บไซต์ Mindphp
โดย internTk21 พฤ 11 เม.ย. 2024 2:38 pm บอร์ด MindPHP News & Feedback
2
95
อ 14 เม.ย. 2024 11:03 am โดย mindphp View Topic แจ้งปัญหา ติดบัคในการลงบทความในเว็บไซต์ Mindphp