From f8580434e8c2381fe3b6a37841c853a935916b22 Mon Sep 17 00:00:00 2001 From: crusader Date: Thu, 14 Dec 2017 16:35:12 +0900 Subject: [PATCH] ing --- crawler/impl/ssh/SSHCrawler.go | 7 ++++--- crawler/impl/ssh/SSHCrawler_test.json | 9 +++++---- 2 files changed, 9 insertions(+), 7 deletions(-) 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"