test
This commit is contained in:
parent
6fa01a3e43
commit
6c5db94606
|
@ -1,6 +1,8 @@
|
|||
package ssh
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
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
|
||||
}
|
||||
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
|
||||
default:
|
||||
break
|
||||
|
|
|
@ -12,13 +12,12 @@ func TestMatch(t *testing.T) {
|
|||
config := &ocmsc.SensorConfig{}
|
||||
config.Connection = &ocmsc.SensorConfigConnection{
|
||||
MetaIPTypeKey: "V4",
|
||||
IP: "192.168.1.111",
|
||||
IP: "192.168.1.103",
|
||||
MetaPortTypeKey: "TCP",
|
||||
Port: "22",
|
||||
MetaCryptoTypeKey: "SSL",
|
||||
}
|
||||
metaCollectionItem := &meta.MetaCollectionItem{
|
||||
Key: "service.health.response_time",
|
||||
Key: "ssh.response_time",
|
||||
}
|
||||
config.MetaCollectionItems = make([]*meta.MetaCollectionItem, 1)
|
||||
config.MetaCollectionItems[0] = metaCollectionItem
|
||||
|
|
Loading…
Reference in New Issue
Block a user