package dns import ( cnsmd "git.loafle.net/commons/service_matcher-go/dns" ocmsc "git.loafle.net/overflow/commons-go/model/sensorconfig" "git.loafle.net/overflow/container_network/crawler/health" crawler "git.loafle.net/overflow/crawler-go" ) type DNSHealthCrawler struct { health.SocketHealthCrawler } func (c *DNSHealthCrawler) Key() string { return "DNS_HEALTH" } func (c *DNSHealthCrawler) String() string { return "DNS Health Crawler" } func (c *DNSHealthCrawler) Auth(auth map[string]interface{}) error { return nil } func (c *DNSHealthCrawler) Get(config *ocmsc.SensorConfig) (map[string]string, error) { result := make(map[string]string, 0) conn, err := c.GetConnection(config) if err != nil { return nil, err } defer conn.Close() for _, mci := range config.MetaCollectionItems { switch mci.Key { case "dns.response_time": value, err := c.ResponseTime(config, conn) if err != nil { return nil, err } result[mci.Key] = value break default: break } } return result, nil } func NewCrawler() crawler.Crawler { c := &DNSHealthCrawler{} c.SetMatcher(cnsmd.NewMatcher()) return c }