opentsdb.sim 13.9 KB
Newer Older
S
slguan 已提交
1 2
system sh/stop_dnodes.sh

S
slguan 已提交
3
system sh/deploy.sh -n dnode1 -i 1
S
scripts  
Shengliang Guan 已提交
4
system sh/cfg.sh -n dnode1 -c http -v 1
S
scripts  
slguan 已提交
5
system sh/cfg.sh -n dnode1 -c wallevel -v 0
S
Shengliang Guan 已提交
6
system sh/exec.sh -n dnode1 -s start
S
slguan 已提交
7

H
Haojun Liao 已提交
8
sleep 2000
S
slguan 已提交
9 10 11 12 13
sql connect

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

print ===============  step1 - parse
14
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/
S
slguan 已提交
15
print $system_content
R
TD-1311  
root 已提交
16
if $system_content != @{"status":"error","code":4496,"desc":"database name can not be null"}@ then
S
slguan 已提交
17 18 19
  return -1
endi

20
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db123456789012345678901234567890db
S
slguan 已提交
21
print $system_content
R
TD-1311  
root 已提交
22
if $system_content != @{"status":"error","code":4497,"desc":"database name too long"}@ then
S
slguan 已提交
23 24 25
  return -1
endi

26
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/
S
slguan 已提交
27
print $system_content
R
TD-1311  
root 已提交
28
if $system_content != @{"status":"error","code":4496,"desc":"database name can not be null"}@ then
S
slguan 已提交
29 30 31
  return -1
endi

32
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put2
S
slguan 已提交
33
print $system_content
R
TD-1311  
root 已提交
34
if $system_content != @{"status":"error","code":4354,"desc":"invalid url format"}@ then
S
slguan 已提交
35 36 37
  return -1
endi

38
system_content curl -u root:taosdata -d  '[]' 127.0.0.1:7111/opentsdb/db/put
S
slguan 已提交
39
print $system_content
R
TD-1311  
root 已提交
40
if $system_content != @{"status":"error","code":4499,"desc":"metrics size is 0"}@ then
S
slguan 已提交
41 42 43
  return -1
endi

44
system_content curl -u root:taosdata -d  '[' 127.0.0.1:7111/opentsdb/db/put
S
slguan 已提交
45
print $system_content
R
TD-1311  
root 已提交
46
if $system_content != @{"status":"error","code":4498,"desc":"invalid opentsdb json fromat"}@ then
S
slguan 已提交
47 48 49
  return -1
endi

50
system_content curl -u root:taosdata -d  '{}' 127.0.0.1:7111/opentsdb/db/put
S
slguan 已提交
51
print $system_content
R
TD-1311  
root 已提交
52
if $system_content != @{"status":"error","code":4499,"desc":"metrics size is 0"}@ then
S
slguan 已提交
53 54 55
  return -1
endi

56
system_content curl -u root:taosdata -d  '[{}]' 127.0.0.1:7111/opentsdb/db/put
S
slguan 已提交
57 58
print $system_content

R
TD-1311  
root 已提交
59
if $system_content != @{"status":"error","code":4501,"desc":"metric name not find"}@ then
S
slguan 已提交
60 61 62
  return -1
endi

63
system_content curl -u root:taosdata -d  '[{"metric": 1,"timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put
S
slguan 已提交
64
print $system_content
R
TD-1311  
root 已提交
65
if $system_content != @{"status":"error","code":4502,"desc":"metric name type should be string"}@ then
S
slguan 已提交
66 67 68
  return -1
endi

69
system_content curl -u root:taosdata -d  '[{"metric": "","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put
S
slguan 已提交
70
print $system_content
R
TD-1311  
root 已提交
71
if $system_content != @{"status":"error","code":4503,"desc":"metric name length is 0"}@ then
S
slguan 已提交
72 73 74
  return -1
endi

75
system_content curl -u root:taosdata -d  '[{"metric": "ab1234567890123456789012345678ab1234567890123456789012345678","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put
S
slguan 已提交
76
print $system_content
77
if $system_content != @{"errors":[{"datapoint":{"metric":"ab1234567890123456789012345678ab1234567890123456789012345678","stable":"ab1234567890123456789012345678ab1234567890123456789012345678_d_bbb","table":"ab1234567890123456789012345678ab1234567890123456789012345678_d_bbb_lga_1_web01","timestamp":1346846400,"value":18.000000,"tags":{"dc":"lga","group1":"1","host":"web01"},"status":"error","code":1547,"desc":"Timestamp data out of range"}}],"failed":1,"success":0,"affected_rows":0}@ then
S
slguan 已提交
78 79 80
  return -1
endi

81
system_content curl -u root:taosdata -d  '[{"metric": "sys_cpu","value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put
S
slguan 已提交
82
print $system_content
R
TD-1311  
root 已提交
83
if $system_content != @{"status":"error","code":4505,"desc":"timestamp not find"}@ then
S
slguan 已提交
84 85 86
  return -1
endi

87
system_content curl -u root:taosdata -d  '[{"metric": "sys_cpu","timestamp": "2","value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put
S
slguan 已提交
88
print $system_content
R
TD-1311  
root 已提交
89
if $system_content != @{"status":"error","code":4506,"desc":"timestamp type should be integer"}@ then
S
slguan 已提交
90 91 92
  return -1
endi

93
system_content curl -u root:taosdata -d  '[{"metric": "sys_cpu","timestamp": -1,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put
S
slguan 已提交
94
print $system_content
R
TD-1311  
root 已提交
95
if $system_content != @{"status":"error","code":4507,"desc":"timestamp value smaller than 0"}@ then
S
slguan 已提交
96 97 98
  return -1
endi

99
system_content curl -u root:taosdata -d  '[{"metric": "sys_cpu","timestamp": 1346846400,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put
S
slguan 已提交
100
print $system_content
R
TD-1311  
root 已提交
101
if $system_content != @{"status":"error","code":4517,"desc":"value not find"}@ then
S
slguan 已提交
102 103 104 105 106
  return -1
endi

#######

107
system_content curl -u root:taosdata -d  '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18}]' 127.0.0.1:7111/opentsdb/db/put
S
slguan 已提交
108
print $system_content
R
TD-1311  
root 已提交
109
if $system_content != @{"status":"error","code":4508,"desc":"tags not find"}@ then
S
slguan 已提交
110 111 112
  return -1
endi

113
system_content curl -u root:taosdata -d  '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {}}]' 127.0.0.1:7111/opentsdb/db/put
S
slguan 已提交
114
print $system_content
R
TD-1311  
root 已提交
115
if $system_content != @{"status":"error","code":4509,"desc":"tags size is 0"}@ then
S
slguan 已提交
116 117 118
  return -1
endi

119
system_content curl -u root:taosdata -d  '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": 0}]' 127.0.0.1:7111/opentsdb/db/put
S
slguan 已提交
120
print $system_content
R
TD-1311  
root 已提交
121
if $system_content != @{"status":"error","code":4509,"desc":"tags size is 0"}@ then
S
slguan 已提交
122 123 124
  return -1
endi

125
system_content curl -u root:taosdata -d  '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","group1": "1","group1": "1","group1": "1","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put
S
slguan 已提交
126
print $system_content
S
Shengliang Guan 已提交
127
if $system_content != @{"errors":[{"datapoint":{"metric":"sys_cpu","stable":"sys_cpu_d_bbbbbbb","table":"sys_cpu_d_bbbbbbb_lga_1_1_1_1_1_web01","timestamp":1346846400,"value":18.000000,"tags":{"dc":"lga","group1":"1","group1":"1","group1":"1","group1":"1","group1":"1","host":"web01"},"status":"error","code":866,"desc":"failed to create table"}}],"failed":1,"success":0,"affected_rows":0}@ then
S
slguan 已提交
128 129 130
  return -1
endi

131
system_content curl -u root:taosdata -d  '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"": "web01"}}]' 127.0.0.1:7111/opentsdb/db/put
S
slguan 已提交
132
print $system_content
R
TD-1311  
root 已提交
133
if $system_content != @{"status":"error","code":4512,"desc":"tag name is null"}@ then
S
slguan 已提交
134 135 136
  return -1
endi

137
system_content curl -u root:taosdata -d  '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host01123456789001123456789001123456789001123456789001123456789001123456789": "01"}}]' 127.0.0.1:7111/opentsdb/db/put
S
slguan 已提交
138
print $system_content
R
TD-1311  
root 已提交
139
if $system_content != @{"status":"error","code":4513,"desc":"tag name length too long"}@ then
S
slguan 已提交
140 141 142
  return -1
endi

143
system_content curl -u root:taosdata -d  '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web011234567890011234567890011234567890011234567890011234567890011234567890011234567890011234567890"}}]' 127.0.0.1:7111/opentsdb/db/put
S
slguan 已提交
144
print $system_content
R
TD-1311  
root 已提交
145
if $system_content != @{"status":"error","code":4516,"desc":"tag value can not more than 64"}@ then
S
slguan 已提交
146 147 148
  return -1
endi

149
system_content curl -u root:taosdata -d  '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": ""}}]' 127.0.0.1:7111/opentsdb/db/put
S
slguan 已提交
150
print $system_content
R
TD-1311  
root 已提交
151
if $system_content != @{"status":"error","code":4515,"desc":"tag value is null"}@ then
S
slguan 已提交
152 153 154
  return -1
endi

H
Haojun Liao 已提交
155
sleep 2000
S
slguan 已提交
156 157

print ===============  step2 - insert single data
158
system_content curl -u root:taosdata -d  '[{"metric": "sys_cpu","timestamp": 1346846400000,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put
S
slguan 已提交
159 160 161 162 163
print $system_content
if $system_content != @{"errors":[{"datapoint":{"metric":"sys_cpu","stable":"sys_cpu_d_bbb","table":"sys_cpu_d_bbb_lga_1_web01","timestamp":1346846400000,"value":18.000000,"tags":{"dc":"lga","group1":"1","host":"web01"},"affected_rows":1,"status":"succ"}}],"failed":0,"success":1,"affected_rows":1}@ then
  return -1
endi

164
system_content curl -u root:taosdata -d  '[{"metric": "sys_cpu","timestamp": 1346846400000,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put
S
slguan 已提交
165
print $system_content
S
scripts  
Shengliang Guan 已提交
166
if $system_content != @{"errors":[{"datapoint":{"metric":"sys_cpu","stable":"sys_cpu_d_bbb","table":"sys_cpu_d_bbb_lga_1_web01","timestamp":1346846400000,"value":18.000000,"tags":{"dc":"lga","group1":"1","host":"web01"},"affected_rows":1,"status":"succ"}}],"failed":0,"success":1,"affected_rows":1}@ then
S
slguan 已提交
167 168 169
  return -1
endi

170
system_content curl -u root:taosdata -d  'select * from db.sys_cpu_d_bbb_lga_1_web01' 127.0.0.1:7111/rest/sql/
S
slguan 已提交
171
print $system_content
172
if $system_content != @{"status":"succ","head":["ts","value"],"column_meta":[["ts",9,8],["value",7,8]],"data":[["2012-09-05 20:00:00.000",18.000000000]],"rows":1}@ then
S
slguan 已提交
173 174 175 176
  return -1
endi

print ===============  step3 - multi-query data
177
system_content curl -u root:taosdata -d  '[{"metric": "sys_cpu","timestamp": 1346846405000,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846402000,"value": 18,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put
S
slguan 已提交
178 179 180

print $system_content

S
Shengliang Guan 已提交
181
if $system_content != @{"errors":[{"datapoint":{"metric":"sys_cpu","stable":"sys_cpu_d_bbb","table":"sys_cpu_d_bbb_lga_1_web01","timestamp":1346846405000,"value":18.000000,"tags":{"dc":"lga","group1":"1","host":"web01"},"affected_rows":1,"status":"succ"}},{"datapoint":{"metric":"sys_cpu","stable":"sys_cpu_d_bbb","table":"sys_cpu_d_bbb_lga_1_web02","timestamp":1346846402000,"value":18.000000,"tags":{"dc":"lga","group1":"1","host":"web02"},"affected_rows":1,"status":"succ"}}],"failed":0,"success":2,"affected_rows":2}@ then
S
slguan 已提交
182 183 184
  return -1
endi

185
system_content curl -u root:taosdata -d  'select * from db.sys_cpu_d_bbb_lga_1_web01' 127.0.0.1:7111/rest/sql/
S
slguan 已提交
186 187 188

print $system_content

189
if $system_content != @{"status":"succ","head":["ts","value"],"column_meta":[["ts",9,8],["value",7,8]],"data":[["2012-09-05 20:00:00.000",18.000000000],["2012-09-05 20:00:05.000",18.000000000]],"rows":2}@ then
S
slguan 已提交
190 191 192
  return -1
endi

193
system_content curl -u root:taosdata -d  'select count(*) from db.sys_cpu_d_bbb' 127.0.0.1:7111/rest/sql/
S
slguan 已提交
194 195 196

print $system_content

197
if $system_content != @{"status":"succ","head":["count(*)"],"column_meta":[["count(*)",5,8]],"data":[[3]],"rows":1}@ then
S
slguan 已提交
198 199 200 201
  return -1
endi

print ===============  step4 - summary-put data
202
system_content curl -u root:taosdata -d  '[{"metric": "sys_mem","timestamp": 1346846400000,"value": 8,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_mem","timestamp": 1346846405000,"value": 9,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put?details=false
S
slguan 已提交
203 204 205

print $system_content

S
scripts  
Shengliang Guan 已提交
206
if $system_content != @{"failed":0,"success":2}@ then
S
slguan 已提交
207 208 209
  return -1
endi

210
system_content curl -u root:taosdata -d  'select * from db.sys_mem_d_bbb_lga_1_web01' 127.0.0.1:7111/rest/sql/
S
slguan 已提交
211 212 213

print $system_content

214
if $system_content != @{"status":"succ","head":["ts","value"],"column_meta":[["ts",9,8],["value",7,8]],"data":[["2012-09-05 20:00:00.000",8.000000000],["2012-09-05 20:00:05.000",9.000000000]],"rows":2}@ then
S
slguan 已提交
215 216 217
  return -1
endi

218
system_content curl -u root:taosdata -d  'select count(*) from db.sys_mem_d_bbb' 127.0.0.1:7111/rest/sql/
S
slguan 已提交
219 220 221

print $system_content

222
if $system_content != @{"status":"succ","head":["count(*)"],"column_meta":[["count(*)",5,8]],"data":[[2]],"rows":1}@ then
S
slguan 已提交
223 224 225 226 227
  return -1
endi

print ===============  step5 - prepare data

228 229 230 231 232
system_content curl -u root:taosdata -d  '[{"metric": "sys_cpu","timestamp": 1346846402000,"value": 19,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846402,"value": 19,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put
system_content curl -u root:taosdata -d  '[{"metric": "sys_cpu","timestamp": 1346846403000,"value": 20,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846403,"value": 20,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put
system_content curl -u root:taosdata -d  '[{"metric": "sys_cpu","timestamp": 1346846404000,"value": 21,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846404,"value": 21,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put
system_content curl -u root:taosdata -d  '[{"metric": "sys_cpu","timestamp": 1346846405000,"value": 22,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846405,"value": 22,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put
system_content curl -u root:taosdata -d  '[{"metric": "sys_cpu","timestamp": 1346846406000,"value": 23,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846406,"value": 23,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put
S
slguan 已提交
233

234
system_content curl -u root:taosdata -d  'select count(*) from db.sys_cpu_d_bbb' 127.0.0.1:7111/rest/sql/
S
slguan 已提交
235
print $system_content
236
if $system_content != @{"status":"succ","head":["count(*)"],"column_meta":[["count(*)",5,8]],"data":[[7]],"rows":1}@ then
S
slguan 已提交
237
  return -1
guanshengliang's avatar
scripts  
guanshengliang 已提交
238 239
endi

S
Shengliang Guan 已提交
240 241 242 243 244 245 246
system sh/exec.sh -n dnode1 -s stop  -x SIGINT
system sh/exec.sh -n dnode2 -s stop  -x SIGINT
system sh/exec.sh -n dnode3 -s stop  -x SIGINT
system sh/exec.sh -n dnode4 -s stop  -x SIGINT
system sh/exec.sh -n dnode5 -s stop  -x SIGINT
system sh/exec.sh -n dnode6 -s stop  -x SIGINT
system sh/exec.sh -n dnode7 -s stop  -x SIGINT
M
Minglei Jin 已提交
247
system sh/exec.sh -n dnode8 -s stop  -x SIGINT