grafana.sim 9.7 KB
Newer Older
S
slguan 已提交
1 2 3 4
system sh/stop_dnodes.sh

sleep 5000

S
slguan 已提交
5 6

system sh/deploy.sh -n dnode1 -i 1
S
slguan 已提交
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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
system sh/cfg.sh -n dnode1 -c commitLog -v 0
#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

system_content curl 192.168.0.1:6020/grafana/
print 1-> $system_content
if $system_content != @{"status":"error","code":1011,"desc":"no auth info input"}@ then
  return -1
endi

system_content curl 192.168.0.1:6020/grafana/xx
print 2-> $system_content
if $system_content != @{"status":"error","code":1011,"desc":"no auth info input"}@ then
  return -1
endi

system_content curl 192.168.0.1:6020/grafana/login/xx/xx/
print 3-> $system_content
if $system_content != @{"status":"error","code":35,"desc":"invalid user name"}@ then
  return -1
endi

system_content curl 192.168.0.1:6020/grafana/root/1/123/1/1/3
print 4-> $system_content
if $system_content != @{"status":"error","code":1011,"desc":"no auth info input"}@ then
  return -1
endi

system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d 'show databases' 192.168.0.1:6020/grafana/login/1/root/1/
print 5-> $system_content
if $system_content != @{"status":"error","code":35,"desc":"invalid user name"}@ then
  return -1
endi

system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi'  -d 'show databases' 192.168.0.1:6020/grafana/root/1/login
print 6-> $system_content
if $system_content != @{"status":"error","code":1010,"desc":"invalid type of Authorization"}@ then
  return -1
endi

system_content curl -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi'  -d 'show databases' 192.168.0.1:6020/grafana/root/1/login
print 7-> $system_content
if $system_content != @{"status":"error","code":1010,"desc":"invalid type of Authorization"}@ then
  return -1
endi

sleep 3000
system_content curl 192.168.0.1:6020/grafana/login/root/taosdata
print 8-> $system_content
if $system_content != @{"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"}@ then
  return -1
endi

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

system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6020/grafana/d1/table_gc
print 9-> $system_content
if $system_content != @{"message":"Grafana server receive a quest from you!"}@ then
  return -1
endi

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

system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6020/grafana/heartbeat
print 10-> $system_content
if $system_content != @{"message":"Grafana server receive a quest from you!"}@ then
  return -1
endi

system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6020/grafana/d1/table_invalid/search
print 11-> $system_content
if $system_content != @{"message":"Grafana server receive a quest from you!"}@ then
  return -1
endi

system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' 127.0.0.1:6020/grafana/d1/m1/search
print 12-> $system_content
if $system_content != @{"message":"Grafana server receive a quest from you!"}@ then
  return -1
endi

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

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:6020/grafana/query
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

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:6020/grafana/query
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

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:6020/grafana/query
print 15-> $system_content
if $system_content != @[{"refId":"A","target":"A","datapoints":[[3,"-"]]},{"refId":"B","target":"B","datapoints":[[3,"-"]]}]@ then
  return -1
endi

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:6020/grafana/query
print 15-> $system_content
if $system_content != @[{"refId":"A","target":"A","datapoints":[[3,"-"]]},{"refId":"B","target":"B","datapoints":[[3,"-"]]}]@ then
  return -1
endi

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:6020/grafana/query
print 16-> $system_content
if $system_content != @[{"refId":"A","target":"1","datapoints":[[5,"-"]]},{"refId":"A","target":"2","datapoints":[[4,"-"]]},{"refId":"A","target":"3","datapoints":[[3,"-"]]},{"refId":"B","target":"a","datapoints":[[5,"-"]]},{"refId":"B","target":"b","datapoints":[[8,"-"]]},{"refId":"B","target":"c","datapoints":[[9,"-"]]}]@ then
  return -1
endi

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:6020/grafana/query
print 17-> $system_content
if $system_content != @[{"refId":"A","target":"count1","datapoints":[[5,"-"]]},{"refId":"A","target":"count2","datapoints":[[4,"-"]]},{"refId":"A","target":"count3","datapoints":[[3,"-"]]},{"refId":"B","target":"sum-a","datapoints":[[5,"-"]]},{"refId":"B","target":"sum-b","datapoints":[[8,"-"]]},{"refId":"B","target":"sum-c","datapoints":[[9,"-"]]}]@ then
  return -1
endi

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:6020/grafana/query
print 18-> $system_content
if $system_content != @[{"refId":"A","target":"count1","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000],[1,1514208480000],[1,1514208540000]]},{"refId":"A","target":"count2","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000],[1,1514208480000]]},{"refId":"A","target":"count3","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000]]}]@ then
  return -1
endi

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:6020/grafana/query
print 19-> $system_content
if $system_content != @[{"refId":"A","target":"3","datapoints":[[15.299999714,"-"]]},{"refId":"B","target":"15.299999714","datapoints":[[3,"-"]]}]@ then
  return -1
endi