Browse Source

update 最新

dev
lucas 3 days ago
parent
commit
dcbbaf5550
  1. 5
      configFiles/config_知物云_组合告警.yaml
  2. 14
      consumers/AlarmCombination/dataModel.go
  3. 13
      consumers/consumerAlarmCombination.go

5
configFiles/config_知物云_组合告警.yaml

@ -10,8 +10,7 @@ ioConfig:
topics: topics:
- zuhe_alarm - zuhe_alarm
monitor: monitor:
#振动是触发式,数据迟缓 cron10min也改成1小时一次 最多上报6条,不进行10min实时上报 cron_pg: 23 0/1 * * * #6/10 * * * *
cron_pg: 32 0/1 * * * #6/10 * * * *
#普通类型 特征数据 #普通类型 特征数据
cron_redis: 20 0/1 * * * cron_redis: 20 0/1 * * *
info: info:
@ -20,7 +19,7 @@ queryComponent:
redis: redis:
address: 10.8.30.160:30379 address: 10.8.30.160:30379
postgres: postgres:
connect: "host=10.8.30.165 port=5432 user=FashionAdmin password=123456 dbname=SavoirCloud sslmode=disable" connect: "host=10.8.30.166 port=5432 user=FashionAdmin password=123456 dbname=SavoirCloud sslmode=disable"
#点位id对应信息 #点位id对应信息
pointInfo: #测点类型支持 桥墩倾斜 15 裂缝18 支座位移20 桥面振动28 加速度三项监测592(承德隧道专用) pointInfo: #测点类型支持 桥墩倾斜 15 裂缝18 支座位移20 桥面振动28 加速度三项监测592(承德隧道专用)

14
consumers/AlarmCombination/dataModel.go

@ -0,0 +1,14 @@
package AlarmCombination
import "time"
type CombinationInfo struct {
Id int64 `json:"id" db:"id"`
Name string `json:"name" db:"name"`
Description string `json:"description" db:"description"`
Config any `json:"config" db:"config"`
Enable bool `json:"enable" db:"enable"`
StructId int32 `json:"struct_id" db:"struct_id"`
OrgId int32 `json:"org_id" db:"org_id"`
UpdateTime time.Time `json:"update_time" db:"update_time"`
}

13
consumers/consumerAlarmCombination.go

@ -81,6 +81,8 @@ func (the *consumerAlarmCombination) infoComponentInitial() error {
//数据出口 //数据出口
addr := the.Info.QueryComponent.Redis.Address addr := the.Info.QueryComponent.Redis.Address
the.infoRedis = dbOperate.NewRedisHelper("", addr) the.infoRedis = dbOperate.NewRedisHelper("", addr)
pgConnStr := the.Info.QueryComponent.Pg.Connect
the.infoPg = dbOperate.NewDBHelper("postgres", pgConnStr)
return nil return nil
} }
func (the *consumerAlarmCombination) Work() { func (the *consumerAlarmCombination) Work() {
@ -140,13 +142,10 @@ func (the *consumerAlarmCombination) getEs1HourAggData() {
func (the *consumerAlarmCombination) updateCombinationInfo() { func (the *consumerAlarmCombination) updateCombinationInfo() {
log.Printf("更新 数据库 组合配置信息") log.Printf("更新 数据库 组合配置信息")
sql := `SELECT * FROM "t_alarm_combination"`
structIds := []int64{1, 2} var CombinationInfos []AlarmCombination.CombinationInfo
for _, structId := range structIds { the.infoPg.Query(&CombinationInfos, sql)
println("======")
println(structId)
}
} }
func (the *consumerAlarmCombination) getESQueryStrByHour(structureId int64, factorId int, start, end string) string { func (the *consumerAlarmCombination) getESQueryStrByHour(structureId int64, factorId int, start, end string) string {

Loading…
Cancel
Save