[hobbit] Squid & Dansguardian

Alun Watson Alun.Watson at fp.co.nz
Tue Dec 19 03:06:31 CET 2006


Hello Vernon
        I've written a script that gathers data from the squidclient
util (just called client in the earlier versions).
I've just started collecting data so I don't have error status's set up
yet ... 

The squidclient util will give can give you ridiculous amounts of data
on squid memory usage, disk IO, 5min and 60min averages etc.
Squidclient mgr:menu will tell you what you can get.

You should be able to change the client script to grab what ever data
you want ...
On the hobbit server

Entered in to hobbitgraph.cfg


________________________________

[squid]
        TITLE Squid IN-OUT
        YAXIS # bits
        DEF:serverhttpbitsin=squid.rrd:serverhttpbitsin:AVERAGE
        DEF:serverhttpbitsout=squid.rrd:serverhttpbitsout:AVERAGE
        DEF:clienthttpbitsin=squid.rrd:clienthttpbitsin:AVERAGE
        DEF:clienthttpbitsout=squid.rrd:clienthttpbitsout:AVERAGE
        AREA:serverhttpbitsin#@COLOR@:Server Traffic in
        LINE3:serverhttpbitsout#@COLOR@:Server Traffic out
        AREA:clienthttpbitsin#@COLOR@:Client Traffic in
        LINE2:clienthttpbitsout#@COLOR@:Client Traffic out
        COMMENT:\n
        GPRINT:clienthttpbitsin:LAST:Client Traffic in \: %5.1lf%s (cur)
        GPRINT:clienthttpbitsin:MAX: \: %5.1lf%s (max)
        GPRINT:clienthttpbitsin:MIN: \: %5.1lf%s (min)
        GPRINT:clienthttpbitsin:AVERAGE: \: %5.1lf%s (avg)\n
        GPRINT:clienthttpbitsout:LAST:Client Traffic out \: %5.1lf%s
(cur)
        GPRINT:clienthttpbitsout:MAX: \: %5.1lf%s (max)
        GPRINT:clienthttpbitsout:MIN: \: %5.1lf%s (min)
        GPRINT:clienthttpbitsout:AVERAGE: \: %5.1lf%s (avg)\n
        GPRINT:serverhttpbitsin:LAST:Server Traffic in \: %5.1lf%s (cur)
        GPRINT:serverhttpbitsin:MAX: \: %5.1lf%s (max)
        GPRINT:serverhttpbitsin:MIN: \: %5.1lf%s (min)
        GPRINT:serverhttpbitsin:AVERAGE: \: %5.1lf%s (avg)\n
        GPRINT:serverhttpbitsout:LAST:Server Traffic out \: %5.1lf%s
(cur)
        GPRINT:serverhttpbitsout:MAX: \: %5.1lf%s (max)
        GPRINT:serverhttpbitsout:MIN: \: %5.1lf%s (min)
        GPRINT:serverhttpbitsout:AVERAGE: \: %5.1lf%s (avg)\n
[squidclients]
        TITLE Squid Clients
        YAXIS # count
        DEF:numberofclients=squidclients.rrd:numberofclients:AVERAGE
        LINE2:numberofclients#@COLOR@:Number_of_clients
        COMMENT:\n
        GPRINT:numberofclients:LAST:Number_of_clients \: %5.1lf%s (cur)
        GPRINT:numberofclients:MAX: \: %5.1lf%s (max)
        GPRINT:numberofclients:MIN: \: %5.1lf%s (min)
        GPRINT:numberofclients:AVERAGE: \: %5.1lf%s (avg)\n


Entered into hobbitserver.cfg
Added to TEST2RRD="squid=ncv,squidclients=ncv"
Added to GRAPHS="ncv,squid,squidclients"
Create these new lines
NCV_squid="clienthttpbitsin:GAUGE,clienthttpbitsout:GAUGE,serverhttpbits
in:GAUGE,serverhttpbitsout:GAUGE,*:NONE"
NCV_squidclients="numberofclients:GAUGE,*:NONE"


________________________________


On the hobbit client

Create Squid.sh in the ext directory
#!/bin/sh
#Script to
COLUMN=squid    # Name of the column
COLUMN1=squidclients
COLOR=green             # By default, everything is OK
MSG="Squid Status"
# Get Squid traffic in and out.
VAR2=`/usr/local/squid/bin/squidclient mgr:5min | awk
'/server.http.kbytes_/||/client_http.kbytes_/{print $0}' | sed -e
's/=/:/g' -e 's/\/sec//g' -e 's/server\.http\.kbytes_/serverhttpbits/g'
-e 's/client\_http\.kbytes_/clienthttpbits/g' |awk '{print
$1,$2,$3*8*1024}'`
# Get number of connected clients.
VAR3=`/usr/local/squid/bin/squidclient mgr:info | awk '/Number of
clients accessing cache/{print $0}'| sed -e 's/Number of clients
accessing cache\:/numberofclients\ \:/' -e 's/\//g' -e 's/\ //g'`
# Tell Hobbit about it
$BB $BBDISP "status $MACHINE.$COLUMN $COLOR `date`
<br><b>Data in and out of cache 5 minute average</b>
$VAR2
"
$BB $BBDISP "status $MACHINE.$COLUMN1 $COLOR `date`
$VAR3
"
exit 0

Add entry to run the script in clientlaunch.cfg

[squid]
        DISABLED
        ENVFILE $HOBBITCLIENTHOME/etc/hobbitclient.cfg
        CMD $HOBBITCLIENTHOME/ext/squid.sh
        LOGFILE $HOBBITCLIENTHOME/logs/squid.log
        INTERVAL 5m


That gives me pretty graphs about traffic and number of clients.

Hope that helps.


Alun

-----Original Message-----

From: Everett, Vernon [mailto:Vernon.Everett at dpi.wa.gov.au]
Sent: Monday, 18 December 2006 2:55
To: hobbit at hswn.dk
Subject: [hobbit] Squid & Dansguardian

Hi all

I detest reinventing wheels, so let's first check if they exist.

Has anybody got anything to monitor Squid and/or Dansguardian?

Regards
    Vernon

To unsubscribe from the hobbit list, send an e-mail to
hobbit-unsubscribe at hswn.dk



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20061219/6cbdbfb6/attachment.html>


More information about the Xymon mailing list