test
This commit is contained in:
parent
6fa01a3e43
commit
6c5db94606
|
@ -1,6 +1,8 @@
|
||||||
package ssh
|
package ssh
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
cnsms "git.loafle.net/commons/service_matcher-go/ssh"
|
cnsms "git.loafle.net/commons/service_matcher-go/ssh"
|
||||||
|
@ -42,7 +44,10 @@ func (c *SSHHealthCrawler) Get(config *ocmsc.SensorConfig) (map[string]string, e
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
elapsed := time.Since(start)
|
elapsed := time.Since(start)
|
||||||
result[mci.Key] = elapsed.String()
|
if !strings.Contains(elapsed.String(), "ms") {
|
||||||
|
return nil, fmt.Errorf("Not valid data : %s", elapsed)
|
||||||
|
}
|
||||||
|
result[mci.Key] = strings.Split(elapsed.String(), "ms")[0]
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
|
|
|
@ -11,14 +11,13 @@ import (
|
||||||
func TestMatch(t *testing.T) {
|
func TestMatch(t *testing.T) {
|
||||||
config := &ocmsc.SensorConfig{}
|
config := &ocmsc.SensorConfig{}
|
||||||
config.Connection = &ocmsc.SensorConfigConnection{
|
config.Connection = &ocmsc.SensorConfigConnection{
|
||||||
MetaIPTypeKey: "V4",
|
MetaIPTypeKey: "V4",
|
||||||
IP: "192.168.1.111",
|
IP: "192.168.1.103",
|
||||||
MetaPortTypeKey: "TCP",
|
MetaPortTypeKey: "TCP",
|
||||||
Port: "22",
|
Port: "22",
|
||||||
MetaCryptoTypeKey: "SSL",
|
|
||||||
}
|
}
|
||||||
metaCollectionItem := &meta.MetaCollectionItem{
|
metaCollectionItem := &meta.MetaCollectionItem{
|
||||||
Key: "service.health.response_time",
|
Key: "ssh.response_time",
|
||||||
}
|
}
|
||||||
config.MetaCollectionItems = make([]*meta.MetaCollectionItem, 1)
|
config.MetaCollectionItems = make([]*meta.MetaCollectionItem, 1)
|
||||||
config.MetaCollectionItems[0] = metaCollectionItem
|
config.MetaCollectionItems[0] = metaCollectionItem
|
||||||
|
|
Loading…
Reference in New Issue
Block a user