opentsdb.sim 13.7 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 8 9 10 11 12 13 14 15

sleep 3000
sql connect

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

print ===============  step1 - parse
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:6020/opentsdb/
print $system_content
S
Shengliang Guan 已提交
16
if $system_content != @{"status":"error","code":5057,"desc":"database name can not be null"}@ then
S
slguan 已提交
17 18 19 20 21
  return -1
endi

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:6020/opentsdb/db123456789012345678901234567890db
print $system_content
S
Shengliang Guan 已提交
22
if $system_content != @{"status":"error","code":5058,"desc":"database name too long"}@ then
S
slguan 已提交
23 24 25 26 27
  return -1
endi

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:6020/opentsdb/
print $system_content
S
Shengliang Guan 已提交
28
if $system_content != @{"status":"error","code":5057,"desc":"database name can not be null"}@ then
S
slguan 已提交
29 30 31 32 33
  return -1
endi

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:6020/opentsdb/db/put2
print $system_content
S
Shengliang Guan 已提交
34
if $system_content != @{"status":"error","code":5009,"desc":"http url parse error"}@ then
S
slguan 已提交
35 36 37 38 39
  return -1
endi

system_content curl -u root:taosdata -d  '[]' 127.0.0.1:6020/opentsdb/db/put
print $system_content
S
Shengliang Guan 已提交
40
if $system_content != @{"status":"error","code":5060,"desc":"metrics size is 0"}@ then
S
slguan 已提交
41 42 43 44 45
  return -1
endi

system_content curl -u root:taosdata -d  '[' 127.0.0.1:6020/opentsdb/db/put
print $system_content
S
Shengliang Guan 已提交
46
if $system_content != @{"status":"error","code":5059,"desc":"invalid opentsdb json fromat"}@ then
S
slguan 已提交
47 48 49 50 51
  return -1
endi

system_content curl -u root:taosdata -d  '{}' 127.0.0.1:6020/opentsdb/db/put
print $system_content
S
Shengliang Guan 已提交
52
if $system_content != @{"status":"error","code":5060,"desc":"metrics size is 0"}@ then
S
slguan 已提交
53 54 55 56 57 58
  return -1
endi

system_content curl -u root:taosdata -d  '[{}]' 127.0.0.1:6020/opentsdb/db/put
print $system_content

S
Shengliang Guan 已提交
59
if $system_content != @{"status":"error","code":5062,"desc":"metric name not find"}@ then
S
slguan 已提交
60 61 62 63 64
  return -1
endi

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

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

system_content curl -u root:taosdata -d  '[{"metric": "ab1234567890123456789012345678ab1234567890123456789012345678","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put
print $system_content
S
Shengliang Guan 已提交
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":"tsdb timestamp is out of range"}}],"failed":1,"success":0,"affected_rows":0}@ then
S
slguan 已提交
78 79 80 81 82
  return -1
endi

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

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:6020/opentsdb/db/put
print $system_content
S
Shengliang Guan 已提交
89
if $system_content != @{"status":"error","code":5067,"desc":"timestamp type should be integer"}@ then
S
slguan 已提交
90 91 92 93 94
  return -1
endi

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:6020/opentsdb/db/put
print $system_content
S
Shengliang Guan 已提交
95
if $system_content != @{"status":"error","code":5068,"desc":"timestamp value smaller than 0"}@ then
S
slguan 已提交
96 97 98 99 100
  return -1
endi

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

#######

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

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

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

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:6020/opentsdb/db/put
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 131 132
  return -1
endi

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

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

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

system_content curl -u root:taosdata -d  '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": ""}}]' 127.0.0.1:6020/opentsdb/db/put
print $system_content
S
Shengliang Guan 已提交
151
if $system_content != @{"status":"error","code":5076,"desc":"tag value is null"}@ then
S
slguan 已提交
152 153 154 155 156 157 158 159 160 161 162 163 164 165
  return -1
endi

sleep 3000

print ===============  step2 - insert single data
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:6020/opentsdb/db/put
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

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:6020/opentsdb/db/put
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 170 171 172 173 174 175 176
  return -1
endi

system_content curl -u root:taosdata -d  'select * from db.sys_cpu_d_bbb_lga_1_web01' 127.0.0.1:6020/rest/sql/
print $system_content
if $system_content != @{"status":"succ","head":["ts","value"],"data":[["2012-09-05 20:00:00.000",18.000000000]],"rows":1}@ then
  return -1
endi

print ===============  step3 - multi-query data
S
Shengliang Guan 已提交
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:6020/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 185 186 187 188
  return -1
endi

system_content curl -u root:taosdata -d  'select * from db.sys_cpu_d_bbb_lga_1_web01' 127.0.0.1:6020/rest/sql/

print $system_content

S
Shengliang Guan 已提交
189
if $system_content != @{"status":"succ","head":["ts","value"],"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 193 194 195 196 197 198 199 200 201
  return -1
endi

system_content curl -u root:taosdata -d  'select count(*) from db.sys_cpu_d_bbb' 127.0.0.1:6020/rest/sql/

print $system_content

if $system_content != @{"status":"succ","head":["count(*)"],"data":[[3]],"rows":1}@ then
  return -1
endi

print ===============  step4 - summary-put data
S
Shengliang Guan 已提交
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:6020/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 210 211 212 213
  return -1
endi

system_content curl -u root:taosdata -d  'select * from db.sys_mem_d_bbb_lga_1_web01' 127.0.0.1:6020/rest/sql/

print $system_content

S
Shengliang Guan 已提交
214
if $system_content != @{"status":"succ","head":["ts","value"],"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 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
  return -1
endi

system_content curl -u root:taosdata -d  'select count(*) from db.sys_mem_d_bbb' 127.0.0.1:6020/rest/sql/

print $system_content

if $system_content != @{"status":"succ","head":["count(*)"],"data":[[2]],"rows":1}@ then
  return -1
endi

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

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:6020/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:6020/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:6020/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:6020/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:6020/opentsdb/db/put

system_content curl -u root:taosdata -d  'select count(*) from db.sys_cpu_d_bbb' 127.0.0.1:6020/rest/sql/
print $system_content
S
Shengliang Guan 已提交
236
if $system_content != @{"status":"succ","head":["count(*)"],"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 247
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
system sh/exec.sh -n dnode8 -s stop  -x SIGINT