From 43f237b6e57d41766d270e5b70fc1ee6297a3ce2 Mon Sep 17 00:00:00 2001 From: 18209 Date: Mon, 21 Jul 2025 13:22:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=91=8A=E8=AD=A6=E8=BF=9B?= =?UTF-8?q?=E7=A8=8Bes=E5=AD=98=E5=82=A8=E7=9A=84=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E7=B4=A2=E5=BC=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/configStruct.go | 7 ++++--- .../config_知物云测点数据_最新同步.yaml | 11 ++++++----- consumers/consumerSavoirTheme.go | 2 +- dbOperate/elasticsearchHelper.go | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/config/configStruct.go b/config/configStruct.go index 211bb78..6fcce05 100644 --- a/config/configStruct.go +++ b/config/configStruct.go @@ -25,9 +25,10 @@ type KafkaConfig struct { } type EsConfig struct { - Address []string `json:"address"` - Index string `json:"index"` - Auth struct { + Address []string `json:"address"` + Index string `json:"index"` + AlarmIndex string `json:"alarmIndex"` + Auth struct { UserName string `json:"userName"` Password string `json:"password"` } `json:"auth"` diff --git a/configFiles/config_知物云测点数据_最新同步.yaml b/configFiles/config_知物云测点数据_最新同步.yaml index 3d0fd0b..343d38e 100644 --- a/configFiles/config_知物云测点数据_最新同步.yaml +++ b/configFiles/config_知物云测点数据_最新同步.yaml @@ -5,21 +5,22 @@ ioConfig: brokers: - 10.8.30.160:30992 groupId: savoir_last_theme_inout - alarmTopic: "savoir_alarm" + alarmTopic: "savoir_alarm" #推送告警的主题 topics: - - savoir_theme + - savoir_theme #监听数据的的主题 out: es: address: - "http://10.8.30.160:30092" - index: "savoir_last_theme" + index: "savoir_last_theme" #es存测点最后一条数据的新索引 + alarmIndex: "savoir_alarms" #推送告警索引 auth: userName: post password: 123 - interval: 30 #多久写一次es + interval: 30 #多久写一次es(秒) monitor: - cron: 1/5 * * * * + cron: 1/5 * * * * #多久执行一次告警推送(5分钟一次:1、6、11。。) queryComponent: postgres: diff --git a/consumers/consumerSavoirTheme.go b/consumers/consumerSavoirTheme.go index 3c34be0..aed9e1c 100644 --- a/consumers/consumerSavoirTheme.go +++ b/consumers/consumerSavoirTheme.go @@ -150,7 +150,7 @@ func (the *consumerSavoirTheme) judgeOffline() { //拿到当前es最后一条数据和当前数据库的配置之后去查是否产生告警 StrValue := "80040003" alarmQueryStr := the.getEsAlarmValueStr(gap.StructId, StrValue) - allAlarmThemes, err := the.OutEs.SearchAlarmThemeData(the.Info.IoConfig.In.Kafka.AlarmTopic, alarmQueryStr) + allAlarmThemes, err := the.OutEs.SearchAlarmThemeData(the.Info.IoConfig.Out.Es.AlarmIndex, alarmQueryStr) log.Printf("allAlarmThemes----- > %s", allAlarmThemes) if err != nil { log.Printf("查询es 异常") diff --git a/dbOperate/elasticsearchHelper.go b/dbOperate/elasticsearchHelper.go index 088df2c..1cac397 100644 --- a/dbOperate/elasticsearchHelper.go +++ b/dbOperate/elasticsearchHelper.go @@ -135,7 +135,7 @@ func (the *ESHelper) searchThemes(index, reqBody string) (models.EsThemeResp, er if err != nil { //return nil, err } - log.Println(response.Status()) + log.Println(response.Status(), response.Header, response.Body) r := models.EsThemeResp{} // Deserialize the response into a map. if err := json.NewDecoder(response.Body).Decode(&r); err != nil {