-
Notifications
You must be signed in to change notification settings - Fork 4
/
twemproxy_connections.stp
49 lines (42 loc) · 1.17 KB
/
twemproxy_connections.stp
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
# count twemproxy backend connections and timeouts
global count;
global total;
global timeouts;
global timedtotal;
probe begin { print_head(); }
function print_head()
{
ansi_clear_screen();
printf("Probing...Type CTRL+C to stop probing.\n");
}
probe process("/usr/local/bin/nutcracker").function("server_connect").return
{
sname = user_string($server->name->data);
etime = gettimeofday_ms() - @entry(gettimeofday_ms());
count[sname]++;
if (etime > 100)
timeouts[sname, etime] = ctime(gettimeofday_s());
}
probe timer.s(1)
{
print_head();
foreach(mc in count- limit 64) {
printf("%s\t%7.5d\n", mc, count[mc]);
total += count[mc];
}
printf("Total connections: %d\n", total);
println("--------------------------------");
foreach([sname, etime] in timeouts-) {
printf("%s %s %d ms\n", timeouts[sname, etime], sname, etime);
timedtotal++;
}
printf("Timed out connections: %d\n", timedtotal);
delete count;
delete total;
}
probe end
{
delete count;
delete total;
delete timeouts;
}