@@ -61,7 +61,7 @@ The use of each configuration item is:
***port**: This is the `http` service port which enables other application to manage rules by `restful API`.
***database**: rules are stored in a `sqlite` database, this is the path of the database file (if the file does not exist, the alert application creates it automatically).
***tdengine**: connection string of `TDEngine` server, note the database name should be put in the `sql` field of a rule in most cases, thus it should NOT be included in the string.
***tdengine**: connection string of `TDEngine` server (please refer the documentation of GO connector for the detailed format of this string), note the database name should be put in the `sql` field of a rule in most cases, thus it should NOT be included in the string.
***log > level**: log level, could be `production` or `debug`.
***log > path**: log output file path.
***receivers > alertManager**: the alert application pushes alerts to `AlertManager` at this URL.
"create table if not exists stb (ts timestamp, col1 int, col2 int, col3 int) tags(loc nchar(20), id int)")
currTs=self.ts
foriinrange(100):
sql="create table tb%d using stb tags('city%d', 1)"%(i,i)
tdSql.execute(sql)
sql="insert into tb%d values"%i
forjinrange(5):
val=1+j
sql+="(%d, %d, %d, %d)"%(currTs,val,val,val)
currTs+=1000000
tdSql.execute(sql)
tdSql.query("select first(col1) - avg(col1) from stb where ts > '2018-09-17 08:00:00.000' and ts < '2018-09-23 04:36:40.000' interval(1h)")
tdSql.checkRows(139)
tdSql.query("select first(col1) - avg(col1) from stb where ts > '2018-09-17 08:00:00.000' and ts < '2018-09-23 04:36:40.000' interval(1h) fill(null)")
tdSql.checkRows(141)
tdSql.checkData(0,1,None)
tdSql.checkData(140,1,None)
tdSql.query("select max(col1) - min(col1) from stb where ts > '2018-09-17 08:00:00.000' and ts < '2018-09-23 04:36:40.000' and id = 1 group by loc, id")
rows=tdSql.queryRows
tdSql.query("select spread(col1) from stb where ts > '2018-09-17 08:00:00.000' and ts < '2018-09-23 04:36:40.000' and id = 1 group by loc, id")
sql_error select count(join_mt0.c1), sum(join_mt1.c2), first(join_mt0.c5), last(join_mt1.c7), first(join_mt1.c7) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts interval(10a) group by join_mt0.t1 order by join_mt0.ts desc limit 20 offset 19;
sql select count(join_mt0.c1), sum(join_mt0.c2)/count(*), avg(c2), first(join_mt0.c5), last(c7) from join_mt0 interval(10a) group by join_mt0.t1 order by join_mt0.ts desc;
if $rows != 100 then
if $rows != 300 then
return -1
endi
...
...
@@ -147,7 +146,7 @@ if $data00 != @70-01-01 08:01:40.990@ then
return -1
endi
if $data01 != 30 then
if $data01 != 10 then
return -1
endi
...
...
@@ -168,7 +167,7 @@ if $data05 != 1 then
return -1
endi
if $data06 != 2 then
if $data06 != 0 then
return -1
endi
...
...
@@ -177,7 +176,7 @@ if $data10 != @70-01-01 08:01:40.980@ then