3 # Copyright (C) 2008 Olivier DELHOMME. All rights reserved.
 
   4 # License GPL V2 or higher
 
   7 # munin plugin that logs the cache mean services times 
 
  10 #  . Olivier Delhomme <olivierdelhomme at gmail dot com>
 
  14 #%# capabilities=autoconf
 
  16 if [ "$1" = "autoconf" ]; then
 
  17         SQUID_STATS=$(squidclient -h 127.0.0.1 cache_object://localhost/info)
 
  18         if [ -n "${SQUID_STATS}" ]; then
 
  22                 echo "no (HTTP GET failed)"
 
  27 if [ "$1" = "config" ]; then
 
  28         echo 'graph_title Squid Median Services Times'
 
  29         echo 'graph_info This graph shows the proxy median services response times.'
 
  30         echo 'graph_category squid'
 
  31         echo 'graph_args --lower-limit 0'
 
  32         echo 'graph_vlabel median reponse times (s)'
 
  34         echo 'mean_http.label Http'
 
  35         echo 'mean_cmis.label Cache misses'     
 
  36         echo 'mean_chits.label Cache hits'
 
  37         echo 'mean_nhits.label Near hits'
 
  38         echo 'mean_nmr.label Not-modified replies'
 
  39         echo 'mean_dnsl.label Dns lookups'
 
  40         echo 'mean_icpq.label Icp queries'
 
  45 SQUID_TIME=$(squidclient -h 127.0.0.1 cache_object://localhost/info)
 
  47 SQUID_TIME_HTTP=$(echo "$SQUID_TIME" | grep "HTTP Requests (All)" | cut -d':' -f2 | sed -e "s/^\ *//" | cut -d' ' -f1)
 
  48 SQUID_TIME_CACHE_MISSES=$(echo "$SQUID_TIME" | grep "Cache Misses" | cut -d':' -f2 | sed -e "s/^\ *//" | cut -d' ' -f1)
 
  49 SQUID_TIME_CACHE_HITS=$(echo "$SQUID_TIME" | grep "Cache Hits" | cut -d':' -f2 | sed -e "s/^\ *//" | cut -d' ' -f1)
 
  50 SQUID_TIME_NEAR_HITS=$(echo "$SQUID_TIME" | grep "Near Hits" | cut -d':' -f2 | sed -e "s/^\ *//" | cut -d' ' -f1)
 
  51 SQUID_TIME_NM_REPLIES=$(echo "$SQUID_TIME" | grep "Not-Modified Replies" | cut -d':' -f2 | sed -e "s/^\ *//" | cut -d' ' -f1)
 
  52 SQUID_TIME_DNS_LOOKUPS=$(echo "$SQUID_TIME" | grep "DNS Lookups" | cut -d':' -f2 | sed -e "s/^\ *//" | cut -d' ' -f1)
 
  53 SQUID_TIME_ICP_QUERIES=$(echo "$SQUID_TIME" | grep "ICP Queries" | cut -d':' -f2 | sed -e "s/^\ *//" | cut -d' ' -f1)
 
  55 echo "mean_http.value $SQUID_TIME_HTTP"
 
  56 echo "mean_cmis.value $SQUID_TIME_CACHE_MISSES"
 
  57 echo "mean_chits.value $SQUID_TIME_CACHE_HITS" 
 
  58 echo "mean_nhits.value $SQUID_TIME_NEAR_HITS"
 
  59 echo "mean_nmr.value $SQUID_TIME_NM_REPLIES"
 
  60 echo "mean_dnsl.value $SQUID_TIME_DNS_LOOKUPS"
 
  61 echo "mean_icpq.value $SQUID_TIME_ICP_QUERIES"