15 Juli 2005

MRTG untuk monitoring Proxy Squid

Nama : Marah sakti Lubis


Jika di tempat anda menggunakan squid sebagai proxy server dan anda ingin mengetahui utilisasi atau pun performance dari squid proxy tersebut, anda bisa menggunakan MRTG sebagai tools untuk memonitoring Squid Proxy anda. Saya asumsikan anda sekalian telah meng-install squid dengan option "--enable-snmp". Jika anda belum meng-installnya, anda harus mengcompile ulang squid anda dengan tambahan option "--enable-snmp". Jika module ini sudah terinstall, anda tinggal meng-edit di file squid.conf anda seperti dibawah ini:

#Squid SNMP Configuration
snmp_port 3401
acl TESTSNMP src 192.168.8.0/255.255.255.0 <--saya asumsikan network anda adalah 192.138.8.0-->
acl snmppublic snmp_community public
snmp_access allow snmppublic TESTSNMP

setelah itu restart lah squid anda dan sekarang squid anda telah siap untuk dimonitor dengan MRTG.

Langkah berikutnya adalah menyiapkan mrtg itu sendiri. Untuk mendapatkan tools ini, anda dapat mendownloadnya dari website MRTG

Setelah itu, langkah berikutnya adalah:
# tar -zxvf mrtg-2.9.17.tar.gz
# cd mrtg-2.9.17
# ./configure --prefix=/usr/local/mrtg
# make
# make install

Ok, sekarang MRTG anda telah terinstall di box anda dan siap digunakan. Saya asumsikan bahwa box anda sudah terinstall aplikasi web server, misalnya apache web server atau aplikasi web server lainnya. Jika belum, install lah aplikasi
web server di box anda, agar report yang dihasilkan oleh MRTG ini dapat di analisa dengan baik.

Langkah selanjutnya, anda harus membuat sebuah config file yang akan digunakan oleh MRTG ini agar dapat berhubungan dengan squid proxy server anda. Anda dapat menggunakan editor "vi" untuk membuat file ini, e.g.: vi mrtg-squid.conf kemudian isi mrtg-squid.conf itu sendiri seperti dibawah ini:

WorkDir: /usr/local/apache/htdocs/web/squid **tempat dimana file index.html dicreate oleh mrtg-squid.conf**
WriteExpires: Yes

LoadMIBs: /usr/local/mrtg/squid/mib.txt **file mib.txt ini dihasilkan pada saat mengcompile squid dengan option "--enable-snmp"**

Options[^]: growright
WithPeak[^]: y

MaxBytes[_]: 30000000

Target[proxy-hit]: 1.3.6.1.4.1.3495.1.3.2.1.2&1.3.6.1.4.1.3495.1.3.2.1.1:public@
192.168.8.1:3401
Title[proxy-hit]: HTTP Hits
PageTop[proxy-hit]:

HTTP Hits / Requests


#Suppress[proxy-hit]: y
LegendI[proxy-hit]: HTTP hits
LegendO[proxy-hit]: HTTP requests
Legend1[proxy-hit]: HTTP hits
Legend2[proxy-hit]: HTTP requests
YLegend[proxy-hit]: perminute
ShortLegend[proxy-hit]: req/min
Options[proxy-hit]: nopercent, perminute, dorelpercent

Target[proxy-requests]: 1.3.6.1.4.1.3495.1.3.2.1.11&1.3.6.1.4.1.3495.1.3.2.1.10:
public@192.168.8.1:3401
Title[proxy-requests]: Cache Server Errors / Requests
PageTop[proxy-requests]:

Server Errors / Requests


#Suppress[proxy-requests]: y
LegendI[proxy-requests]: Errors
LegendO[proxy-requests]: Requests
Legend1[proxy-requests]: Errors
Legend2[proxy-requests]: Requests
YLegend[proxy-requests]: per minute
ShortLegend[proxy-requests]: 1/min
Options[proxy-requests]: nopercent, perminute, dorelpercent

Target[proxy-srvkbinout]: 1.3.6.1.4.1.3495.1.3.2.1.12&1.3.6.1.4.1.3495.1.3.2.1.1
3:public@192.168.8.1:3401
Title[proxy-srvkbinout]: Cache Server Traffic In / Out
PageTop[proxy-srvkbinout]:

Server traffic volume (In/Out)


#Suppress[proxy-srvkbinout]: y
LegendI[proxy-srvkbinout]: Traffic In
LegendO[proxy-srvkbinout]: Traffic Out
Legend1[proxy-srvkbinout]: Traffic In
Legend2[proxy-srvkbinout]: Traffic Out
YLegend[proxy-srvkbinout]: per minute
ShortLegend[proxy-srvkbinout]: b/min
#ShortLegend[proxy-srvkbinout]: kb/min
kilo[proxy-srvkbinout]: 1024
kMG[proxy-srvkbinout]: k,M,G,T
Options[proxy-srvkbinout]: nopercent, perminute

Target[proxy-httpsvc]: 1.3.6.1.4.1.3495.1.3.2.2.1.2.5&1.3.6.1.4.1.3495.1.3.2.2.1
.2.5:public@192.168.8.1:3401
Title[proxy-httpsvc]: HTTP svc
PageTop[proxy-httpsvc]:

HTTP Median Service Time (5 min)


#Suppress[proxy-httpsvc]: y
LegendI[proxy-httpsvc]: HTTP 5min svc
LegendO[proxy-httpsvc]:
Legend1[proxy-httpsvc]: HTTP 5 min cache Median Service Time
Legend2[proxy-httpsvc]:
YLegend[proxy-httpsvc]: msec
ShortLegend[proxy-httpsvc]: ms
Options[proxy-httpsvc]: nopercent, gauge

Target[proxy-mem]: 1.3.6.1.4.1.3495.1.3.1.4&1.3.6.1.4.1.3495.1.3.1.4:public@192.
168.8.1:3401
Title[proxy-mem]: Cache Mem Usage
PageTop[proxy-mem]:

Cache Mem Usage


MaxBytes[proxy-mem]: 100000
#Suppress[proxy-mem]: y
ShortLegend[proxy-mem]: Byte
LegendI[proxy-mem]: CacheMemUsage
LegendO[proxy-mem]:
Legend1[proxy-mem]: CacheMemUsage
Legend2[proxy-mem]:
YLegend[proxy-mem]: Byte
Options[proxy-mem]: gauge, nopercent, perhour

Target[cacheRequestHitRatio]: cacheRequestHitRatio.5&cacheRequestHitRatio.60:pub
lic@192.168.8.1:3401
MaxBytes[cacheRequestHitRatio]: 100
AbsMax[cacheRequestHitRatio]: 100
Title[cacheRequestHitRatio]: Request Hit Ratio
Options[cacheRequestHitRatio]: absolute, gauge, noinfo, growright, nopercent
Unscaled[cacheRequestHitRatio]: dwmy
PageTop[cacheRequestHitRatio]:

Request Hit Ratio


YLegend[cacheRequestHitRatio]: %
ShortLegend[cacheRequestHitRatio]: %
LegendI[cacheRequestHitRatio]: Median Hit Ratio (5min)
LegendO[cacheRequestHitRatio]: Median Hit Ratio (60min)
Legend1[cacheRequestHitRatio]: Median Hit Ratio
Legend2[cacheRequestHitRatio]: Median Hit Ratio

Target[cacheRequestByteRatio]: cacheRequestByteRatio.5&cacheRequestByteRatio.60:
public@192.168.8.1:3401
MaxBytes[cacheRequestByteRatio]: 100
AbsMax[cacheRequestByteRatio]: 100
Title[cacheRequestByteRatio]: Byte Hit Ratio
Options[cacheRequestByteRatio]: absolute, gauge, noinfo, growright, nopercent
Unscaled[cacheRequestByteRatio]: dwmy
PageTop[cacheRequestByteRatio]:

Byte Hit Ratio


YLegend[cacheRequestByteRatio]: %
ShortLegend[cacheRequestByteRatio]:%
LegendI[cacheRequestByteRatio]: Median Hit Ratio (5min)
LegendO[cacheRequestByteRatio]: Median Hit Ratio (60min)
Legend1[cacheRequestByteRatio]: Median Hit Ratio
Legend2[cacheRequestByteRatio]: Median Hit Ratio

Target[cacheCpuTime]: cacheCpuTime&cacheCpuTime:public@192.168.8.1:3401
MaxBytes[cacheCpuTime]: 1000000000
Title[cacheCpuTime]: Cpu Time
Options[cacheCpuTime]: gauge, growright, nopercent
PageTop[cacheCpuTime]:

Amount of cpu seconds consumed


YLegend[cacheCpuTime]: cpu seconds
ShortLegend[cacheCpuTime]: cpu seconds
LegendI[cacheCpuTime]: Mem Time
LegendO[cacheCpuTime]:
Legend1[cacheCpuTime]: Mem Time
Legend2[cacheCpuTime]:

**asumsi proxy server anda ip nya 192.168.8.1, anda bisa juga menulis localhost**

Setelah itu save lah file tersebut dan keluar dari editor vi dengan command ":wq!" dan sekarang anda kembali lagi ke prompt semula.

Sekarang kita telah melakukan 3 hal, yaitu installasi squid dengan option --enable-snmp, kemudian installasi mrtg, dan membuat mrtg config file untuk memonitor squid proxy server anda.

Langkah selanjutnya adalah membuat file index nya agar dapat ditampilkan pada web browser anda. Untuk itu kita lakukan:
# ./indexmaker mrtg-squid.conf > /usr/local/apache/htdocs/web/squid/index.html **sesuai dengan workdir anda**

Kemudian, sekarang anda jalankan mrtg anda dengan membuat cron job agar MRTG tersebut dapat melakukan polling sesuai dengan keinginan anda, misalnya setiap 5 menit sekali atau 10 menit sekali:
crontab -e
#mrtg polling every 5 minutes
*/5 * * * * /usr/local/mrtg/bin/mrtg /usr/local/mrtg/bin/mrtg-squid.conf

Kemudian save cron job tersebut dan kembail ke prompt awal.

Sekarang anda tinggal membuka web browser dan selamat memonitor squid proxy anda. Untuk mendapatkan informasi yang lebih lengkap mengenai MRTG, silahkan anda mengakses http://people.ee.ethz.ch/~oetiker/webtools/mrtg

notes: you can modify your index.html with your pleasure and please correct me if i wrong..thx..:)

Tidak ada komentar: