14.3 Using SNMP

 <  Day Day Up  >  

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 .

14.3.1 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 

14.3.2 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 

cacheMemMaxSize

The value of the cache_mem directive, in megabytes. For example:

 SQUID-MIB::cacheMemMaxSize = INTEGER: 10 

cacheSwapMaxSize

The total amount of disk storage, in megabytes, taken from the sum of all cache_dir lines. For example:

 SQUID-MIB::cacheSwapMaxSize = INTEGER: 21000 

cacheSwapHighWM

The high watermark percentage for disk storage, taken from the cache_swap_high directive. For example:

 SQUID-MIB::cacheSwapHighWM = INTEGER: 95 

cacheSwapLowWM

The low watermark percentage for disk storage, taken from the cache_swap_low directive. For example:

 SQUID-MIB::cacheSwapLowWM = INTEGER: 90 

cacheSysPageFaults

The number of page faults for the Squid process since it was started. (See "Page faults with physical i/o" in Section 14.2.1.24.) For example:

 SQUID-MIB::cacheSysPageFaults = Counter32: 9 

cacheSysNumReads

The number of times this process called read( ) on HTTP sockets connected to origin servers and neighbor caches. For example:

 SQUID-MIB::cacheSysNumReads = Counter32: 15941979 

cacheMemUsage

The amount of memory allocated by the memory pooling routines. Not the same as the total memory used by Squid. (See "Total accounted" in Section 14.2.1.24.) For example:

 SQUID-MIB::cacheMemUsage = INTEGER: 143709 

cacheCpuTime

The amount of CPU time, in seconds, accumulated by the Squid process. For example:

 SQUID-MIB::cacheCpuTime = INTEGER: 79313 

cacheCpuUsage

The mean CPU utilization, as a percentage, since Squid was started. Unfortunately, since this value is an integer, any graphs that you make will be "quantized." For example:

 SQUID-MIB::cacheCpuUsage = INTEGER: 23 

cacheMaxResSize

The maximum resident set size, in kilobytes, for the Squid process. (See "Maximum Resident Size " in Section 14.2.1.24.) For example:

 SQUID-MIB::cacheMaxResSize = INTEGER: 219128 

cacheNumObjCount

The total number of objects currently in the cache. For example:

 SQUID-MIB::cacheNumObjCount = Counter32: 1717181 

cacheCurrentLRUExpiration

Current versions of Squid don't have a global LRU expiration age value, so this is always reported as zero. For example:

 SQUID-MIB::cacheCurrentLRUExpiration = Timeticks: (0) 0:00:00.00 

cacheCurrentUnlinkRequests

The number of files given to the external unlinkd process for removal. Note that Squid doesn't use unlinkd with the diskd and aufs storage schemes. For example:

 SQUID-MIB::cacheCurrentUnlinkRequests = Counter32: 0 

cacheCurrentUnusedFDescrCnt

The current number of available (unused) file descriptors. For example:

 SQUID-MIB::cacheCurrentUnusedFDescrCnt = Gauge32: 7253 

cacheCurrentResFileDescrCnt

The number of reserved file descriptors. (See "Reserved number of file descriptors" in Section 14.2.1.24.) For example:

 SQUID-MIB::cacheCurrentResFileDescrCnt = Gauge32: 100 

cacheProtoClientHttpRequests

The total number of HTTP requests received from cache clients . For example:

 SQUID-MIB::cacheProtoClientHttpRequests = Counter32: 7277019 

cacheHttpHits

The number of client requests that were cache hits. For example:

 SQUID-MIB::cacheHttpHits = Counter32: 2526484 

cacheHttpErrors

The number of client requests that resulted in an error. For example:

 SQUID-MIB::cacheHttpErrors = Counter32: 0 

cacheHttpInKb

The amount of network traffic, in kilobytes, read from cache clients. For example:

 SQUID-MIB::cacheHttpInKb = Counter32: 4231883 

cacheHttpOutKb

The amount of network traffic, in kilobytes, written to cache clients. For example:

 SQUID-MIB::cacheHttpOutKb = Counter32: 56894945 

cacheIcpPktsSent

The number of ICP messages (both queries and replies) sent to neighbors. For example:

 SQUID-MIB::cacheIcpPktsSent = Counter32: 5296120 

cacheIcpPktsRecv

The number of ICP messages (both queries and replies) received from neighbors. For example:

 SQUID-MIB::cacheIcpPktsRecv = Counter32: 5271238 

cacheIcpKbSent

The amount of network traffic, in kilobytes, used for ICP messages sent to neighbors, not including UDP and IP headers. For example:

 SQUID-MIB::cacheIcpKbSent = Counter32: 428112 

cacheIcpKbRecv

The amount of network traffic, in kilobytes, used for ICP messages received from neighbors, not including UDP and IP headers. For example:

 SQUID-MIB::cacheIcpKbRecv = Counter32: 447762 

cacheServerRequests

The number of requests forwarded to origin servers and neighbor caches. For example:

 SQUID-MIB::cacheServerRequests = INTEGER: 5338305 

cacheServerErrors

The number of errors received from origin servers and neighbor caches. Currently unimplemented and always reported as zero. For example:

 SQUID-MIB::cacheServerErrors = INTEGER: 0 

cacheServerInKb

The amount of network traffic, in kilobytes, read from origin servers and neighbor caches. For example:

 SQUID-MIB::cacheServerInKb = Counter32: 49196559 

cacheServerOutKb

The amount of network traffic, in kilobytes, written to origin servers and neighbor caches. For example:

 SQUID-MIB::cacheServerOutKb = Counter32: 3404717 

cacheCurrentSwapSize

The amount of disk space, in kilobytes, currently in use by Squid. Compare to cacheSysStorage . For example:

 SQUID-MIB::cacheCurrentSwapSize = Counter32: 19347723 

cacheClients

The number of clients that sent HTTP requests to Squid since it was started. For example:

 SQUID-MIB::cacheClients = Counter32: 498 

cacheMedianTime.X

These OIDs report the time intervals, in minutes, over which median values are computed for subsequent OIDs. The value is the same as the last number of the OID. For example:

 SQUID-MIB::cacheMedianTime.1 = INTEGER: 1 

cacheHttpAllSvcTime.X

The 1-, 5-, and 60-minute median service time values, in milliseconds , for all client HTTP requests. For example:

 SQUID-MIB::cacheHttpAllSvcTime.1 = INTEGER: 78 

cacheHttpMissSvcTime.X

The 1-, 5-, and 60-minute median service time values for cache misses. For example:

 SQUID-MIB::cacheHttpMissSvcTime.1 = INTEGER: 114 SQUID-MIB::cacheHttpMissSvcTime.5 = INTEGER: 87 SQUID-MIB::cacheHttpMissSvcTime.60 = INTEGER: 74 

cacheHttpNmSvcTime.X

The 1-, 5-, and 60-minute median service time values for requests logged as TCP_IMS_HIT . (See "Not-Modified Replies" in Section 14.2.1.24.) For example:

 SQUID-MIB::cacheHttpNmSvcTime.1 = INTEGER: 12 SQUID-MIB::cacheHttpNmSvcTime.5 = INTEGER: 34 SQUID-MIB::cacheHttpNmSvcTime.60 = INTEGER: 32 

cacheHttpHitSvcTime . X

The 1-, 5-, and 60-minute median service time values for cache hits, logged as TCP_HIT . For example:

 SQUID-MIB::cacheHttpHitSvcTime.1 = INTEGER: 45 SQUID-MIB::cacheHttpHitSvcTime.5 = INTEGER: 45 SQUID-MIB::cacheHttpHitSvcTime.60 = INTEGER: 40 

cacheIcpQuerySvcTime.X

The 1-, 5-, and 60-minute service time values for ICP queries sent by Squid (the time elapsed between sending your query and receiving a neighbor's reply). For example:

 SQUID-MIB::cacheIcpQuerySvcTime.1 = INTEGER: 0 SQUID-MIB::cacheIcpQuerySvcTime.5 = INTEGER: 0 SQUID-MIB::cacheIcpQuerySvcTime.60 = INTEGER: 3563 

cacheIcpReplySvcTime.X

The 1-, 5-, and 60-minute median service time values for ICP queries received by Squid. In current implementations , these are always zero because processing occurs faster than the process clock is updated. For example:

 SQUID-MIB::cacheIcpReplySvcTime.1 = INTEGER: 0 SQUID-MIB::cacheIcpReplySvcTime.5 = INTEGER: 0 SQUID-MIB::cacheIcpReplySvcTime.60 = INTEGER: 0 

cacheDnsSvcTime.X

The 1-, 5-, and 60-minute median service time values for Squid's DNS queries. For example:

 SQUID-MIB::cacheDnsSvcTime.1 = INTEGER: 40 SQUID-MIB::cacheDnsSvcTime.5 = INTEGER: 42 SQUID-MIB::cacheDnsSvcTime.60 = INTEGER: 42 

cacheRequestHitRatio.X

Squid's cache hit ratio (percentage) over the last 1, 5, and 60 minutes. For example:

 SQUID-MIB::cacheRequestHitRatio.1 = INTEGER: 16 SQUID-MIB::cacheRequestHitRatio.5 = INTEGER: 18 SQUID-MIB::cacheRequestHitRatio.60 = INTEGER: 22 

cacheRequestByteRatio.X

Squid's byte hit ratio (percentage) over the last 1, 5, and 60 minutes. For example:

 SQUID-MIB::cacheRequestByteRatio.1 = INTEGER: 73 SQUID-MIB::cacheRequestByteRatio.5 = INTEGER: 43 SQUID-MIB::cacheRequestByteRatio.60 = INTEGER: 34 

cacheIpEntries

The number of entries in Squid's IP ( name-to-address ) cache. For example:

 SQUID-MIB::cacheIpEntries = Gauge32: 10033 

cacheIpRequests

The number of requests received by Squid's IP cache. For example:

 SQUID-MIB::cacheIpRequests = Counter32: 8195627 

cacheIpHits

The number of lookups that were hits in the IP cache. For example:

 SQUID-MIB::cacheIpHits = Counter32: 6040658 

If the ratio of hits to requests is less than 60-75%, you may want to increase the size of your IP cache.


cacheIpPendingHits

Always zero in the current implementation. For example:

 SQUID-MIB::cacheIpPendingHits = Gauge32: 0 

Older versions of Squid had the notion of IP cache hits for outstanding queries.


cacheIpNegativeHits

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. For example:

 SQUID-MIB::cacheIpNegativeHits = Counter32: 49433 

cacheIpMisses

The number of IP cache misses. For example:

 SQUID-MIB::cacheIpMisses = Counter32: 1807438 

cacheBlockingGetHostByName

Always zero in the current implementation. For example:

 SQUID-MIB::cacheBlockingGetHostByName = Counter32: 0 

Older versions occasionally called the gethostbyname( ) function if the IP cache couldn't provide an answer.


cacheAttemptReleaseLckEntries

Always zero in the current implementation. Older versions would, in some cases, want to release locked IP cache entries. For example:

 SQUID-MIB::cacheAttemptReleaseLckEntries = Counter32: 0 

cacheFqdnEntries

The number of entries in the FQDN (address-to-name) cache. For example:

 SQUID-MIB::cacheFqdnEntries = Gauge32: 1 

cacheFqdnRequests

The number of requests to the FQDN cache. For example:

 SQUID-MIB::cacheFqdnRequests = Counter32: 0 

cacheFqdnHits

The number of FQDN cache requests satisfied as hits. For example:

 SQUID-MIB::cacheFqdnHits = Counter32: 0 

cacheFqdnPendingHits

Always zero in the current implementation. For example:

 SQUID-MIB::cacheFqdnPendingHits = Gauge32: 0 

cacheFqdnNegativeHits

The number of FQDN requests satisfied as negative cache hits. For example:

 SQUID-MIB::cacheFqdnNegativeHits = Counter32: 0 

cacheFqdnMisses

The number of FQDN cache misses. For example:

 SQUID-MIB::cacheFqdnMisses = Counter32: 0 

cacheBlockingGetHostByAddr

Always zero in the current implementation. For example:

 SQUID-MIB::cacheBlockingGetHostByAddr = Counter32: 0 

cacheDnsRequests

The number of DNS queries made by Squid. This counter is reset each time you reconfigure the running Squid process. For example:

 SQUID-MIB::cacheDnsRequests = Counter32: 3262 

cacheDnsReplies

The number of DNS replies received by Squid. This counter is reset each time you reconfigure the running Squid process. For example:

 SQUID-MIB::cacheDnsReplies = Counter32: 2440 

cacheDnsNumberServers

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

 SQUID-MIB::cacheDnsNumberServers = Counter32: 2 

cachePeerName.A.B.C.D

This, and the next group of OIDs, come from the list of neighbor caches. (See Section 14.2.1.50.) These OIDs are indexed by the IPv4 address of the peer. This particular OID returns the neighbor cache's hostname. For example:

 SQUID-MIB::cachePeerName.192.203.230.19 = STRING: sv.us.ircache.net 

cachePeerAddr.A.B.C.D

This is the IP address of the peer, which, of course, you already know from the OID itself. For example:

 SQUID-MIB::cachePeerAddr.192.203.230.19 = IpAddress: 192.203.230.19 

cachePeerPortHttp.A.B.C.D

This is the neighbor cache's HTTP port number. For example:

 SQUID-MIB::cachePeerPortHttp.192.203.230.19 = INTEGER: 3128 

cachePeerPortIcp.A.B.C.D

This is the neighbor cache's ICP or HTCP port number. For example:

 SQUID-MIB::cachePeerPortIcp.192.203.230.19 = INTEGER: 3130 

cachePeerType.A.B.C.D

The type of the neighbor: 1 for sibling, 2 for parent, and 3 for multicast. For example:

 SQUID-MIB::cachePeerType.192.203.230.19 = INTEGER: 1 

cachePeerState.A.B.C.D

The state of the peer: 1 for up, 0 for down. (See Section 10.3.2.) For example:

 SQUID-MIB::cachePeerState.192.203.230.19 = INTEGER: 1 

cachePeerPingsSent.A.B.C.D

The number of ICP/HTCP queries sent to the neighbor. For example:

 SQUID-MIB::cachePeerPingsSent.192.203.230.19 = Counter32: 924 

cachePeerPingsAcked.A.B.C.D

The number of ICP/HTCP queries received from the neighbor. For example:

 SQUID-MIB::cachePeerPingsAcked.192.203.230.19 = Counter32: 901 

cachePeerFetches.A.B.C.D

The number of HTTP requests sent to the neighbor. (See the discussion about FETCHES in Section 14.2.1.50.) For example:

 SQUID-MIB::cachePeerFetches.192.203.230.19 = Counter32: 34 

cachePeerRtt.A.B.C.D

The average round-trip time for ICP/HTCP queries to this peer. For example:

 SQUID-MIB::cachePeerRtt.192.203.230.19 = INTEGER: 26 

cachePeerIgnored.A.B.C.D

The number of ICP/HTCP replies that Squid ignored. (See the discussion about IGNORED in Section 14.2.1.50.) For example:

 SQUID-MIB::cachePeerIgnored.192.203.230.19 = Counter32: 201 

cachePeerKeepAlSent.A.B.C.D

The number of HTTP requests sent to the neighbor with a request to keep the connection open . For example:

 SQUID-MIB::cachePeerKeepAlSent.192.203.230.19 = Counter32: 34 

cachePeerKeepAlRecv.A.B.C.D

The number of HTTP replies received from the neighbor with a request to keep the connection open. For example:

 SQUID-MIB::cachePeerKeepAlRecv.192.203.230.19 = Counter32: 34 

cacheClientAddr.A.B.C.D

The cacheClientAddr OIDs come from the same database as the Cache Client List (see Section 14.2.1.46). This particular OID's value is the IPv4 address, just like the last four octets of the OID itself. For example:

 SQUID-MIB::cacheClientAddr.206.168.0.9 = IpAddress: 206.168.0.9 

cacheClientHttpRequests.A.B.C.D

The number of HTTP requests received from this client. For example:

 SQUID-MIB::cacheClientHttpRequests.206.168.0.9 = Counter32: 108281 

cacheClientHttpKb.A.B.C.D

The amount of traffic, in kilobytes, sent to this client. For example:

 SQUID-MIB::cacheClientHttpKb.206.168.0.9 = Counter32: 921447 

cacheClientHttpHits.A.B.C.D

The number of cache hits sent to this client. For example:

 SQUID-MIB::cacheClientHttpHits.206.168.0.9 = Counter32: 32365 

cacheClientHTTPHitKb.A.B.C.D

The amount of traffic, in kilobytes, sent to this client for cache hits. For example:

 SQUID-MIB::cacheClientHTTPHitKb.206.168.0.9 = Counter32: 141638 

cacheClientIcpRequests.A.B.C.D

The number of ICP (but not HTCP ) queries received from this client. For example:

 SQUID-MIB::cacheClientIcpRequests.206.168.0.9 = Counter32: 79120 

cacheClientIcpKb.A.B.C.D

The amount of traffic, in kilobytes, received from this client in ICP queries. For example:

 SQUID-MIB::cacheClientIcpKb.206.168.0.9 = Counter32: 5986 

cacheClientIcpHits.A.B.C.D

The number of ICP_HIT replies sent to this client. For example:

 SQUID-MIB::cacheClientIcpHits.206.168.0.9 = Counter32: 21897 

cacheClientIcpHitKb.A.B.C.D

The amount of traffic, in kilobytes, sent to this client for ICP_HIT messages. A somewhat silly measurement because ICP_HIT and ICP_MISS messages have the same size. However, old versions of Squid used the now-obsolete ICP_HIT_OBJ opcode, which included the object content. For example:

 SQUID-MIB::cacheClientIcpHitKb.206.168.0.9 = Counter32: 1679 
 <  Day Day Up  >  


Squid
Squid: The Definitive Guide
ISBN: 0596001622
EAN: 2147483647
Year: 2004
Pages: 401
Authors: Duane Wessels

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net