OS: Oracle Enterprise Linux 7.2 (CentOS 7.2) วิธีติดตั้ง MRTG สามารถติดตั้งได้โดยสามารถดูคู่มือที่ ติดตั้ง mrtg บน ubuntu อาจไม่เหมือนกันแต่สามารถทำได้ทำนองเดียวกัน กราฟสำหรับ Idle CPU and Load average, CPU Time spent waiting for IO, Traffic Analysis for eth0, TCP Current Establish สามารถใช้ script เดียวกับลิงค์ในข้อ ๒ ได้เลย สร้างแฟ้ม /etc/mrtg/get-memory.sh มีข้อความว่า #!/bin/bash FREE=$(free |grep “Mem:”|awk ‘{print $7}’) SWAP=$(free |grep “Swap:”|awk ‘{print $3}’) TIME=$(uptime) echo “${FREE}” echo “${SWAP}” echo “$TIME” hostname สร้างแฟ้ม /etc/mrtg/myhost-memory.cfg มีข้อความว่า WorkDir: /var/www/mrtg/myhost Target[myhost-mem]:`/etc/mrtg/get-memory.sh` MaxBytes[myhost-mem]: 20000000000 Title[myhost-mem]: Free Memory and Swap Used PageTop[myhost-mem]: <H1>Free Memory and Swap Used</H1> ShortLegend[myhost-mem]: bytes YLegend[myhost-mem]: bytes LegendI[myhost-mem]: Free Memory: LegendO[myhost-mem]: Swap Used: Legend1[myhost-mem]: Free memory, in bytes Legend2[myhost-mem]: Swap Used, in bytes Options[myhost-mem]: gauge, nopercent, growrightทดสอบสร้างภาพต้นแบบด้วยคำสั่ง env LANG=C /usr/bin/mrtg/myhost-memory.cfgปรับปรุงแฟ้ม index.html ด้วยคำสั่ง indexmaker –column=2 –output=/var/www/mrtg/myhost/index.html /etc/mrtg/myhost-cpu.cfg /etc/mrtg/myhost-cpu-io.cfg /etc/mrtg/myhost-speed-eth0.cfg /etc/mrtg/myhost-tcpestab.cfg /etc/mrtg/myhost-memory.cfg โฟลเดอร์ที่ต้องเฝ้าระวังได้แก่ /u02/app/oracle/adump, /u02/app/oracle/diag/rdbms/regist/regist/alert, /u02/app/oracle/rdbms_trace ซึ่งเป็นโฟลเดอร์สำหรับเก็บ Log ไฟล์ต่างๆ ซึ่งอาจมีขนาดเพิ่มขึ้นจนระบบไม่สามารถให้บริการได้ และโฟลเดอร์ /u03 เป็นโฟลเดอร์ที่ใช้เก็บ archive log (ในกรณีที่ฐานข้อมูลเปิด archive log mode) สร้างแฟ้ม /etc/mrtg/get-diskfree-misc1.sh มีข้อความว่า #!/bin/bash adump=$(du -sm /u02/app/oracle/adump|awk ‘{ print $1 }’) free=$(df -m /u02|grep u02|awk ‘{ print $4 }’) TEMP=$(uptime|grep -o “load average.*”|awk ‘{print $3}’|cut -d’,’ -f 1) LOAD=$(echo “${TEMP:-0} * 100″|bc|cut -d’.’ -f 1) TIME=$(uptime) echo “${adump}” echo “${free}” echo “$TIME” hostname สร้างแฟ้ม /etc/mrtg/myhost-diskfree-misc1.cfg มีข้อความว่า WorkDir: /var/www/mrtg/myhost Target[myhost-misc1]:`/etc/mrtg/get-diskfree-misc1.sh` MaxBytes[myhost-misc1]: 20000000000 Title[myhost-misc1]: Free disk space and disk Used of /u02/app/oracle/adump PageTop[myhost-misc1]: Free disk space and