blob: 4185e1bf609be9a9bd240c6855ae6220db7d9c03 (
plain)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
#!/bin/sh
. $PCP_DIR/etc/pcp.env
tmp=`mktemp -d /var/tmp/pcp.XXXXXXXXX` || exit 1
trap "rm -rf $tmp; exit" 0 1 2 3 15
echo "/\"/s///g" >$tmp/sed
pmprobe -I $* web.perserver.bytes.cached.total web.perserver.bytes.total > $tmp/pmprobe
l1=`head -n 1 $tmp/pmprobe`
l2=`tail -n 1 $tmp/pmprobe`
num_caches=`echo $l1 | cut -f2 -d\ `
num_servers=`echo $l2 | cut -f2 -d\ `
if [ $num_servers -gt 0 ]
then
caches=`echo $l1 | cut -f3- -d\ `
servers=`echo $l2 | cut -f3- -d\ `
# hostname=`echo $servers | cut -f1 -d: | sed -f $tmp/sed`
if [ $num_caches -le 0 ]
then
# an old pmda - quietly handle all servers as if they were CERN - show only totals
caches="NeVeR_MaTcH"
num_caches=0
fi
elif [ $num_servers -eq 0 ]
then
$PCP_XCONFIRM_PROG -c -B OK -header "No Active Servers - cannot continue" \
-t "$message" \
-icon info > /dev/null
exit
else
message=`pmerr $num_servers | cut -f5- -d\ `
$PCP_XCONFIRM_PROG -c -B OK -header "Fatal error - cannot continue" \
-t "$message" \
-icon error > /dev/null
exit
fi
#
# if too many instances, turn off all legends
#
legendp=on
if [ $num_servers -gt 6 ]
then
legendp=off
fi
if [ $num_servers -gt 12 ]
then
$PCP_XCONFIRM_PROG -c -B Cancel -b Continue -header \
"Too many charts" \
-t "There is 1 chart per server, more than can reasonably be displayed on the screen" \
-icon warning | grep Cancel >/dev/null
if [ $? -eq 0 ]
then
exit
fi
fi
# chart preamble
#
cat > $tmp/base <<End-of-File
#pmchart
Version 2.0 host dynamic
End-of-File
if [ $num_caches -ne $num_servers ]
then
echo Chart Title \"Total Requests serviced by all servers \" Style bars Legend off>> $tmp/base
echo Plot Color \#FF3030 Host \* Metric web.allservers.requests.total >> $tmp/base
echo Chart Title \"Total Bytes sent by all servers \" Style bars Legend off>> $tmp/base
echo Plot Color \#FF3030 Host \* Metric web.allservers.bytes.total >> $tmp/base
fi
if [ $num_caches -gt 0 ]
then
echo Chart Title \"Total Requests serviced by caching servers \" Style stacking Legend $legendp >> $tmp/base
echo Plot Color \#FFFF30 Host \* Metric web.allservers.requests.client.total >> $tmp/base
echo Plot Color \#3030FF Host \* Metric web.allservers.requests.cached.total >> $tmp/base
echo Plot Color \#FF3030 Host \* Metric web.allservers.requests.uncached.total >> $tmp/base
echo Chart Title \"Total Bytes sent by caching servers \" Style stacking Legend $legendp >> $tmp/base
echo Plot Color \#3030FF Host \* Metric web.allservers.bytes.cached.total >> $tmp/base
echo Plot Color \#FF3030 Host \* Metric web.allservers.bytes.uncached.total >> $tmp/base
fi
cat $tmp/base
rm -rf $tmp
|