system sh/stop_dnodes.sh

system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 0
system sh/cfg.sh -n dnode1 -c monitor       -v 1
system sh/cfg.sh -n dnode1 -c monitorInterval     -v 1
system sh/exec.sh -n dnode1 -s start

sleep 3000
sql connect
print ======================== stream_on_sys.sim

$db = log
$tb = tb
$mt = mt
$strm = strm
$tbNum = 10
$rowNum = 20
$totalNum = 200

$i = 0

sql use $db

sql create table cpustrm as select count(*), avg(cpu_taosd), max(cpu_taosd), min(cpu_taosd), avg(cpu_system), max(cpu_cores), min(cpu_cores), last(cpu_cores) from log.dn1 interval(4s)
sql create table memstrm as select count(*), avg(mem_taosd), max(mem_taosd), min(mem_taosd), avg(mem_system), first(mem_total), last(mem_total) from log.dn1 interval(4s)
sql create table diskstrm as select count(*), avg(disk_used), last(disk_used), avg(disk_total), first(disk_total) from log.dn1 interval(4s)
sql create table bandstrm as select count(*), avg(band_speed), last(band_speed) from log.dn1 interval(4s)
sql create table reqstrm as select count(*), avg(req_http), last(req_http), avg(req_select), last(req_select), avg(req_insert), last(req_insert) from log.dn1 interval(4s)
sql create table iostrm as select count(*), avg(io_read), last(io_read), avg(io_write), last(io_write) from log.dn1 interval(4s)
sleep 120000
sql select * from cpustrm
if $rows <= 0 then
  return -1
endi

sql select * from memstrm
if $rows <= 0 then
  return -1
endi

sql select * from diskstrm
if $rows <= 0 then
  return -1
endi

sql select * from bandstrm
if $rows <= 0 then
  return -1
endi

sql select * from reqstrm
if $rows <= 0 then
  return -1
endi

sql select * from iostrm
if $rows <= 0 then
  return -1
endi

system sh/exec.sh -n dnode1 -s stop -x SIGINT