• download zlib from http://www.cdrom.com/pub/infozip/zlib/
  • download libpng from http://www.cdrom.com/pub/png/pngcode.html.
  • Compile and install zlib
    tar -xvzf zlib.tar.gz
    cd zlib-1.1.3/
    ./configure
    make
    make test
    make install
    
  • Compile and install libpng
    tar -xvzf libpng-1.0.5.tar.gz 
    cd libpng-1.0.5
    cp scripts/makefile.linux makefile
    make
    make test
    make install
    
  • Download rrdtool from http://ee-staff.ethz.ch/~oetiker/webtools/rrdtool/pub/
  • Compile and install rrdtool
    tar -xvzf rrdtool-1.0.11.tar.gz 
    cd rrdtool-1.0.11
    ./configure
    make
    make install
    
  • download mrtg from http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/pub/

  • download the gd library from www.boutell.comLook under Freeware.

  • compile gd
    tar -xvzf gd-1.7.3.tar.gz 
    cd gd-1.7.3
    make
    make install
    

  • unpack mrtg and patch it with mrtg-db.patch

    tar -xvzf mrtg-2.8.12.tar.gz; cd mrtg-2.8.12/run
    patch -l <~/mrtg-db.patch
    cd ..
    ./configure ; make

  • edit mrtg-squid-snmp.cfg

    Change Workdir, Icondir, change all the server names, possibly change the community string

  • create directories/copy gifs

    Copy * from mrtg-2.8.12/images to your mrtg web directory.

  • Enable SNMP on the cache

    From the Squid FAQ:

    18.2 Enabling SNMP in Squid

    To use SNMP, it must first be enabled with the configure script, and squid rebuilt. To enable is first run the script:

            ./configure --enable-snmp  [ ... other configure options ]
    
    Next, recompile after cleaning the source tree :
            make clean
            make all
            make install
    
    Once the compile is completed and the new binary is installed the squid.conf file needs to be configured to allow access; the default is to deny all requests. The instructions on how to do this have been broken into two parts, the first for all versions of Squid from 2.2 onwards and the second for 2.1 and below.

    18.3 Configuring Squid 2.2

    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
            acl snmpjoebloggs snmp_community joebloggs
    
    This creates two acl's, with two different communities, public and joebloggs. You can name the acl's and the community strings anything that you like.

    To specify the port that the agent will listen on modify the "snmp_port" parameter, it is defaulted to 3401. The port that the agent will forward requests that can not be furfilled by this agent to is set by "forward_snmpd_port" it is defaulted to off. It must be configured for this to work. Remember that as the requests will be originating from this agent you will need to make sure that you configure your access accordingly.

    To allow access to Squid's SNMP agent, define an snmp_access ACL with the community strings that you previously defined. For example:

            snmp_access allow snmppublic localhost
            snmp_access deny all
    
    The above will allow anyone on the localhost who uses the community public to access the agent. It will deny all others access.

    If you do not define any snmp_access ACL's, then SNMP access is denied by default.

    Finally squid allows to you to configure the address that the agent will bind to for incomming and outgoing traffic. These are defaulted to 0.0.0.0, changing these will cause the agent to bind to a specific address on the host, rather than the default which is all.

            snmp_incoming_address 0.0.0.0
            snmp_outgoing_address 0.0.0.0
    
  • put mrtg in crontab

    Enter crontab -e and add an entry like
    0,5,10,15,20,25,30,35,40,45,50,55 * * * * /home/matija/mrtg/run/mrtg /home/matija/mrtg/mrtg-squid-snmp.cfg
    
  • run indexmaker over mrtg-squid-snmp.cfg

    indexmaker mrtg-squid-snmp.cfg "Squid SNMP variables" "." > ~/www/cache/index.html

  • edit cstats-s12 client and install it in crontab

    Change $db_file_location, $MrtgServer, $DBLocation, $client_location,$cache_host, $cache_port.

  • edit and start shared-get on the mrtg machine.

    Change $DBLocation

  • edit mrtg-squid-cachemgr.cfg; add to crontab, run indexmaker

  • add a variable to client using mkmatch

    Watch squid/logs/access.log as you access the cache manager to learn the URL of the page you are interested in.

    Feed the url of the page to mkmatch

    Scan the mkmatch output to find the right regular expression, and copy it into cstats-s12.

    Edit mrtg-squid-cachemgr.cfg

    Run indexmaker

  • start mrtg-anal; squid-feed; squid-store-feed on squid server

  • edit mrtg-squid-logs.cfg; add it to crontab, run indexmaker