-
Notifications
You must be signed in to change notification settings - Fork 0
/
squid_storeid_avg
executable file
·51 lines (42 loc) · 1.42 KB
/
squid_storeid_avg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
#
# (c) 2017,2022 Yuri Voinov <yvoinov@gmail.com>
#
#
# [squid_storeid]
# env.hostname localhost
# env.port 3128
#
. $MUNIN_LIBDIR/plugins/plugin.sh
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
# Defaults if no configuration
l_host=${l_host:="localhost"}
l_port=${l_port:="3128"}
l_grap_limit=${l_graph_limit:=2000}
l_max=${l_max:=1000}
# Utilities
l_client="/usr/local/squid/bin/squidclient"
l_grep="/bin/grep"
l_cut="/bin/cut"
# Get helper version if any
l_helper="`$l_client -h $l_host -p $l_port cache_object://$l_host/ mgr:store_id | $l_grep -i "program:" | $l_cut -f2 -d":" | $l_cut -f2 -d" "`"
l_version="`$l_helper -v 2>&1 | $l_grep Version | $l_cut -c 9-15`"
# store-ID average total stats
if [ "$1" = "config" ]; then
echo "graph_title Store-ID $l_version average service time"
echo "graph_args --base 1000 -l 0 --upper-limit $l_graph_limit --rigid"
echo "graph_vlabel ms"
echo "graph_scale yes"
echo "graph_category squid"
echo "graph_info This graph shows the store-ID Squid''s average service time"
echo "service_time.label Avg.service time"
echo "service_time.max $l_max"
echo "service_time.min 0"
echo "service_time.info Average store ID latency in milliseconds"
echo "service_time.draw AREASTACK"
exit 0
fi
echo "service_time.value" `$l_client -h $l_host -p $l_port cache_object://$l_host/ mgr:store_id | $l_grep -i "avg service time" | $l_cut -f2 -d":" | $l_cut -f2 -d" "`