Skip to content

Commit

Permalink
chore: change some default config
Browse files Browse the repository at this point in the history
Signed-off-by: Rory Z <[email protected]>
  • Loading branch information
Rory-Z committed Nov 21, 2023
1 parent 8282f10 commit 88a1a9f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/x509"
"fmt"
"os"
"strings"
"sync"

"github.com/prometheus/client_golang/prometheus"
Expand Down Expand Up @@ -170,10 +171,14 @@ func (sc *SafeConfig) ReloadConfig(confFile string) (err error) {
probe.Scheme = "tcp"
}
if probe.ClientID == "" {
probe.ClientID = "emqx_exporter_probe_" + fmt.Sprintf("%d", index)
hostname, _ := os.Hostname()
hostname = strings.Replace(hostname, ".", "-", -1)
probe.ClientID = "emqx-exporter-probe-" + hostname + fmt.Sprintf("%d", index)
}
if probe.Topic == "" {
probe.Topic = "emqx-exporter-probe-" + fmt.Sprintf("%d", index)
hostname, _ := os.Hostname()
hostname = strings.Replace(hostname, ".", "-", -1)
probe.Topic = "emqx-exporter-probe/" + hostname + "/" + fmt.Sprintf("%d", index)
}
if probe.KeepAlive == 0 {
probe.KeepAlive = 30
Expand Down

0 comments on commit 88a1a9f

Please sign in to comment.