root / plugins / squid / squid_times @ ef960abc
Historique | Voir | Annoter | Télécharger (2,27 ko)
| 1 | 10b445b7 | Olivier DELHOMME | #!/bin/sh |
|---|---|---|---|
| 2 | # |
||
| 3 | # Copyright (C) 2008 Olivier DELHOMME. All rights reserved. |
||
| 4 | # License GPL V2 or higher |
||
| 5 | # |
||
| 6 | # Abstract |
||
| 7 | # munin plugin that logs the cache mean services times |
||
| 8 | # Requires netcat (here nc) |
||
| 9 | # |
||
| 10 | # Authors |
||
| 11 | # . Olivier Delhomme <olivierdelhomme at gmail dot com> |
||
| 12 | # |
||
| 13 | #%# family=auto |
||
| 14 | #%# capabilities=autoconf |
||
| 15 | |||
| 16 | if [ "$1" = "autoconf" ]; then |
||
| 17 | SQUID_STATS=`printf "GET cache_object://localhost/info HTTP/1.0\n\n" | netcat localhost 3128` |
||
| 18 | if [ -n "${SQUID_STATS}" ]; then
|
||
| 19 | echo yes |
||
| 20 | exit 0 |
||
| 21 | else |
||
| 22 | echo "no (HTTP GET failed)" |
||
| 23 | exit 1 |
||
| 24 | fi |
||
| 25 | fi |
||
| 26 | |||
| 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)' |
||
| 33 | |||
| 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' |
||
| 41 | |||
| 42 | exit 0 |
||
| 43 | fi |
||
| 44 | |||
| 45 | SQUID_TIME=$(printf "GET cache_object://localhost/info HTTP/1.0\n\n" | nc localhost 3128) |
||
| 46 | |||
| 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) |
||
| 54 | |||
| 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" |
