diff --git a/crawler/impl/ssh/SSHCrawler.go b/crawler/impl/ssh/SSHCrawler.go index 10e05a8..0ba74b2 100644 --- a/crawler/impl/ssh/SSHCrawler.go +++ b/crawler/impl/ssh/SSHCrawler.go @@ -6,6 +6,7 @@ import ( "fmt" configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model" + configUtil "git.loafle.net/overflow/overflow_commons_go/modules/config/util" "git.loafle.net/overflow/overflow_probe_container_network/crawler" "git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/ssh/client" "git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/ssh/parser" @@ -50,7 +51,6 @@ func (c *SSHCrawler) InternalGet(config *configM.Config) (map[string]string, err pScanner := parser.NewParserScanner(scanner, boundary) - for i := 0; i < itemCount; i++ { item := config.Items[i] mode := item.QueryInfo.Extend["mode"].(string) @@ -65,8 +65,9 @@ func (c *SSHCrawler) InternalGet(config *configM.Config) (map[string]string, err } if nil != rm { - for k, v := range rm { - results[k] = v + mm := configUtil.KeysToMap(item.Keys) + for key, value := range mm { + results[value] = rm[key] } } diff --git a/crawler/impl/ssh/SSHCrawler_test.json b/crawler/impl/ssh/SSHCrawler_test.json index 6896644..8db3b01 100644 --- a/crawler/impl/ssh/SSHCrawler_test.json +++ b/crawler/impl/ssh/SSHCrawler_test.json @@ -20,10 +20,11 @@ "container": "go_proxy" }, "items": [{ - "keys": [{ - "metric": "cpu.usage.sum", - "key": "sum" - }, + "keys": [ + { + "metric": "cpu.usage.sum", + "key": "sum" + }, { "metric": "cpu.usage.user", "key": "user"