opentsdb.sim 13.8 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
scripts  
Shengliang Guan 已提交
6
system sh/cfg.sh -n dnode1 -c httpDebugFlag -v 135
S
scripts  
slguan 已提交
7
system sh/exec_up.sh -n dnode1 -s start
S
slguan 已提交
8 9 10 11 12 13 14 15 16

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
scripts  
Shengliang Guan 已提交
17
if $system_content != @{"status":"error","code":1057,"desc":"database name can not be null"}@ then
S
slguan 已提交
18 19 20 21 22 23 24 25 26 27 28
  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
if $system_content != @{"status":"error","code":1058,"desc":"database name too long"}@ then
  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
scripts  
Shengliang Guan 已提交
29
if $system_content != @{"status":"error","code":1057,"desc":"database name can not be null"}@ then
S
slguan 已提交
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
  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
if $system_content != @{"status":"error","code":1009,"desc":"http url parse error"}@ then
  return -1
endi

system_content curl -u root:taosdata -d  '[]' 127.0.0.1:6020/opentsdb/db/put
print $system_content
if $system_content != @{"status":"error","code":1060,"desc":"metrics size is 0"}@ then
  return -1
endi

system_content curl -u root:taosdata -d  '[' 127.0.0.1:6020/opentsdb/db/put
print $system_content
if $system_content != @{"status":"error","code":1059,"desc":"invalid opentsdb json fromat"}@ then
  return -1
endi

system_content curl -u root:taosdata -d  '{}' 127.0.0.1:6020/opentsdb/db/put
print $system_content
if $system_content != @{"status":"error","code":1060,"desc":"metrics size is 0"}@ then
  return -1
endi

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

if $system_content != @{"status":"error","code":1062,"desc":"metric name not find"}@ then
  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
if $system_content != @{"status":"error","code":1063,"desc":"metric name type should be string"}@ then
  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
if $system_content != @{"status":"error","code":1064,"desc":"metric name length is 0"}@ then
  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
scripts  
Shengliang Guan 已提交
78
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":-2147483389}}],"failed":1,"success":0,"affected_rows":0}@ then
S
slguan 已提交
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
  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
if $system_content != @{"status":"error","code":1066,"desc":"timestamp not find"}@ then
  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
if $system_content != @{"status":"error","code":1067,"desc":"timestamp type should be integer"}@ then
  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
if $system_content != @{"status":"error","code":1068,"desc":"timestamp value smaller than 0"}@ then
  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
if $system_content != @{"status":"error","code":1078,"desc":"value not find"}@ then
  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
if $system_content != @{"status":"error","code":1069,"desc":"tags not find"}@ then
  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
if $system_content != @{"status":"error","code":1070,"desc":"tags size is 0"}@ then
  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
if $system_content != @{"status":"error","code":1070,"desc":"tags size is 0"}@ then
  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
scripts  
Shengliang Guan 已提交
128
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":-2147483445}}],"failed":1,"success":0,"affected_rows":0}@ then
S
slguan 已提交
129 130 131 132 133
  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
scripts  
Shengliang Guan 已提交
134
if $system_content != @{"status":"error","code":1073,"desc":"tag name is null"}@ then
S
slguan 已提交
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
  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
if $system_content != @{"status":"error","code":1074,"desc":"tag name length too long"}@ then
  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
if $system_content != @{"status":"error","code":1077,"desc":"tag value can not more than 64"}@ then
  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
scripts  
Shengliang Guan 已提交
152
if $system_content != @{"status":"error","code":1076,"desc":"tag value is null"}@ then
S
slguan 已提交
153 154 155 156 157 158 159 160 161 162 163 164 165 166
  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 已提交
167
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 已提交
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206
  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
system_content curl -u root:taosdata -d  '[{"metric": "sys_cpu","timestamp": 1346846401000,"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

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":1346846401000,"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
  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],["2012-09-05 20:00:01.000",18.000000000]],"rows":2}@ then
  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
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": 1346846401000,"value": 9,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put?details=false

print $system_content

S
scripts  
Shengliang Guan 已提交
207
if $system_content != @{"failed":1,"success":1}@ then
S
slguan 已提交
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
  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

if $system_content != @{"status":"succ","head":["ts","value"],"data":[["2012-09-05 20:00:00.000",8.000000000],["2012-09-05 20:00:01.000",9.000000000]],"rows":2}@ then
  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
if $system_content != @{"status":"succ","head":["count(*)"],"data":[[8]],"rows":1}@ then
  return -1
guanshengliang's avatar
scripts  
guanshengliang 已提交
239 240 241 242 243 244 245 246 247 248
endi

system sh/exec_up.sh -n dnode1 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode2 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode3 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode4 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode5 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode6 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode7 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode8 -s stop  -x SIGINT