Commit 9082abfb authored by jingbo.wang's avatar jingbo.wang

服务健康状态报表第一版完成(只报总表),分表后续实现,告警后续实现,砍掉无效的对外api,砍掉redis缓存模块部分

parent 61958889
......@@ -6,13 +6,15 @@ import (
"git.quantgroup.cn/DevOps/enoch/pkg/global"
"git.quantgroup.cn/DevOps/enoch/pkg/glog"
"git.quantgroup.cn/DevOps/enoch/pkg/points"
report_form "git.quantgroup.cn/DevOps/enoch/pkg/report-form"
"git.quantgroup.cn/DevOps/enoch/pkg/report-form"
"github.com/Shopify/sarama"
_ "github.com/mkevac/debugcharts"
"net/http"
_ "net/http/pprof"
"os"
"os/signal"
"runtime/debug"
"strconv"
"strings"
"syscall"
"time"
......@@ -103,6 +105,7 @@ func main() {
}
}()
//主节点:刷新连续查询、健康状态报表、告警策略
if isMaster() {
//初始化数据库(创建DB,创建连续查询)
dao.DbInit()
......@@ -113,20 +116,27 @@ func main() {
//TODO 告警策略
}
//对外api ??
//对外api
runApiServer()
//处理消息(阻塞)
handlerKafkaMsg()
/*
http.HandleFunc("/duration", service.DurationInterface)
http.HandleFunc("/tech/health/check", func(writer http.ResponseWriter, request *http.Request) {
writer.WriteHeader(http.StatusOK)
})
http.HandleFunc("/counter", service.CounterInterface)
err = http.ListenAndServe(":"+port, nil)
}
func runApiServer() {
http.HandleFunc("/tech/health/check", func(writer http.ResponseWriter, request *http.Request) {
writer.WriteHeader(http.StatusOK)
})
go func() {
defer func() {
if err := recover(); err != nil {
glog.Error(err, debug.Stack())
}
}()
err := http.ListenAndServe(":"+strconv.Itoa(global.HttpPort), nil)
if err != nil {
log.Fatalln("服务启动失败", err)
glog.Error(err)
}
*/
}()
}
......@@ -12,6 +12,7 @@ import (
"github.com/vrg0/go-common/util"
"go.uber.org/zap/zapcore"
"os"
"strconv"
"strings"
)
......@@ -47,6 +48,7 @@ var (
ConsulDc = ""
ConsulAddress = ""
ReportFormDir = ""
HttpPort = 9091
)
type EosResult struct {
......@@ -107,6 +109,13 @@ func init() {
//InfluxDbAddress = "http://172.20.6.33:8086"
DaoFileCacheDir = Config.GetOrDefault(NamespaceApplication, "dao.file.cache.dir", "/var")
ReportFormDir = Config.GetOrDefault(NamespaceApplication, "report.form.dir", "/var")
httpPortStr := Config.GetOrDefault(NamespaceTechDeploy, "http_port", "9091")
port, err := strconv.Atoi(httpPortStr)
if err != nil {
Logger.Error("a to i http_port err:", httpPortStr)
} else {
HttpPort = port
}
//初始化registry
if consulDc, ok := Config.Get(NamespaceApplication, "consul.datacenter"); !ok {
......
......@@ -46,8 +46,7 @@ func RegularReport(dir string) {
fileNamePrefix := now.Format("2006-01-02")
//周表
// if now.Weekday() == time.Monday {
if now.Weekday() == time.Wednesday {
if now.Weekday() == time.Monday {
fileName := dir + "/" + fileNamePrefix + "_week.txt"
if !util.Exists(fileName) {
body := GeneralTableRun(7)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment