diff options
Diffstat (limited to 'devices/remote.go')
-rw-r--r-- | devices/remote.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/devices/remote.go b/devices/remote.go index a86f3ee..2366aab 100644 --- a/devices/remote.go +++ b/devices/remote.go @@ -24,6 +24,7 @@ var remoteLock sync.Mutex // TODO Replace custom decoder with https://github.com/prometheus/common/blob/master/expfmt/decode.go // TODO MQTT / Stomp / MsgPack func init() { + // TODO add this to help text opflag.StringVarP(&name, "remote-name", "", "", "Remote: name of remote gotop") opflag.StringVarP(&remote_url, "remote-url", "", "", "Remote: URL of remote gotop") opflag.DurationVarP(&sleep, "remote-refresh", "", 0, "Remote: Frequency to refresh data, in seconds") @@ -37,10 +38,6 @@ type Remote struct { } func startup(vars map[string]string) error { - // Don't set anything up if there's nothing to do - if name == "" || remote_url == "" { - return nil - } _cpuData = make(map[string]int) _tempData = make(map[string]int) _netData = make(map[string]float64) @@ -49,6 +46,10 @@ func startup(vars map[string]string) error { remoteLock = sync.Mutex{} remotes := parseConfig(vars) + // Don't set anything up if there's nothing to do + if (name == "" || remote_url == "") && len(remotes) == 0 { + return nil + } if remote_url != "" { r := Remote{ url: remote_url, @@ -230,6 +231,7 @@ func updateUsage(cpus map[string]int, _ bool) map[string]error { func parseConfig(vars map[string]string) map[string]Remote { rv := make(map[string]Remote) + log.Printf("VARS = %s", vars) for key, value := range vars { if strings.HasPrefix(key, "remote-") { parts := strings.Split(key, "-") |