-
Notifications
You must be signed in to change notification settings - Fork 267
/
yaws_hits_
executable file
·60 lines (47 loc) · 1.15 KB
/
yaws_hits_
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
#!/bin/bash
#
# YAWS server hits
#
# Needs following minimal configuration in plugin-conf.d/munin-node:
# [yaws*]
# user root
#
# Magick markers
#%# family=auto
#%# capabilities=autoconf
ID=`basename $0 | sed 's/^yaws_hits_//g'`
TMPFILE=.yaws_hits_$ID
STATS=`yaws --stats --id $ID | tail --lines=+2 > $TMPFILE`
if [ "$1" = "autoconf" ]; then
if which yaws > /dev/null; then
echo yes
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo graph_title Hits for server $ID
echo graph_vlabel Hits
echo graph_category Yaws
echo graph_args --base 1024 -l 0
while read line; do
HOST=`echo $line | awk '{ print $1 }'`
FIELD=`echo $HOST | sed 's/[\.:]/_/g'`
echo $FIELD.label $HOST
echo $FIELD.draw LINE2
echo $FIELD.type DERIVE
echo $FIELD.min 0
done < $TMPFILE
rm -f $TMPFILE
exit 0
fi
while read line; do
HOST=`echo $line | awk '{ print $1 }'`
FIELD=`echo $HOST | sed 's/[\.:]/_/g'`
HITS=`echo $line | awk '{ print $4 }'`
echo $FIELD.value $HITS
done < $TMPFILE
rm -f $TMPFILE
exit 0