diff --git a/gala-ops/server/httphandler/agent.go b/gala-ops/server/httphandler/agent.go index 8fb93c8cf88f93c95a7db2050e59b188188e5648..bf7403a17f60e6c7d9f1a62fa4001c0fb94a4248 100644 --- a/gala-ops/server/httphandler/agent.go +++ b/gala-ops/server/httphandler/agent.go @@ -8,7 +8,6 @@ import ( "gitee.com/openeuler/PilotGo-plugins/sdk/common" "gitee.com/openeuler/PilotGo-plugins/sdk/plugin/client" "github.com/gin-gonic/gin" - "openeuler.org/PilotGo/gala-ops-plugin/plugin" ) func InstallGopher(ctx *gin.Context) { @@ -37,7 +36,6 @@ func InstallGopher(ctx *gin.Context) { } ret := []interface{}{} - monitorTargets := []string{} for _, result := range cmdResults { d := struct { MachineUUID string @@ -53,18 +51,10 @@ func InstallGopher(ctx *gin.Context) { if result.RetCode != 0 { d.InstallStatus = "error" d.Error = result.Stderr - } else { - // TODO: add gala-gopher to prometheus monitor target here - // default exporter port :8888 - monitorTargets = append(monitorTargets, result.MachineIP+":8888") } ret = append(ret, d) } - err = plugin.MonitorTargets(monitorTargets, Galaops.PromePlugin["url"].(string)) - if err != nil { - fmt.Println("error: failed to add gala-gopher to prometheus monitor targets") - } ctx.JSON(http.StatusOK, gin.H{ "code": 0, diff --git a/gala-ops/server/main.go b/gala-ops/server/main.go index fee8ff694930b19aea7591725a48a67f0cf72472..96badbfc53f6ecf514fb5cc42363fa41c2eec845 100644 --- a/gala-ops/server/main.go +++ b/gala-ops/server/main.go @@ -41,12 +41,6 @@ func main() { // 临时给server赋值 PluginClient.Server = "http://192.168.75.100:8888" - // PromePlugin, err := client.GetClient().GetPluginInfo("prometheus") - // if err != nil { - // logger.Error("failed to get plugin info from pilotgoserver: ", err) - // os.Exit(1) - // } - httphandler.Galaops = &httphandler.Opsclient{ Sdkmethod: PluginClient, PromePlugin: nil, diff --git a/gala-ops/server/plugin/prometheus.go b/gala-ops/server/plugin/prometheus.go index a6699f09c51a470f192002f4af68ad57605504c7..b0736c3a052cd06b4abff728cd4615c76a3d613e 100644 --- a/gala-ops/server/plugin/prometheus.go +++ b/gala-ops/server/plugin/prometheus.go @@ -1,46 +1 @@ package plugin - -import ( - "gitee.com/openeuler/PilotGo-plugins/sdk/plugin/client" -) - -// 请求prometheus插件接口,将gala-ops targets添加到监控清单当中 -func addTargets(targets []string, url string) error { - // TODO: - // jobName := "gala-gopher" - // url := url+"/api/add_targets" - - return nil -} - -func MonitorTargets(targets []string, promeurl string) error { - // plugin, err := client.GetClient().GetPluginInfo("prometheus") - // if err != nil { - // return err - // } - - if err := addTargets(targets, promeurl); err != nil { - return err - } - - return nil -} - -func deleteTargets(targets []string, url string) error { - // TODO: - - return nil -} - -func DeleteTargets(targets []string, client *client.Client) error { - plugin, err := client.GetPluginInfo("prometheus") - if err != nil { - return err - } - - if err := deleteTargets(targets, plugin.Url); err != nil { - return err - } - - return nil -}