01

Sep

Monitoring Squid with MRTG

Tag » Squid, MRTG
Written by nofee   
 

If you want to know utilization or performance your Squid Proxy, you can use MRTG to monitoring Squid Proxy. This can do, because Squid Proxy support SNMP and you must configure squid with SNMP support.

Enabling SNMP in Squid
To use SNMP, it must first be enabled with the configure script and squid rebuild.

./configure --enable-snmp [ ... other configure options ]



Next recompile after cleaning the source tree:

make clean
make all
make install



Note, if upgrading from existing squid, you must stop squid before make install.

Configuring Squid
To configure SNMP first specify a list of communities that you would like to allow access by using a standard acl of the form:

acl aclname snmp_community string



For example :

acl snmppublic snmp_community public



Configuring SNMP port, default is 3401.

snmp_port 3401



Allowing access to Squid SNMP agent :

snmp_access allow snmppublic localhost
snmp_access deny all



Testing Squid SNMP Agent
After configure squid with '--enable-snmp' option, there is create file with name : mib.txt. Find this file, you can use locate to find this file.

locate mib.txt



Result :
/usr/local/squid/share/mib.txt

To test Squid SNMP Agent, use snmpwalk program :

snmpwalk -m /usr/share/squid/mib.txt -v2c -c communitystring hostname:3401 .1.3.6.1.4.1.3495.1.1



If it gives output like :

enterprises.nlanr.squid.cacheSystem.cacheSysVMsize = 7970816
enterprises.nlanr.squid.cacheSystem.cacheSysStorage = 2796142
enterprises.nlanr.squid.cacheSystem.cacheUptime = Timeticks: (766299) 2:07:42.99



or

SNMPv2-SMI::enterprises.3495.1.1.1.0 = INTEGER: 460
SNMPv2-SMI::enterprises.3495.1.1.2.0 = INTEGER: 1566452
SNMPv2-SMI::enterprises.3495.1.1.3.0 = Timeticks: (584627) 1:37:26.27


then it is working ok.

Configuring mrtg.cfg
Copy the mib.txt file from Squid in the mibs directory of your MRTG installation
Add to Global Config Options of your mrtg.conf a line like the following :

LoadMIBS: /usr/local/mrtg-2/mibs/squid.mib


(Here I have renamed mib.txt in squid.mib)

 
Add targets like the following:
Target[proxy-hit]: cacheHttpHits&cacheServerRequests:public@localhost:3401
MaxBytes[proxy-hit]: 100000
Title[proxy-hit]: HTTP Hits
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, unknaszero, growright, pngdate
PNGTitle[proxy-hit]: Proxy Hits

Target[proxy-srvkbinout]: cacheServerInKb&cacheServerOutKb:public@localhost:3401
MaxBytes[proxy-srvkbinout]: 76800
Title[proxy-srvkbinout]: Cache Server Traffic 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
kMG[proxy-srvkbinout]: k,M,G,T
kilo[proxy-srvkbinout]: 1024
Options[proxy-srvkbinout]: nopercent, perminute, unknaszero, growright, pngdate
PNGTitle[proxy-hit]: Proxy Traffic In/Out
 


Please note the MaxBytes value (76800 KB/min) for Cache Server Traffic In/Out: it depends from your Proxy network interface speed.

Reference :
Trackback(0)
Comments (0)Add Comment

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
smile
wink
laugh
grin
angry
sad
shocked
cool
tongue
kiss
cry
smaller | bigger

security code
Write the displayed characters


busy
PerformancingAds

More Sites

AdBlaze (272)
AdBux (315)
Chitika (331)
Crosslink Builder (371)
LinkWorth (352)
Make Money (70)
PayPal (368)

Statistics

Members 4
Content 39
Web Links 24
Content View Hits 34.145

Best Link

Copyright © 2009 MustNoFee
This blog is 362 days since Jan, 12 2008