-
Notifications
You must be signed in to change notification settings - Fork 3
/
glusterfsd_calls
executable file
·54 lines (46 loc) · 1.33 KB
/
glusterfsd_calls
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
#!/bin/sh
#
# Plugin created by Adrian Rollett, based on nfsd plugin
#%# family=auto
#%# capabilities=autoconf
DAEMON='glusterfsd'
CLIENTFS='/gluster/gluster'
LOGFILE='/var/log/glusterfs/glusterfsd.vol.log'
proc="STAT STATFS SETXATTR GETXATTR OPENDIR LOOKUP READDIR INODELK XATTROP MKNOD"
if [ "$1" = "autoconf" ]; then
if ps -C "$DAEMON" >/dev/null; then
echo yes
exit 0
else
echo "no (no $DAEMON)"
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title GlusterFS Server calls'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel requests / ${graph_period}'
echo 'graph_total total'
echo 'graph_category GlusterFS Calls'
for a in $proc ; do echo "$a.label $a" ; echo "$a.type DERIVE"; echo "$a.min 0"; done
exit 0
fi
i=4;
if ps -C "$DAEMON" >/dev/null;
then
TMPFILE=`tempfile`
# The io-debug xlator requires us to set a file xattr in order to dump stats.
setfattr -n trusted.io-stats-dump $CLIENTFS
# Now we immediately get the last 200 lines of the server's logfile. This should
# almost certainly get the stats we need.
tail -200 $LOGFILE > $TMPFILE
FIRSTLINE=`sed -n '/=== Cumulative stats ===/ =' $TMPFILE|tail -1`
for a in $proc; do
echo -n "$a.value "
tail -n +$FIRSTLINE $TMPFILE | grep "${a} : [0-9]\+$" | head -1 | awk '{print $NF}'
done
rm $TMPFILE
else
echo "Cannot read $DAEMON" >&2
exit -1
fi