h1

Measure the performance of your Linux Box with MRTG

June 1, 2006

1. MRTG INSTALL GUIDE
###############

PREPARATION
In order to compile and use mrtg you need a C compiler and a copy of perl installed on your machine. In most cases this will already be available. In case it is not, here are some starting points. Below I’ll give you a detailed run through the whole compilation process.

GCC

The GNU C compiler comes preinstalled on most of the free Unicies out there. For commercial derivatives you may have to download and compile it first. If you have no compiler at all there is a chicken and egg problem, but there are also precompiled versions of gcc available for most operating systems.
http://gcc.gnu.org/
Perl

Large parts of the MRTG system are written in the Perl scripting language. Make sure there is a recent copy of perl on your machine (try perl -v). At least version 5.005 is required for mrtg to work well. You can get the latest perl from
http://www.perl.com/
MRTG generates traffic graphs in the PNG format. To be able to do this it needs several 3rd party libraries. When compiling these libraries I urge you to make sure you compile them as static libraries. There is just much less trouble ahead if you are doing it like this. See the Instructions in the next section for inspiration. Note that many free unices have all the required libraries already in place so there is no need to install another copy. To check it is best to skip all the library instructions below and go straight into the mrtg compile.

If the first attempt fails and you do not get a working version of mrtg, try compiling new copies of all libraries as explained below. Do this BEFORE you send email to me about problems compiling mrtg.

gd

This is a basic graph drawing library created by Thomas Boutell. Note that all releases after Version 1.3 only create PNG images. This is because a) Thomas got into trouble because the GIF format which it used to produce uses a compression technology patented by Unisys. b) PNG is more efficient and patent free. MRTG can work with old and new version of the GD library. You can get a recent copy of GD from:
http://www.boutell.com/gd/
libpng

Is required by gd in order to produce PNG graphics files. Get it from:
http://www.libpng.org/pub/png/libpng.html
zlib

Is needed by libpng to compress the graphics files you create. Get a copy from
http://www.gzip.org/zlib
And last but not least you also need mrtg itself. In case you have not yet downloaded it, you can find a copy on my website:

http://people.ee.ethz.ch/~oetiker/webtools/mrtg/pub/

——————————————————————————–

LIBRARY COMPILATION
In this section I will give you step by step instructions on how to compile the various libraries required for the compilation of mrtg. Note that these libaries may already be installed if you have a *BSD or Linux system so you can skip recompiling them. The wget program used below is a simple web downloader. You can also enter the address into your netscape if you don’t have wget available.

First let’s create a directory for the compilation. Note that this may already exist on your system. No problem, just use it.

mkdir -p /usr/local/src
cd /usr/local/srcIf you do not have zlib installed:

wget http://www.gzip.org/zlib/zlib-1.1.4.tar.gz
gunzip -c zlib-*.tar.gz | tar xf –
rm zlib-*.tar.gz
mv zlib-* zlib
cd zlib
./configure
make
cd ..If you don’t have libpng installed

wget http://public.planetmirror.com/pub/sourceforge/l/li/libpng/libpng-1.0.15.tar.gz
gunzip -c libpng-*.tar.gz |tar xf –
rm libpng-*.tar.gz
mv libpng-* libpng
cd libpng
make -f scripts/makefile.std CC=gcc ZLIBLIB=../zlib ZLIBINC=../zlib
rm *.so.* *.so
cd ..And now you can compile gd

For versions up to 1.8.4, try:

wget http://www.boutell.com/gd/http/gd-1.8.4.tar.gz
gunzip -c gd-*.tar.gz |tar xf –
rm gd-*.tar.gz
mv gd-* gd
cd gdThe \ characters at the end of the following lines mean that all the following material should actually be written on a single line.

perl -i~ -p -e s/gd_jpeg.o//g Makefile
make INCLUDEDIRS=”-I. -I../zlib -I../libpng” \
LIBDIRS=”-L../zlib -L. -L../libpng” \
LIBS=”-lgd -lpng -lz -lm” \
CFLAGS=”-O -DHAVE_LIBPNG”
cd ..For version starting around 2.0.11, try:

wget http://www.boutell.com/gd/http/gd-2.0.11.tar.gz
gunzip -c gd-2.0.11.tar.gz |tar xf –
mv gd-2.0.11 gd
cd gd
env CPPFLAGS=”-I../zlib -I../libpng” LDFLAGS=”-L../zlib -L../libpng” ./configure –disable-shared \
–without-freetype –without-jpeg
make
cp .libs/* .

——————————————————————————–

MRTG COMPILATION
Ok, now everything is ready for the mrtg compilation.

cd /usr/local/src
gunzip -c mrtg-2.11.1.tar.gz | tar xvf –
cd mrtg-2.11.1If all the libraries have been preinstalled on your system you can configure mrtg by doing a simple:

./configure –prefix=/usr/local/mrtg-2Otherwise you may have to give some hints on where to find the various libraries required to compile mrtg:

./configure –prefix=/usr/local/mrtg-2 \
–with-gd=/usr/local/src/gd \
–with-z=/usr/local/src/zlib \
–with-png=/usr/local/src/libpngIf you have RRDtool available you might want to tell mrtg about it so that you can opt to use rrdtool with mrtg. Check the mrtg-rrd manpage.

Configure will make sure your environment is fit for building mrtg. If it finds a problem, it will tell you so and it will also tell you what to do about it. If everything is OK, you will end up with a custom Makefile for your system. Now type:

makeThis builds the rateup binary and edits all the perl pathnames in the scripts. You can now install mrtg by typing

make install (requires gnu install)All the software required by MRTG is now installed under the /usr/local/mrtg-2 subdirectory.
(cc from http://people.ee.ethz.ch/~oetiker/webtools/mrtg/mrtg-unix-guide.html )

*** Note***
If u have installed MRTG, you dont need to folow the above steps. Plus, if u can always try to use the latest MRTG source…if u r convinced..that it doesnot contain any vulnerability.

2. Monitoring SQUID with MRTG
###################
a) First of all, u need to have a squid.cfg (u can name it any.cfg) file.

Use my squid.cfg file and edit it to change IP address to suit your own needs

****My squid.cfg file****
#################
WorkDir: /var/www/html/squid-mrtg
LoadMIBs: /usr/local/squid/share/mib.txt
RunAsDaemon: Yes
Interval: 5

Target[cacheHits]: cacheHttpHits&cacheProtoClientHttpRequests:public@172.16.1.13:3401
Title[cacheHits]: HTTP Hits
PageTop[cacheHits]: <h1>HTTP Hits / Requests</h1>
MaxBytes[cacheHits]: 10000000
Supress[cacheHits]: y
YLegend[cacheHits]: perminute
ShortLegend[cacheHits]: req/min
LegendI[cacheHits]: HTTP hits
LegendO[cacheHits]: HTTP requests
Legend1[cacheHits]: HTTP hits
Legend2[cacheHits]: HTTP requests
Options[cacheHits]: nopercent, perminute, dorelpercent

Target[cacheServerRequests]: cacheServerRequests&cacheServerRequests:public@172.16.1.13:3401
MaxBytes[cacheServerRequests]: 10000000
Title[cacheServerRequests]: Server Requests
Options[cacheServerRequests]: nopercent
PageTop[cacheServerRequests]: <h1>Server Requests </h1>
YLegend[cacheServerRequests]: requests/sec
ShortLegend[cacheServerRequests]: req/s
LegendI[cacheServerRequests]: Requests
LegendO[cacheServerRequests]:
Legend1[cacheServerRequests]: Requests
Legend2[cacheServerRequests]:

Target[cacheServerErrors]: cacheServerErrors&cacheServerErrors:public@172.16.1.13:3401
MaxBytes[cacheServerErrors]: 10000000
Title[cacheServerErrors]: Server Errors
Options[cacheServerErrors]: nopercent
PageTop[cacheServerErrors]: <h1>Server Errors </h1>
YLegend[cacheServerErrors]: errors/sec
ShortLegend[cacheServerErrors]: err/s
LegendI[cacheServerErrors]: Errors
LegendO[cacheServerErrors]:
Legend1[cacheServerErrors]: Errors
Legend2[cacheServerErrors]:

Target[cacheServerInOutKb]: cacheServerInKb&cacheServerOutKb:public@172.16.1.13:3401 * 1024
MaxBytes[cacheServerInOutKb]: 1000000000
Title[cacheServerInOutKb]: Server In/Out Traffic
Options[cacheServerInOutKb]: nopercent
PageTop[cacheServerInOutKb]: <h1>Server In/Out Traffic </h1>
YLegend[cacheServerInOutKb]: Bytes/sec
ShortLegend[cacheServerInOutKb]: Bytes/s
LegendI[cacheServerInOutKb]: Server In
LegendO[cacheServerInOutKb]: Server Out
Legend1[cacheServerInOutKb]: Server In
Legend2[cacheServerInOutKb]: Server Out

Target[cacheHttpErrors]: cacheHttpErrors&cacheHttpErrors:public@172.16.1.13:3401
MaxBytes[cacheHttpErrors]: 10000000
Title[cacheHttpErrors]: HTTP Errors
Options[cacheHttpErrors]: nopercent
PageTop[cacheHttpErrors]: <h1>HTTP Errors </h1>
YLegend[cacheHttpErrors]: errors/sec
ShortLegend[cacheHttpErrors]: err/s
LegendI[cacheHttpErrors]: Errors
LegendO[cacheHttpErrors]:
Legend1[cacheHttpErrors]: Errors
Legend2[cacheHttpErrors]:

Target[cacheIcpPktsSentRecv]: cacheIcpPktsSent&cacheIcpPktsRecv:public@172.16.1.13:3401
MaxBytes[cacheIcpPktsSentRecv]: 10000000
Title[cacheIcpPktsSentRecv]: ICP Packets Sent/Received
Options[cacheIcpPktsSentRecv]: nopercent
PageTop[cacheIcpPktsSentRecv]: <h1>ICP Packets Sent/Recieved </h1>
YLegend[cacheIcpPktsSentRecv]: packets/sec
ShortLegend[cacheIcpPktsSentRecv]: pkts/s
LegendI[cacheIcpPktsSentRecv]: Pkts Sent
LegendO[cacheIcpPktsSentRecv]: Pkts Received
Legend1[cacheIcpPktsSentRecv]: Pkts Sent
Legend2[cacheIcpPktsSentRecv]: Pkts Received

Target[cacheIcpKbSentRecv]: cacheIcpKbSent&cacheIcpKbRecv:public@172.16.1.13:3401 * 1024
MaxBytes[cacheIcpKbSentRecv]: 1000000000
Title[cacheIcpKbSentRecv]: ICP Bytes Sent/Received
Options[cacheIcpKbSentRecv]: nopercent
PageTop[cacheIcpKbSentRecv]: <h1>ICP Bytes Sent/Received </h1>
YLegend[cacheIcpKbSentRecv]: Bytes/sec
ShortLegend[cacheIcpKbSentRecv]: Bytes/s
LegendI[cacheIcpKbSentRecv]: Sent
LegendO[cacheIcpKbSentRecv]: Received
Legend1[cacheIcpKbSentRecv]: Sent
Legend2[cacheIcpKbSentRecv]: Received

Target[cacheHttpInOutKb]: cacheHttpInKb&cacheHttpOutKb:public@172.16.1.13:3401 * 1024
MaxBytes[cacheHttpInOutKb]: 1000000000
Title[cacheHttpInOutKb]: HTTP In/Out Traffic
Options[cacheHttpInOutKb]: nopercent
PageTop[cacheHttpInOutKb]: <h1>HTTP In/Out Traffic </h1>
YLegend[cacheHttpInOutKb]: Bytes/second
ShortLegend[cacheHttpInOutKb]: Bytes/s
LegendI[cacheHttpInOutKb]: HTTP In
LegendO[cacheHttpInOutKb]: HTTP Out
Legend1[cacheHttpInOutKb]: HTTP In
Legend2[cacheHttpInOutKb]: HTTP Out

Target[cacheCurrentSwapSize]: cacheCurrentSwapSize&cacheCurrentSwapSize:public@172.16.1.13:3401
MaxBytes[cacheCurrentSwapSize]: 1000000000
Title[cacheCurrentSwapSize]: Current Swap Size
Options[cacheCurrentSwapSize]: gauge, nopercent
PageTop[cacheCurrentSwapSize]: <h1>Current Swap Size </h1>
YLegend[cacheCurrentSwapSize]: swap size
ShortLegend[cacheCurrentSwapSize]: Bytes
LegendI[cacheCurrentSwapSize]: Swap Size
LegendO[cacheCurrentSwapSize]:
Legend1[cacheCurrentSwapSize]: Swap Size
Legend2[cacheCurrentSwapSize]:

Target[cacheNumObjCount]: cacheNumObjCount&cacheNumObjCount:public@172.16.1.13:3401
MaxBytes[cacheNumObjCount]: 10000000
Title[cacheNumObjCount]: Num Object Count
Options[cacheNumObjCount]: gauge, nopercent
PageTop[cacheNumObjCount]: <h1>Num Object Count </h1>
YLegend[cacheNumObjCount]: # of objects
ShortLegend[cacheNumObjCount]: objects
LegendI[cacheNumObjCount]: Num Objects
LegendO[cacheNumObjCount]:
Legend1[cacheNumObjCount]: Num Objects
Legend2[cacheNumObjCount]:

Target[cacheCpuUsage]: cacheCpuUsage&cacheCpuUsage:public@172.16.1.13:3401
MaxBytes[cacheCpuUsage]: 100
AbsMax[cacheCpuUsage]: 100
Title[cacheCpuUsage]: CPU Usage
Options[cacheCpuUsage]: absolute, gauge, noinfo, nopercent
Unscaled[cacheCpuUsage]: dwmy
PageTop[cacheCpuUsage]: <h1>CPU Usage </h1>
YLegend[cacheCpuUsage]: usage %
ShortLegend[cacheCpuUsage]:%
LegendI[cacheCpuUsage]: CPU Usage
LegendO[cacheCpuUsage]:
Legend1[cacheCpuUsage]: CPU Usage
Legend2[cacheCpuUsage]:

Target[cacheMemUsage]: cacheMemUsage&cacheMemUsage:public@172.16.1.13:3401 * 1024
MaxBytes[cacheMemUsage]: 2000000000
Title[cacheMemUsage]: Memory Usage
Options[cacheMemUsage]: gauge, nopercent
PageTop[cacheMemUsage]: <h1>Total memory accounted for </h1>
YLegend[cacheMemUsage]: Bytes
ShortLegend[cacheMemUsage]: Bytes
LegendI[cacheMemUsage]: Mem Usage
LegendO[cacheMemUsage]:
Legend1[cacheMemUsage]: Mem Usage
Legend2[cacheMemUsage]:

Target[cacheSysPageFaults]: cacheSysPageFaults&cacheSysPageFaults:public@172.16.1.13:3401
MaxBytes[cacheSysPageFaults]: 10000000
Title[cacheSysPageFaults]: Sys Page Faults
Options[cacheSysPageFaults]: nopercent
PageTop[cacheSysPageFaults]: <h1>Sys Page Faults </h1>
YLegend[cacheSysPageFaults]: page faults/sec
ShortLegend[cacheSysPageFaults]: PF/s
LegendI[cacheSysPageFaults]: Page Faults
LegendO[cacheSysPageFaults]:
Legend1[cacheSysPageFaults]: Page Faults
Legend2[cacheSysPageFaults]:

Target[cacheSysVMsize]: cacheSysVMsize&cacheSysVMsize:public@172.16.1.13:3401 * 1024
MaxBytes[cacheSysVMsize]: 1000000000
Title[cacheSysVMsize]: Storage Mem Size
Options[cacheSysVMsize]: gauge, nopercent
PageTop[cacheSysVMsize]: <h1>Storage Mem Size </h1>
YLegend[cacheSysVMsize]: mem size
ShortLegend[cacheSysVMsize]: Bytes
LegendI[cacheSysVMsize]: Mem Size
LegendO[cacheSysVMsize]:
Legend1[cacheSysVMsize]: Mem Size
Legend2[cacheSysVMsize]:

Target[cacheSysStorage]: cacheSysStorage&cacheSysStorage:public@172.16.1.13:3401
MaxBytes[cacheSysStorage]: 1000000000
Title[cacheSysStorage]: Storage Swap Size
Options[cacheSysStorage]: gauge, nopercent
PageTop[cacheSysStorage]: <h1>Storage Swap Size </h1>
YLegend[cacheSysStorage]: swap size (KB)
ShortLegend[cacheSysStorage]: KBytes
LegendI[cacheSysStorage]: Swap Size
LegendO[cacheSysStorage]:
Legend1[cacheSysStorage]: Swap Size
Legend2[cacheSysStorage]:

Target[cacheSysNumReads]: cacheSysNumReads&cacheSysNumReads:public@172.16.1.13:3401
MaxBytes[cacheSysNumReads]: 10000000
Title[cacheSysNumReads]: HTTP I/O number of reads
Options[cacheSysNumReads]: nopercent
PageTop[cacheSysNumReads]: <h1>HTTP I/O number of reads </h1>
YLegend[cacheSysNumReads]: reads/sec
ShortLegend[cacheSysNumReads]: reads/s
LegendI[cacheSysNumReads]: I/O
LegendO[cacheSysNumReads]:
Legend1[cacheSysNumReads]: I/O
Legend2[cacheSysNumReads]:

Target[cacheCpuTime]: cacheCpuTime&cacheCpuTime:public@172.16.1.13:3401
MaxBytes[cacheCpuTime]: 1000000000
Title[cacheCpuTime]: Cpu Time
Options[cacheCpuTime]: gauge, nopercent
PageTop[cacheCpuTime]: <h1>Amount of cpu seconds consumed </h1>
YLegend[cacheCpuTime]: cpu seconds
ShortLegend[cacheCpuTime]: cpu seconds
LegendI[cacheCpuTime]: Mem Time
LegendO[cacheCpuTime]:
Legend1[cacheCpuTime]: Mem Time
Legend2[cacheCpuTime]:

Target[cacheMaxResSize]: cacheMaxResSize&cacheMaxResSize:public@172.16.1.13:3401 * 1024
MaxBytes[cacheMaxResSize]: 1000000000
Title[cacheMaxResSize]: Max Resident Size
Options[cacheMaxResSize]: gauge, nopercent
PageTop[cacheMaxResSize]: <h1>Maximum Resident Size </h1>
YLegend[cacheMaxResSize]: Bytes
ShortLegend[cacheMaxResSize]: Bytes
LegendI[cacheMaxResSize]: Size
LegendO[cacheMaxResSize]:
Legend1[cacheMaxResSize]: Size
Legend2[cacheMaxResSize]:

Target[cacheCurrentLRUExpiration]: cacheCurrentLRUExpiration&cacheCurrentLRUExpiration:public@172.16.1.13:3401
MaxBytes[cacheCurrentLRUExpiration]: 1000000000
Title[cacheCurrentLRUExpiration]: LRU Expiration Age
Options[cacheCurrentLRUExpiration]: gauge, nopercent
PageTop[cacheCurrentLRUExpiration]: <h1>Storage LRU Expiration Age </h1>
YLegend[cacheCurrentLRUExpiration]: expir (days)
ShortLegend[cacheCurrentLRUExpiration]: days
LegendI[cacheCurrentLRUExpiration]: Age
LegendO[cacheCurrentLRUExpiration]:
Legend1[cacheCurrentLRUExpiration]: Age
Legend2[cacheCurrentLRUExpiration]:

Target[cacheCurrentUnlinkRequests]: cacheCurrentUnlinkRequests&cacheCurrentUnlinkRequests:public@172.16.1.13:3401
MaxBytes[cacheCurrentUnlinkRequests]: 1000000000
Title[cacheCurrentUnlinkRequests]: Unlinkd Requests
Options[cacheCurrentUnlinkRequests]: nopercent
PageTop[cacheCurrentUnlinkRequests]: <h1>Requests given to unlinkd </h1>
YLegend[cacheCurrentUnlinkRequests]: requests/sec
ShortLegend[cacheCurrentUnlinkRequests]: reqs/s
LegendI[cacheCurrentUnlinkRequests]: Unlinkd requests
LegendO[cacheCurrentUnlinkRequests]:
Legend1[cacheCurrentUnlinkRequests]: Unlinkd requests
Legend2[cacheCurrentUnlinkRequests]:

Target[cacheCurrentUnusedFileDescrCount]: cacheCurrentUnusedFDescrCnt&cacheCurrentUnusedFDescrCnt:public@172.16.1.13:3401
MaxBytes[cacheCurrentUnusedFileDescrCount]: 1000000000
Title[cacheCurrentUnusedFileDescrCount]: Available File Descriptors
Options[cacheCurrentUnusedFileDescrCount]: gauge, nopercent
PageTop[cacheCurrentUnusedFileDescrCount]: <h1>Available number of file descriptors </h1>
YLegend[cacheCurrentUnusedFileDescrCount]: # of FDs
ShortLegend[cacheCurrentUnusedFileDescrCount]: FDs
LegendI[cacheCurrentUnusedFileDescrCount]: File Descriptors
LegendO[cacheCurrentUnusedFileDescrCount]:
Legend1[cacheCurrentUnusedFileDescrCount]: File Descriptors
Legend2[cacheCurrentUnusedFileDescrCount]:

Target[cacheCurrentReservedFileDescrCount]: cacheCurrentResFileDescrCnt&cacheCurrentResFileDescrCnt:public@172.16.1.13:3401
MaxBytes[cacheCurrentReservedFileDescrCount]: 1000000000
Title[cacheCurrentReservedFileDescrCount]: Reserved File Descriptors
Options[cacheCurrentReservedFileDescrCount]: gauge, nopercent
PageTop[cacheCurrentReservedFileDescrCount]: <h1>Reserved number of file descriptors </h1>
YLegend[cacheCurrentReservedFileDescrCount]: # of FDs
ShortLegend[cacheCurrentReservedFileDescrCount]: FDs
LegendI[cacheCurrentReservedFileDescrCount]: File Descriptors
LegendO[cacheCurrentReservedFileDescrCount]:
Legend1[cacheCurrentReservedFileDescrCount]: File Descriptors
Legend2[cacheCurrentReservedFileDescrCount]:

Target[cacheClients]: cacheClients&cacheClients:public@172.16.1.13:3401
MaxBytes[cacheClients]: 1000000000
Title[cacheClients]: Number of Clients
Options[cacheClients]: nopercent
PageTop[cacheClients]: <h1>Number of clients accessing cache </h1>
YLegend[cacheClients]: clients/sec
ShortLegend[cacheClients]: clients/s
LegendI[cacheClients]: Num Clients
LegendO[cacheClients]:
Legend1[cacheClients]: Num Clients
Legend2[cacheClients]:

Target[cacheHttpAllSvcTime]: cacheHttpAllSvcTime.5&cacheHttpAllSvcTime.60:public@172.16.1.13:3401
MaxBytes[cacheHttpAllSvcTime]: 1000000000
Title[cacheHttpAllSvcTime]: HTTP All Service Time
Options[cacheHttpAllSvcTime]: gauge, nopercent
PageTop[cacheHttpAllSvcTime]: <h1>HTTP all service time </h1>
YLegend[cacheHttpAllSvcTime]: svc time (ms)
ShortLegend[cacheHttpAllSvcTime]: ms
LegendI[cacheHttpAllSvcTime]: Median Svc Time (5min)
LegendO[cacheHttpAllSvcTime]: Median Svc Time (60min)
Legend1[cacheHttpAllSvcTime]: Median Svc Time
Legend2[cacheHttpAllSvcTime]: Median Svc Time

Target[cacheHttpMissSvcTime]: cacheHttpMissSvcTime.5&cacheHttpMissSvcTime.60:public@172.16.1.13:3401
MaxBytes[cacheHttpMissSvcTime]: 1000000000
Title[cacheHttpMissSvcTime]: HTTP Miss Service Time
Options[cacheHttpMissSvcTime]: gauge, nopercent
PageTop[cacheHttpMissSvcTime]: <h1>HTTP miss service time </h1>
YLegend[cacheHttpMissSvcTime]: svc time (ms)
ShortLegend[cacheHttpMissSvcTime]: ms
LegendI[cacheHttpMissSvcTime]: Median Svc Time (5min)
LegendO[cacheHttpMissSvcTime]: Median Svc Time (60min)
Legend1[cacheHttpMissSvcTime]: Median Svc Time
Legend2[cacheHttpMissSvcTime]: Median Svc Time

Target[cacheHttpNmSvcTime]: cacheHttpNmSvcTime.5&cacheHttpNmSvcTime.60:public@172.16.1.13:3401
MaxBytes[cacheHttpNmSvcTime]: 1000000000
Title[cacheHttpNmSvcTime]: HTTP Near Miss Service Time
Options[cacheHttpNmSvcTime]: gauge, nopercent
PageTop[cacheHttpNmSvcTime]: <h1>HTTP near miss service time </h1>
YLegend[cacheHttpNmSvcTime]: svc time (ms)
ShortLegend[cacheHttpNmSvcTime]: ms
LegendI[cacheHttpNmSvcTime]: Median Svc Time (5min)
LegendO[cacheHttpNmSvcTime]: Median Svc Time (60min)
Legend1[cacheHttpNmSvcTime]: Median Svc Time
Legend2[cacheHttpNmSvcTime]: Median Svc Time

Target[cacheHttpHitSvcTime]: cacheHttpHitSvcTime.5&cacheHttpHitSvcTime.60:public@172.16.1.13:3401
MaxBytes[cacheHttpHitSvcTime]: 1000000000
Title[cacheHttpHitSvcTime]: HTTP Hit Service Time
Options[cacheHttpHitSvcTime]: gauge, nopercent
PageTop[cacheHttpHitSvcTime]: <h1>HTTP hit service time </h1>
YLegend[cacheHttpHitSvcTime]: svc time (ms)
ShortLegend[cacheHttpHitSvcTime]: ms
LegendI[cacheHttpHitSvcTime]: Median Svc Time (5min)
LegendO[cacheHttpHitSvcTime]: Median Svc Time (60min)
Legend1[cacheHttpHitSvcTime]: Median Svc Time
Legend2[cacheHttpHitSvcTime]: Median Svc Time

Target[cacheIcpQuerySvcTime]: cacheIcpQuerySvcTime.5&cacheIcpQuerySvcTime.60:public@172.16.1.13:3401
MaxBytes[cacheIcpQuerySvcTime]: 1000000000
Title[cacheIcpQuerySvcTime]: ICP Query Service Time
Options[cacheIcpQuerySvcTime]: gauge, nopercent
PageTop[cacheIcpQuerySvcTime]: <h1>ICP query service time </h1>
YLegend[cacheIcpQuerySvcTime]: svc time (ms)
ShortLegend[cacheIcpQuerySvcTime]: ms
LegendI[cacheIcpQuerySvcTime]: Median Svc Time (5min)
LegendO[cacheIcpQuerySvcTime]: Median Svc Time (60min)
Legend1[cacheIcpQuerySvcTime]: Median Svc Time
Legend2[cacheIcpQuerySvcTime]: Median Svc Time

Target[cacheIcpReplySvcTime]: cacheIcpReplySvcTime.5&cacheIcpReplySvcTime.60:public@172.16.1.13:3401
MaxBytes[cacheIcpReplySvcTime]: 1000000000
Title[cacheIcpReplySvcTime]: ICP Reply Service Time
Options[cacheIcpReplySvcTime]: gauge, nopercent
PageTop[cacheIcpReplySvcTime]: <h1>ICP reply service time </h1>
YLegend[cacheIcpReplySvcTime]: svc time (ms)
ShortLegend[cacheIcpReplySvcTime]: ms
LegendI[cacheIcpReplySvcTime]: Median Svc Time (5min)
LegendO[cacheIcpReplySvcTime]: Median Svc Time (60min)
Legend1[cacheIcpReplySvcTime]: Median Svc Time
Legend2[cacheIcpReplySvcTime]: Median Svc Time

Target[cacheDnsSvcTime]: cacheDnsSvcTime.5&cacheDnsSvcTime.60:public@172.16.1.13:3401
MaxBytes[cacheDnsSvcTime]: 1000000000
Title[cacheDnsSvcTime]: DNS Service Time
Options[cacheDnsSvcTime]: gauge, nopercent
PageTop[cacheDnsSvcTime]: <h1>DNS service time </h1>
YLegend[cacheDnsSvcTime]: svc time (ms)
ShortLegend[cacheDnsSvcTime]: ms
LegendI[cacheDnsSvcTime]: Median Svc Time (5min)
LegendO[cacheDnsSvcTime]: Median Svc Time (60min)
Legend1[cacheDnsSvcTime]: Median Svc Time
Legend2[cacheDnsSvcTime]: Median Svc Time

Target[cacheRequestHitRatio]: cacheRequestHitRatio.5&cacheRequestHitRatio.60:public@172.16.1.13:3401
MaxBytes[cacheRequestHitRatio]: 100
AbsMax[cacheRequestHitRatio]: 100
Title[cacheRequestHitRatio]: Request Hit Ratio
Options[cacheRequestHitRatio]: absolute, gauge, noinfo, nopercent
Unscaled[cacheRequestHitRatio]: dwmy
PageTop[cacheRequestHitRatio]: <h1>Request Hit Ratio </h1>
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@172.16.1.13:3401
MaxBytes[cacheRequestByteRatio]: 100
AbsMax[cacheRequestByteRatio]: 100
Title[cacheRequestByteRatio]: Byte Hit Ratio
Options[cacheRequestByteRatio]: absolute, gauge, noinfo, nopercent
Unscaled[cacheRequestByteRatio]: dwmy
PageTop[cacheRequestByteRatio]: <h1>Byte Hit Ratio </h1>
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
###### End of squid.cfg############################

b) Now u can keep ur squid.cfg file anywhere but keep it in a known location…bcoz u ‘ll need it when daemonizing MRTG to monitor squid.

c) Workdir (I have used it as /var/www/html/squid-mrtg )….know that its the location of ur webserver where ur html files ‘ll be fetched by MRTG while monitoring squid.
[root@Fed3 ~]# mkdir /var/www/html/squid-mrtg

d) change public@172.16.1.13 in the squid.cfg to ur own ip address.

e) Edit ur squid.conf file and uncomment or add the following lines

snmp_port 3401
acl snmppublic snmp_community public
snmp_access allow snmppublic all
snmp_access deny all
snmp_incoming_address 0.0.0.0
snmp_outgoing_address 0.0.0.0

f) SQUID MIB : LoadMIBs
[root@Fed3 ~]# slocate mib.txt
My squid 2.5.STABLE7 has mib.txt under /usr/local/squid/share directory.
Notice it at the top lines of the squid.cfg file.

##############################################

So all the above aspects checked for…..Now we move into the commands section
Running SQUID MRTG for the first time…. (comment RunAsDaemon: Yes)

[root@Fed3 ~]#
env LANG=C /usr/local/mrtg/bin/mrtg /usr/local/mrtg/mrtg/squid/squid.cfg

Run this comand two to three times…it gives few errors and possibly after the third run, it wont give any errors.
Then uncomment #RunAsDaemon: Yes ,option and run it again, which will daemonize MRTG to monitor squid.

Also before daemonizing MRTG to monitor squid…U might like to use the indexmaker facility of MRTG to generate ur index.html file…..
[root@Fed3 ~]# /usr/local/mrtg/bin/indexmaker –output=/var/www/html/squid-mrtg/index.html –compact /usr/local/mrtg/mrtg/squid/squid.cfg

#### MAKING mrtg to monitor squid using crontab #####
[root@Fed3 ~]# vi /etc/crontab

## Add these lines
##### squid-mrtg cron #####
*/5 * * * * /usr/local/mrtg/bin/mrtg /usr/local/mrtg/mrtg/squid/squid.cfg –logging /var/log/mrtg-squid.log

**** NOTE ***

Double check file locations, IP address etc…

Also, All the above written kinda tutorial…is to be used by anybody at his own risk. The author hopes and has himslef followed the above steps but cannot give guarantee on the success of implementation.

One comment

  1. If only more people would hear this..



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: