grafana.sim 9.9 KB
Newer Older
S
slguan 已提交
1
system sh/stop_dnodes.sh
S
scripts  
slguan 已提交
2
sleep 3000
S
slguan 已提交
3
system sh/deploy.sh -n dnode1 -i 1
H
hjxilinx 已提交
4
system sh/cfg.sh -n dnode1 -c walLevel -v 0
S
scripts  
slguan 已提交
5
system sh/cfg.sh -n dnode1 -c http -v 1
S
slguan 已提交
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
#system sh/cfg.sh -n dnode1 -c adminRowLimit -v 10
system sh/cfg.sh -n dnode1 -c httpDebugFlag -v 135
system sh/exec.sh -n dnode1 -s start

sleep 3000
sql connect

print ============================ dnode1 start

print ===============  step1 - prepare data

sql create database d1
sql use d1
sql create table table_gc (ts timestamp, db binary(10), tb binary(20), col binary(20))
sql create table m1 (ts timestamp, v1 int, v2 float)
sql create table m2 (ts timestamp, v1 int, v2 float)

sql insert into table_gc values('2017-12-25 21:28:41.022', 'd1', 'm1', 'v1') 
sql insert into table_gc values('2017-12-25 21:28:42.022', 'd1', 'm1', 'v2') 
sql insert into table_gc values('2017-12-25 21:28:43.022', 'd1', 'm2', 'v1') 
sql insert into table_gc values('2017-12-25 21:28:44.022', 'd1', 'm2', 'v2') 

sql insert into m1 values(1514208523020, 1, 4.1)
sql insert into m1 values(1514208523021, 2, 5.1)
sql insert into m1 values(1514208523022, 3, 6.1)

sql insert into m2 values(1514208523024, 3, 6.1)
sql insert into m2 values(1514208523025, 2, 5.1)
sql insert into m2 values(1514208523026, 1, 4.1)

sql create table mt (ts timestamp, i int) tags(a int, b binary(10))
sql create table t1 using mt tags (1, 'a')
sql create table t2 using mt tags (2, 'b')
sql create table t3 using mt tags (3, 'c')
sql insert into t1 values('2017-12-25 21:25:41', 1)
sql insert into t1 values('2017-12-25 21:26:41', 1)
sql insert into t1 values('2017-12-25 21:27:41', 1)
sql insert into t1 values('2017-12-25 21:28:41', 1)
sql insert into t1 values('2017-12-25 21:29:41', 1)
sql insert into t2 values('2017-12-25 21:25:41', 2)
sql insert into t2 values('2017-12-25 21:26:41', 2)
sql insert into t2 values('2017-12-25 21:27:41', 2)
sql insert into t2 values('2017-12-25 21:28:41', 2)
sql insert into t3 values('2017-12-25 21:25:41', 3)
sql insert into t3 values('2017-12-25 21:26:41', 3)
sql insert into t3 values('2017-12-25 21:27:41', 3)

print ===============  step2 - login

S
Shengliang Guan 已提交
55
system_content curl 127.0.0.1:6041/grafana/
S
slguan 已提交
56
print 1-> $system_content
S
Shengliang Guan 已提交
57
if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then
S
slguan 已提交
58 59 60
  return -1
endi

S
Shengliang Guan 已提交
61
system_content curl 127.0.0.1:6041/grafana/xx
S
slguan 已提交
62
print 2-> $system_content
S
Shengliang Guan 已提交
63
if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then
S
slguan 已提交
64 65 66
  return -1
endi

S
Shengliang Guan 已提交
67
system_content curl 127.0.0.1:6041/grafana/login/xx/xx/
S
slguan 已提交
68
print 3-> $system_content
69
if $system_content != @{"status":"error","code":849,"desc":"Invalid user"}@ then
S
slguan 已提交
70 71 72
  return -1
endi

S
Shengliang Guan 已提交
73
system_content curl 127.0.0.1:6041/grafana/root/1/123/1/1/3
S
slguan 已提交
74
print 4-> $system_content
S
Shengliang Guan 已提交
75
if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then
S
slguan 已提交
76 77 78
  return -1
endi

S
Shengliang Guan 已提交
79
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d 'show databases' 127.0.0.1:6041/grafana/login/1/root/1/
S
slguan 已提交
80
print 5-> $system_content
81
if $system_content != @{"status":"error","code":849,"desc":"Invalid user"}@ then
S
slguan 已提交
82 83 84
  return -1
endi

S
Shengliang Guan 已提交
85
system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi'  -d 'show databases' 127.0.0.1:6041/grafana/root/1/login
S
slguan 已提交
86
print 6-> $system_content
S
Shengliang Guan 已提交
87
if $system_content != @{"status":"error","code":5010,"desc":"invalid type of Authorization"}@ then
S
slguan 已提交
88 89 90
  return -1
endi

S
Shengliang Guan 已提交
91
system_content curl -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi'  -d 'show databases' 127.0.0.1:6041/grafana/root/1/login
S
slguan 已提交
92
print 7-> $system_content
S
Shengliang Guan 已提交
93
if $system_content != @{"status":"error","code":5010,"desc":"invalid type of Authorization"}@ then
S
slguan 已提交
94 95 96 97
  return -1
endi

sleep 3000
S
Shengliang Guan 已提交
98
system_content curl 127.0.0.1:6041/grafana/login/root/taosdata
S
slguan 已提交
99 100 101 102 103 104 105
print 8-> $system_content
if $system_content != @{"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"}@ then
  return -1
endi

print ===============  step3 - heartbeat

S
Shengliang Guan 已提交
106
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6041/grafana/d1/table_gc
S
slguan 已提交
107 108 109 110 111 112 113
print 9-> $system_content
if $system_content != @{"message":"Grafana server receive a quest from you!"}@ then
  return -1
endi

print ===============  step4 - search

S
Shengliang Guan 已提交
114
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6041/grafana/heartbeat
S
slguan 已提交
115 116 117 118 119
print 10-> $system_content
if $system_content != @{"message":"Grafana server receive a quest from you!"}@ then
  return -1
endi

S
Shengliang Guan 已提交
120
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6041/grafana/d1/table_invalid/search
S
slguan 已提交
121 122 123 124 125
print 11-> $system_content
if $system_content != @{"message":"Grafana server receive a quest from you!"}@ then
  return -1
endi

S
Shengliang Guan 已提交
126
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' 127.0.0.1:6041/grafana/d1/m1/search
S
slguan 已提交
127 128 129 130 131 132 133
print 12-> $system_content
if $system_content != @{"message":"Grafana server receive a quest from you!"}@ then
  return -1
endi

print ===============  step5 - query

S
Shengliang Guan 已提交
134
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"taosd","sql":"select first(v1) from d1.m1 where ts > 1514208523020 and ts < 1514208523030 interval(1m)"},{"refId":"B","alias":"system","sql":"select first(v2) from d1.m1 where ts > 1514208523020 and ts < 1514208523030 interval(1m)"}]'  127.0.0.1:6041/grafana/query
S
slguan 已提交
135 136 137 138 139
print 13-> $system_content
if $system_content != @[{"refId":"A","target":"taosd","datapoints":[[2,1514208480000]]},{"refId":"B","target":"system","datapoints":[[5.10000,1514208480000]]}]@ then
  return -1
endi

S
Shengliang Guan 已提交
140
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select first(v1) from d1.m1 where ts > 1514208523020 and ts < 1514208523030 interval(1m)"},{"refId":"B","alias":"","sql":"select first(v2) from d1.m1 where ts > 1514208523020 and ts < 1514208523030 interval(1m)"}]'  127.0.0.1:6041/grafana/query
S
slguan 已提交
141 142 143 144 145
print 14-> $system_content
if $system_content != @[{"refId":"A","target":"A","datapoints":[[2,1514208480000]]},{"refId":"B","target":"B","datapoints":[[5.10000,1514208480000]]}]@ then
  return -1
endi

S
Shengliang Guan 已提交
146
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select count(v1) from d1.m1"},{"refId":"B","alias":"","sql":"select count(v2) from d1.m1"}]'  127.0.0.1:6041/grafana/query
S
slguan 已提交
147 148 149 150 151
print 15-> $system_content
if $system_content != @[{"refId":"A","target":"A","datapoints":[[3,"-"]]},{"refId":"B","target":"B","datapoints":[[3,"-"]]}]@ then
  return -1
endi

S
Shengliang Guan 已提交
152
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select count(v1) from d1.m1"},{"refId":"B","alias":"","sql":"select count(v2) from d1.m1"}]'  127.0.0.1:6041/grafana/query
S
slguan 已提交
153 154 155 156 157
print 15-> $system_content
if $system_content != @[{"refId":"A","target":"A","datapoints":[[3,"-"]]},{"refId":"B","target":"B","datapoints":[[3,"-"]]}]@ then
  return -1
endi

S
Shengliang Guan 已提交
158
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select count(i) from d1.mt group by a"},{"refId":"B","alias":"","sql":"select sum(i) from d1.mt group by b"}]'  127.0.0.1:6041/grafana/query
S
slguan 已提交
159
print 16-> $system_content
S
scripts  
Shengliang Guan 已提交
160
if $system_content != @[{"refId":"A","target":"{a:1,}","datapoints":[[5,"-"]]},{"refId":"A","target":"{a:2,}","datapoints":[[4,"-"]]},{"refId":"A","target":"{a:3,}","datapoints":[[3,"-"]]},{"refId":"B","target":"{b:a}","datapoints":[[5,"-"]]},{"refId":"B","target":"{b:b}","datapoints":[[8,"-"]]},{"refId":"B","target":"{b:c}","datapoints":[[9,"-"]]}]@ then
S
slguan 已提交
161 162 163
  return -1
endi

S
Shengliang Guan 已提交
164
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"count","sql":"select count(i) from d1.mt group by a"},{"refId":"B","alias":"sum-","sql":"select sum(i) from d1.mt group by b"}]'  127.0.0.1:6041/grafana/query
S
slguan 已提交
165
print 17-> $system_content
S
scripts  
Shengliang Guan 已提交
166
if $system_content != @[{"refId":"A","target":"count{a:1,}","datapoints":[[5,"-"]]},{"refId":"A","target":"count{a:2,}","datapoints":[[4,"-"]]},{"refId":"A","target":"count{a:3,}","datapoints":[[3,"-"]]},{"refId":"B","target":"sum-{b:a}","datapoints":[[5,"-"]]},{"refId":"B","target":"sum-{b:b}","datapoints":[[8,"-"]]},{"refId":"B","target":"sum-{b:c}","datapoints":[[9,"-"]]}]@ then
S
slguan 已提交
167 168 169
  return -1
endi

S
Shengliang Guan 已提交
170
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"count","sql":"select count(i) from d1.mt interval(1m) group by a "}]'  127.0.0.1:6041/grafana/query
S
slguan 已提交
171
print 18-> $system_content
S
scripts  
Shengliang Guan 已提交
172
if $system_content != @[{"refId":"A","target":"count{a:1,}","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000],[1,1514208480000],[1,1514208540000]]},{"refId":"A","target":"count{a:2,}","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000],[1,1514208480000]]},{"refId":"A","target":"count{a:3,}","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000]]}]@ then
S
slguan 已提交
173 174 175
  return -1
endi

S
Shengliang Guan 已提交
176
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select sum(v2), count(v1) from d1.m1"},{"refId":"B","alias":"","sql":"select count(v2), sum(v2) from d1.m1"}]'  127.0.0.1:6041/grafana/query
S
slguan 已提交
177
print 19-> $system_content
S
scripts  
Shengliang Guan 已提交
178
if $system_content != @[{"refId":"A","target":"{count(v1):3}","datapoints":[[15.299999714,"-"]]},{"refId":"B","target":"{sum(v2):15.299999714}","datapoints":[[3,"-"]]}]@ then
S
slguan 已提交
179 180
  return -1
endi
S
scripts  
slguan 已提交
181 182

system sh/exec.sh -n dnode1 -s stop -x SIGINT