Online Book Reader

Home Category

Squid_ The Definitive Guide - Duane Wessels [157]

By Root 2074 0
and check the graphs at least daily. See Figure 14-2 for some samples from one of my own Squid boxes.

Figure 14-2. Some sample RRD graphs from RRDTool and cache manager data

You can find my scripts and instructions for integrating the cache manager and RRDTool at http://www.squid-cache.org/~wessels/squid-rrd/.

* * *

[1] In older versions of Squid, it was called just client.

[2] diskd also opens files asynchronously, but those file descriptors belong to the diskd processes, not the squid process.

Using SNMP

Squid has a built-in SNMP agent that you can query with various SNMP client tools. It allows you to collect a few basic statistics from Squid. Unfortunately, the Squid MIB has not evolved much since its initial implementation. Many of the parameters that you'd like to monitor aren't available through the SNMP MIB. Perhaps this will be rectified in a future version.

To enable SNMP in Squid, use the —enable-snmp option when running ./configure and recompile if necessary. Squid uses UDP port 3401 for SNMP by default. You can use a different port by setting the snmp_port directive.

Use the snmp_access access list and snmp_community ACL type to define an access policy for the SNMP agent. For example:

acl Snmppublic snmp_community public

acl Adminhost src 192.168.1.1

snmp_access allow Adminhost Snmppublic

In this case, Squid accepts SNMP requests from 192.168.1.1 with the community name set to public.

Using snmpwalk and snmpget

The NET-SNMP package (http://net-snmp.sourceforge.net/) provides a good implementation of the snmpwalk and snmpget command-line tools for Unix. The former walks through an SNMP MIB tree, displaying every value, while the latter prints the value for a single MIB object.

After installing NET-SNMP, copy the Squid MIB file to the directory where the utilities can find it. By default, this is the /usr/local/share/snmp/mibs directory:

# cp squid-2.5.STABLE4/src/mib.txt /usr/local/share/snmp/mibs/SQUID-MIB.txt

# chmod 644 /usr/local/share/snmp/mibs/SQUID-MIB.txt

You should then be able to use the snmpget command. Note that Squid is an SNMPv1 agent:

% snmpget -v 1 -c public -m SQUID-MIB localhost:3401 cacheDnsSvcTime.5

SQUID-MIB::cacheDnsSvcTime.5 = INTEGER: 44

If you want to see the entire Squid MIB tree, use snmpwalk. The -Cc option tells snmpwalk to ignore nonincreasing OIDs:

% snmpwalk -v 1 -c public -m SQUID-MIB -Cc localhost:3401 squid | less

If you can't get the Squid MIB installed so that snmpwalk sees it, you can use the numeric OID value instead:

% snmpwalk -v 1 -c public -m SQUID-MIB -Cc localhost:3401 .1.3.6.1.4.1.3495.1 | less

The Squid MIB

In this section, I provide a brief description for each OID in the Squid MIB, which lives in the global MIB tree under iso.org.dod.internet.private.enterprises.nlanr.squid, or .1.3.6.1.4.1.3495.1. The full MIB names, such as cachePerf.cacheProtoStats.cacheMedianSvcTable.cacheMedianSvcEntry.cacheHttpMissSvcTime.60, take up too much space on the page. Instead, I'll just use the last nonnumeric component of the OID name, which is unique.

cacheSysVMsize

The amount of memory (in kilobytes) currently used to store in-memory objects. For example:

SQUID-MIB::cacheSysVMsize = INTEGER: 10224

cacheSysStorage

The amount of disk space (in kilobytes) currently used to store on-disk objects. For example:

SQUID-MIB::cacheSysStorage = INTEGER: 19347723

cacheUptime

The amount of time (number of seconds) since Squid was started.

SQUID-MIB::cacheUptime = Timeticks: (33239630) 3 days, 20:19:56.30

cacheAdmin

The email address, or name, of the cache administrator. For example:

SQUID-MIB::cacheAdmin = STRING: wessels@bo2.us.ircache.net

cacheSoftware

The name of the application. For example:

SQUID-MIB::cacheSoftware = STRING: squid

cacheVersionId

The application's version identification. For example:

SQUID-MIB::cacheVersionId = STRING: "2.5.STABLE4"

cacheLoggingFacility

The current debugging levels, from the debug_options directive. For example:

SQUID-MIB::cacheLoggingFacility = STRING: ALL,1

Return Main Page Previous Page Next Page

®Online Book Reader