-
Notifications
You must be signed in to change notification settings - Fork 0
/
nfs_stats.sh
executable file
·53 lines (38 loc) · 1.24 KB
/
nfs_stats.sh
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
#!/usr/bin/bash
source $(dirname "$0")/ENV_FILE
/usr/sbin/dtrace -n '
#pragma D option quiet
#pragma D option defaultargs
inline int TOP_FILES = 10;
nfsv3:::op-read-start,
nfsv4:::op-read-start,
nfsv3:::op-write-start,
nfsv4:::op-write-start
{
start[args[1]->noi_xid] = timestamp;
}
nfsv3:::op-read-done, nfsv3:::op-write-done /start[args[1]->noi_xid] != 0/
{
this->elapsed = timestamp - start[args[1]->noi_xid];
@rw[probename == "op-read-done" ? "nfsv3-op-read-latency" : "nfsv3-op-write-latency"] =
avg(this->elapsed / 1000);
start[args[1]->noi_xid] = 0;
}
nfsv4:::op-read-done, nfsv4:::op-write-done /start[args[1]->noi_xid] != 0/
{
this->elapsed = timestamp - start[args[1]->noi_xid];
@rw[probename == "op-read-done" ? "nfsv4-op-read-latency" : "nfsv4-op-write-latency"] =
avg(this->elapsed / 1000);
start[args[1]->noi_xid] = 0;
}
profile:::tick-14sec / ticks > 0 / { ticks--; }
profile:::tick-14sec
{
printa(@rw);
}
profile:::tick-56sec {exit(0);} ' | \
gawk -v hostname=$HOSTNAME -v influx_srv=$INFLUX_SRV '
/nfs/ {
system("/usr/bin/curl -XPOST http://" influx_srv ":8086/write?db=znstor --data-binary \"nfs_stats,host=" hostname " "$1"="$2"\"")
}
'