Squid (Linux and Unix)

Version 4

    Squid (Linux and Unix)

    This template allows you to monitor the performance of a Squid proxy server installed on a Linux/Unix machine by using SNMP monitors and Perl scripts.

    Prerequisites: SSH and Perl must be installed and properly configured on the target server. SNMP should be installed and configured for monitoring squid process on target server. Squid SNMP module must be configured on target server:

    On Linux/Unix, to enable the SNMP module on Squid, you should use the --enable-snmpoption when running ./configureand recompile Squid. Starting from version 3, it should be enabled by default.
    For SNMP, Squid uses UDP port 3401 by default. You can change this port by using the snmp_port directive in the squid.conffile.

     

    The following configuration should be present in the squid.conf file:

    acl Snmppublic snmp_community <your_community_string>
    acl APMhost src <IP_address_of_SAM_server>
    snmp_access allow APMhost Snmppublic

    For example:

    acl Snmppublic snmp_community public
    acl APMhost src 192.168.2.3
    snmp_access allow APMhost Snmppublic

    After these changes are made, restart Squid.

    Credentials: Root on the target server.

    Note: Tested on Squid 3.1 for Linux/Unix.

    Components Monitors

    Storage Mem Size

    This monitor returns the amount of memory (in kilobytes) currently used to store in-memory objects.

    OID: 1.3.6.1.4.1.3495.1.1.2.0

    Storage Swap Size

    This monitor returns the amount of disk space (in kilobytes) currently used to store on-disk objects.

    OID: 1.3.6.1.4.1.3495.1.1.2.0

    Page Faults

    This monitor returns the number of page faults for the Squid process since it was started.

    OID: 1.3.6.1.4.1.3495.1.3.1.1.0

    Http Reads

    This monitor returns the number of times this process called read( ) on HTTP sockets connected to origin servers and neighbor caches.

    OID: 1.3.6.1.4.1.3495.1.3.1.2.0

    Accounted Memory

    This monitor returns the amount of memory allocated by the memory pooling routines. Not the same as the total memory used by Squid.

    OID: 1.3.6.1.4.1.3495.1.3.1.3.0

    Cpu Usage (%)

    This monitor returns the CPU utilization, as a percentage, since Squid was started.

    OID: 1.3.6.1.4.1.3495.1.3.1.5.0

    Stored Objects

    This monitor returns the total number of objects currently in the cache.

    OID: 1.3.6.1.4.1.3495.1.3.1.7.0

    Available File Descriptors

    This monitor returns the current number of available (unused) file descriptors.

    OID: 1.3.6.1.4.1.3495.1.3.1.10.0

    Reserved File Descriptors

    This monitor returns the number of reserved file descriptors.

    OID: 1.3.6.1.4.1.3495.1.3.1.11.0

    Http Requests Received

    This monitor returns the total number of HTTP requests received from cache clients.

    OID: 1.3.6.1.4.1.3495.1.3.2.1.1.0

    Http Hits

    This monitor returns the number of client requests that were cache hits.

    OID: 1.3.6.1.4.1.3495.1.3.2.1.2.0

    Http Errors

    This monitor returns the number of client requests that resulted in an error.

    OID: 1.3.6.1.4.1.3495.1.3.2.1.3.0

    Http Received (KB)

    This monitor returns the amount of network traffic, in kilobytes, read from cache clients.

    OID: 1.3.6.1.4.1.3495.1.3.2.1.4.0

    Http Transmitted (KB)

    This monitor returns the amount of network traffic, in kilobytes, written to cache clients.

    OID: 1.3.6.1.4.1.3495.1.3.2.1.5.0

    ICP Transmitted (KB)

    This monitor returns the amount of network traffic, in kilobytes, used for ICP messages sent to neighbors, not including UDP and IP headers.

    OID: 1.3.6.1.4.1.3495.1.3.2.1.8.0

    ICP Received (KB)

    This monitor returns the amount of network traffic, in kilobytes, used for ICP messages received from neighbors, not including UDP and IP headers.

    OID: 1.3.6.1.4.1.3495.1.3.2.1.9.0

    Requests From Clients

    This monitor returns the number of requests forwarded to origin servers and neighbor caches.

    OID: 1.3.6.1.4.1.3495.1.3.2.1.10.0

    Errors For Client Requests

    This monitor returns the number of errors received from origin servers and neighbor caches.

    OID: 1.3.6.1.4.1.3495.1.3.2.1.11.0

    Traffic Received From Servers (KB)

    This monitor returns the amount of network traffic, in kilobytes, read from origin servers and neighbor caches.

    OID: 1.3.6.1.4.1.3495.1.3.2.1.12.0

    Traffic Sent To Servers (KB)

    This monitor returns the amount of network traffic, in kilobytes, written to origin servers and neighbor caches.

    OID: 1.3.6.1.4.1.3495.1.3.2.1.13.0

    Clients

    This monitor returns the number of clients that sent HTTP requests to Squid since it was started.

    OID: 1.3.6.1.4.1.3495.1.3.2.1.15.0

    IP Cache Requests

    This monitor returns the number of requests received by Squid's IP cache. If the ratio of hits to requests is less than 60-75%, you may want to increase the size of your IP cache.

    OID: 1.3.6.1.4.1.3495.1.4.1.2.0

    IP Cache Hits

    This monitor returns the number of lookups that were hits in the IP cache. If the ratio of hits to requests is less than 60-75%, you may want to increase the size of your IP cache.

    OID: 1.3.6.1.4.1.3495.1.4.1.3.0

    IP Cache Negative Hits

    This monitor returns the number of lookups that were negative hits in the IP cache. Certain failed queries may be negatively cached for an amount of time determined by the negative_dns_ttl directive.

    OID: 1.3.6.1.4.1.3495.1.4.1.5.0

    IP Cache Misses

    This monitor returns the number of IP cache misses.

    OID: 1.3.6.1.4.1.3495.1.4.1.6.0

    FQDN Cache Requests

    This monitor returns the number of requests to the FQDN cache.

    OID: 1.3.6.1.4.1.3495.1.4.2.2.0

    FQDN Cache Hits

    This monitor returns the number of FQDN cache requests satisfied as hits.

    OID: 1.3.6.1.4.1.3495.1.4.2.3.0

    FQDN Cache Negative Hits

    This monitor returns the number of FQDN requests satisfied as negative cache hits.

    OID: 1.3.6.1.4.1.3495.1.4.2.5.0

    FQDN Cache Misses

    This monitor returns the number of FQDN cache misses.

    OID: 1.3.6.1.4.1.3495.1.4.2.6.0

    External DNS Server Requests

    This monitor returns the number of DNS queries made by Squid. This counter is reset each time you reconfigure the running Squid process.

    OID: 1.3.6.1.4.1.3495.1.4.3.1.0

    External DNS Server Replies

    This monitor returns the number of DNS replies received by Squid. This counter is reset each time you reconfigure the running Squid process.

    OID: 1.3.6.1.4.1.3495.1.4.3.2.0

    External DNS Server Processes

    For internal DNS (the default) this monitor reports the number of nameservers that Squid knows about. For external DNS, it reports the number of (running) dnsserver helper processes.

    OID: 1.3.6.1.4.1.3495.1.4.3.3.0

    Squid HTTP Port Monitor

    This component monitor tests the ability of a Squid service to accept incoming sessions. By default it monitors 3128 TCP port.

    Top 10 Active Sites

    This monitor returns the top 10 of the most visited sites for specific proxy client.

    Note: You must specify the correct arguments for this component in the Script Arguments field. This monitor uses the following argument structure:

    perl ${SCRIPT} IP_address Path_to_logfile Time

    1)     IP_address– This is the IP address of the computer that uses the target squid server as a proxy server. This argument allows SAM to monitor specific proxy clients.

    2)     Path_to_logfile– This is the full path to the squid access.log file.

    3)     Time– This argument allows a user to get the statistics during the last minute/hour/day/week/month/year.

     

    For example: if you set Day, you will get the statistic for the last day.

     

    Possible values: Minute, Hour, Day, Week, Month, Year. By default, this is set to Week.

    For Example:

     

    perl ${SCRIPT} 192.168.2.211 /var/log/squid/access.log week

    Note: On some machines (Solaris, HP-UX, etc.), this component may not work because SAM cannot copy all of the script to the target server. You should manually copy this script to the target machine. Next, you should change the Script Arguments field by changing ${SCRIPT} to the scripts path.

     

    For example: perl /tmp/top10active.pl 192.168.2.211 /var/log/squid/access.log week

    Top 10 Blocked Sites

    This monitor returns the top 10 blocked sites which the proxy client tried to open.

    Note: You must specify the correct arguments for this component in the Script Arguments field. This monitor uses the following argument structure:

    perl ${SCRIPT} IP_address Path_to_logfile Time

    1)     IP_address– This is the IP address of the computer that uses the target squid server as a proxy server. This argument allows SAM to monitor specific proxy clients.

    2)     Path_to_logfile– This is the full path to the squid access.log file.

    3)     Time– This argument allows the user to get statistics during the last minute/hour/day/week/month/year.

     

    For example: If you set Day, you will get the statistic for the last day.

     

    Possible values: Minute, Hour, Day, Week, Month, Year. By default, this is set to Week.

    For Example:

     

    perl ${SCRIPT} 192.168.2.211 /var/log/squid/access.log week

    Note: On some machines (Solaris, HP-UX, etc.), this component may not work because SAM cannot copy all of the script to the target server. You should manually copy this script to the target machine. Next, you should change the Script Arguments field by changing ${SCRIPT} to the scripts path.

     

    For example: perl /tmp/top10blocked.pl 192.168.2.211 /var/log/squid/access.log week

    Traffic Statistic

    This monitor returns the total download and upload amount of traffic in MB for specific proxy client.

    Note: You must specify the correct arguments for this component in the Script Arguments field. This monitor uses the following argument structure:

    perl ${SCRIPT} IP_address Path_to_logfile Time

    1)     IP_address– This is the IP address of computer that uses the target squid server as a proxy server. This argument allows SAM to monitor specific proxy clients.

    2)     Path_to_logfile– This is the full path to the squid access.log file.

    3)     Time– This argument allows a user to get statistics during the last minute/hour/day/week/month/year.

     

    For example: If you set Day, you will get the statistic for the last day.

     

    Possible values: Minute, Hour, Day, Week, Month, Year. By default, this it set to Week.

    For Example:

     

    perl ${SCRIPT} 192.168.2.211 /var/log/squid/access.log week

    Note: On some machines (Solaris, HP-UX, etc.), this component may not work because SAM cannot copy all of the script to the target server. You should manually copy this script to the target machine. Next, you should change the Script Arguments field by changing ${SCRIPT} to the scripts path.

     

    For example: perl /tmp/squid_traffic.pl 192.168.2.211 /var/log/squid/access.log week

    Process: squid

    This monitor returns the CPU and memory usage of the Squid process.

     

    Portions of this document were originally created by and are excerpted from the following sources:

    O'Reilly Media, Inc., “O’Reilly Squid the Definitive Guide,” Copyright © 2004 O'Reilly Media, Inc. 

    All rights reserved. Available at http://www.scribd.com/sivatcs/d/77305197-O-Reilly-Squid-the-Definitive-Guide.