From: andreas.papst@UNIVIE.AC.AT
Subject: MRTG stuff for SQUID

Hello,

I use MRTG for monitoring squid. With squid 2.0 release you can
use SNMP-requests for this task.

Based on the works of:

matija.grabnar@arnes.si
(http://www.arnes.si/~matija/mrtg-for-squid-0.3.tar.gz),

kostas@nlanr.net
(http://ircache.nlanr.net/Cache/Statistics/mrtg/mrtg-squid-patch)

and possibly others, I patched MRTG to satisfy the new squid 2.0
requirements and added some features, that I thought MRTG must
have.

So I have add new code for displaying correct units to the
previous patches "perminute" and "perhour" ("option" tokens),
which allow to mesure not only per second.

Then I have created a new option token "dorelpercent", which
allows to caclulate the percentage of IN-stream / OUT-stream on
the fly and display it on a fixed scale from 0% to 100%. For my
requirements, this does good work. Maybe someone wants a floating
scale, it should not be a problem to implement it too. But then
give me an option to keep my fixed scale. If IN-stream is always
less than OUT-stream both lines (OUT-stream and relative percent)
are always displayed on top of IN-stream bulk. Otherwise this
option makes no sense. With this option you can display hitrates,
errorrates (for router monitoring: rel. droprates) easily now.

If you use this options please consider, that you need a 5th
colourname/value pair in your Colours statements!

Due to some discussion on this list, I have implemented two
tokens too:

"kilo" and "kMG"

"kilo" should contain the value of k (1000 or 1024), where 1000 is the
default.

"kMG" is a comma separated list of multiplier prefixes, used
instead of "", "k", "M", "G", "T" on the MRTG display. Leave the
place free, if you want no prefix.

Also a not complete list of OIDs for the new SQUID release is
added.

I hope you enjoy it.

Examples for mrtg.cfg:

You can measure now responsetimes in ms and display it with MRTG
correctly with:

kMG[measure-ms]: m,,k,M,G,T
short[measure-ms]: s


You can display now MB/s as 1024*1024 B/s with:

kilo[volume]: 1024
A sample config for squid:


Target[proxy-hit]: cacheHttpHits&cacheClientHttpRequests:public@proxy
Title[proxy-hit]: HTTP Hits
PageTop[proxy-hit]: <H2>proxy Cache Statistics: HTTP Hits / Requests</H2>
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-srvkbinout]: cacheServerInKb&cacheServerOutKb:public@proxy
Title[proxy-srvkbinout]: Cache Server Traffic In / Out
PageTop[proxy-srvkbinout]: <H2>Cache Statistics: Server traffic volume (In/Out) </H2>
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]: kb/min
ShortLegend[proxy-srvkbinout]: b/min
kMG[proxy-srvkbinout]: k,M,G,T
kilo[proxy-srvkbinout]: 1024
Options[proxy-srvkbinout]: nopercent, perminute

andreas.papst@UNIVIE.AC.AT
