mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #9515 from swordqiu/hotfix/qj-telegraf-use-local-ipv4-address-explicitly
fix(host): telegraf listen on local ipv4 address explicitly
This commit is contained in:
@@ -39,7 +39,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
TelegrafServer = "http://localhost:8087/write"
|
||||
TelegrafServer = "http://127.0.0.1:8087/write"
|
||||
MeasurementsPrefix = "vm_"
|
||||
)
|
||||
|
||||
|
||||
@@ -100,6 +100,8 @@ func (s *SBaseSystemService) reloadConf(conf, conFile string) (bool, error) {
|
||||
oldConf := string(output)
|
||||
if strings.TrimSpace(conf) != strings.TrimSpace(oldConf) {
|
||||
log.Debugf("Reload service %s ...", s.name)
|
||||
log.Debugf("oldConf: [%s]", oldConf)
|
||||
log.Debugf("newConf: [%s]", conf)
|
||||
err := procutils.NewRemoteCommandAsFarAsPossible("rm", "-f", conFile).Run()
|
||||
if err != nil {
|
||||
return false, err
|
||||
|
||||
@@ -177,7 +177,7 @@ func (s *STelegraf) GetConfig(kwargs map[string]interface{}) string {
|
||||
conf += " collect_memstats = false\n"
|
||||
conf += "\n"
|
||||
conf += "[[inputs.http_listener]]\n"
|
||||
conf += " service_address = \"localhost:8087\"\n"
|
||||
conf += " service_address = \"127.0.0.1:8087\"\n"
|
||||
conf += "\n"
|
||||
return conf
|
||||
}
|
||||
@@ -211,7 +211,7 @@ func (s *STelegraf) BgReloadConf(kwargs map[string]interface{}) {
|
||||
|
||||
func (s *STelegraf) ReloadTelegraf() error {
|
||||
log.Infof("Start reolad telegraf...")
|
||||
telegrafReoladUrl := "http://localhost:8087/reload"
|
||||
telegrafReoladUrl := "http://127.0.0.1:8087/reload"
|
||||
_, _, err := httputils.JSONRequest(
|
||||
httputils.GetDefaultClient(), context.Background(),
|
||||
"POST", telegrafReoladUrl, nil, nil, false,
|
||||
|
||||
Reference in New Issue
Block a user