Archive for the ‘Linux’ Category

0082 | MRTG สำหรับจับการทำงานของ squid

Wednesday, November 4th, 2009 Posted in Linux, Web Server | 4 Comments »

แก้ squid.conf นิดหน่อย

acl snmppublic snmp_community public
snmp_port 3401
snmp_access allow snmppublic localhost
snmp_access deny all

แล้วเอาไอ้นี่ใส่ mrtg.cfg

LoadMIBs: /etc/squid/mib.txt
 
Target[cacheServerRequests]: cacheServerRequests&cacheServerRequests:public@localhost:3401
MaxBytes[cacheServerRequests]: 10000000
Title[cacheServerRequests]: Server Requests @ localhost
Options[cacheServerRequests]: growright, nopercent
PageTop[cacheServerRequests]: <h1>Server Requests @ localhost</h1>
YLegend[cacheServerRequests]: requests/sec
ShortLegend[cacheServerRequests]: req/s
LegendI[cacheServerRequests]: Requests&nbsp;
LegendO[cacheServerRequests]:
Legend1[cacheServerRequests]: Requests
Legend2[cacheServerRequests]:
 
Target[cacheProtoClientHttpRequests]: cacheProtoClientHttpRequests&cacheProtoClientHttpRequests:public@localhost:3401
MaxBytes[cacheProtoClientHttpRequests]: 10000000
Title[cacheProtoClientHttpRequests]: Client Http Requests @ localhost
Options[cacheProtoClientHttpRequests]: growright, nopercent
PageTop[cacheProtoClientHttpRequests]: <h1>Client Http Requests @ localhost</h1>
YLegend[cacheProtoClientHttpRequests]: requests/sec
ShortLegend[cacheProtoClientHttpRequests]: req/s
LegendI[cacheProtoClientHttpRequests]: Requests&nbsp;
LegendO[cacheProtoClientHttpRequests]:
Legend1[cacheProtoClientHttpRequests]: Requests
Legend2[cacheProtoClientHttpRequests]:
 
Target[cacheHttpHits]: cacheHttpHits&cacheHttpHits:public@localhost:3401
MaxBytes[cacheHttpHits]: 10000000
Title[cacheHttpHits]: HTTP Hits @ localhost
Options[cacheHttpHits]: growright, nopercent
PageTop[cacheHttpHits]: <h1>HTTP Hits @ localhost</h1>
YLegend[cacheHttpHits]: hits/sec
ShortLegend[cacheHttpHits]: hits/s
LegendI[cacheHttpHits]: Hits&nbsp;
LegendO[cacheHttpHits]:
Legend1[cacheHttpHits]: Hits
Legend2[cacheHttpHits]:
 
Target[cacheCpuUsage]: cacheCpuUsage&cacheCpuUsage:public@localhost:3401
MaxBytes[cacheCpuUsage]: 100
AbsMax[cacheCpuUsage]: 100
Title[cacheCpuUsage]: CPU Usage @ localhost
Options[cacheCpuUsage]: absolute, gauge, noinfo, growright, nopercent
Unscaled[cacheCpuUsage]: dwmy
PageTop[cacheCpuUsage]: <h1>CPU Usage @ localhost</h1>
YLegend[cacheCpuUsage]: usage %
ShortLegend[cacheCpuUsage]:%
LegendI[cacheCpuUsage]: CPU Usage&nbsp;
LegendO[cacheCpuUsage]:
Legend1[cacheCpuUsage]: CPU Usage
Legend2[cacheCpuUsage]:
 
Target[cacheSysNumReads]: cacheSysNumReads&cacheSysNumReads:public@localhost:3401
MaxBytes[cacheSysNumReads]: 10000000
Title[cacheSysNumReads]: HTTP I/O number of reads @ localhost
Options[cacheSysNumReads]: growright, nopercent
PageTop[cacheSysNumReads]: <h1>HTTP I/O number of reads @ localhost</h1>
YLegend[cacheSysNumReads]: reads/sec
ShortLegend[cacheSysNumReads]: reads/s
LegendI[cacheSysNumReads]: I/O&nbsp;
LegendO[cacheSysNumReads]:
Legend1[cacheSysNumReads]: I/O
Legend2[cacheSysNumReads]:
 
Target[cacheCurrentFileDescrCnt]: cacheCurrentFileDescrCnt&cacheCurrentFileDescrCnt:public@localhost:3401
MaxBytes[cacheCurrentFileDescrCnt]: 1000000000
Title[cacheCurrentFileDescrCnt]: Used File Descriptors
Options[cacheCurrentFileDescrCnt]: gauge, growright, nopercent
PageTop[cacheCurrentFileDescrCnt]: <h1>Number of used file descriptors @ localhost</h1>
YLegend[cacheCurrentFileDescrCnt]: # of FDs
ShortLegend[cacheCurrentFileDescrCnt]: FDs
LegendI[cacheCurrentFileDescrCnt]: File Descriptors&nbsp;
LegendO[cacheCurrentFileDescrCnt]:
Legend1[cacheCurrentFileDescrCnt]: File Descriptors
Legend2[cacheCurrentFileDescrCnt]:
 
Target[cacheRequestHitRatio]: cacheRequestHitRatio.5&cacheRequestHitRatio.60:public@localhost:3401
MaxBytes[cacheRequestHitRatio]: 100
AbsMax[cacheRequestHitRatio]: 100
Title[cacheRequestHitRatio]: Request Hit Ratio @ localhost
Options[cacheRequestHitRatio]: absolute, gauge, noinfo, growright, nopercent
Unscaled[cacheRequestHitRatio]: dwmy
PageTop[cacheRequestHitRatio]: <h1>Request Hit Ratio @ localhost</h1>
YLegend[cacheRequestHitRatio]: %
ShortLegend[cacheRequestHitRatio]: %
LegendI[cacheRequestHitRatio]: Median Hit Ratio (5min)&nbsp;
LegendO[cacheRequestHitRatio]: Median Hit Ratio (60min)&nbsp;
Legend1[cacheRequestHitRatio]: Median Hit Ratio
Legend2[cacheRequestHitRatio]: Median Hit Ratio
 
Target[cacheRequestByteRatio]: cacheRequestByteRatio.5&cacheRequestByteRatio.60:public@localhost:3401
MaxBytes[cacheRequestByteRatio]: 100
AbsMax[cacheRequestByteRatio]: 100
Title[cacheRequestByteRatio]: Byte Hit Ratio @ localhost
Options[cacheRequestByteRatio]: absolute, gauge, noinfo, growright, nopercent
Unscaled[cacheRequestByteRatio]: dwmy
PageTop[cacheRequestByteRatio]: <h1>Byte Hit Ratio @ localhost</h1>
YLegend[cacheRequestByteRatio]: %
ShortLegend[cacheRequestByteRatio]:%
LegendI[cacheRequestByteRatio]: Median Hit Ratio (5min)&nbsp;
LegendO[cacheRequestByteRatio]: Median Hit Ratio (60min)&nbsp;
Legend1[cacheRequestByteRatio]: Median Hit Ratio
Legend2[cacheRequestByteRatio]: Median Hit Ratio

จริงๆ มันมีอีกเพียบเลย แต่ไม่รู้จะใส่ไว้ทำไม รก

Tags: ,

0064 | แก้ปัญหา IP ใน log apache ไม่ตรง

Friday, June 19th, 2009 Posted in Linux, Web Server | 7 Comments »

ที่มา: การติดตั้ง mod_rpaf – reverse proxy add forward

รายละเอียดตามไปดูในที่มาละกันเนาะ ขี้เกียจพิมพ์ซ้ำ
เอาวิธีก๊อปวางบ้านๆ ของเราดีกว่า

wget http://stderr.net/apache/rpaf/download/mod_rpaf-0.6.tar.gz
tar -xvzf mod_rpaf-0.6.tar.gz
cd mod_rpaf-0.6
apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c

เปิดไฟล์ config apache (แนะนำให้ใส่ใน /etc/httpd/conf.d/mod_rpaf.conf)
แก้ตัวแดงๆ ให้ตรงกับเครื่องคุณเองด้วยนะครับ
– อันบนเอาบรรทัดสุดท้ายจากคำสั่ง apxs มา
– อันล่างเอาเป็น ip ของเครื่อง squid

LoadModule rpaf_module /usr/lib64/httpd/modules/mod_rpaf-2.0.so
RPAFenable On
RPAFsethostname Off
RPAFproxy_ips 127.0.0.1
RPAFheader X-Forwarded-For

ถ้าใช้ตัวนี้ ก็เอา ipfix.php ออกไปได้เลยครับ

บทความที่เกี่ยวข้อง
0052 | squid 2.6 as reverse transparent proxy
0053 | ของแถม reverse proxy ipfix.php

Tags: , ,