container_network/crawler/ssh/parser/memory_parser.go
crusader f28ff9a303 ing
2018-04-20 00:46:38 +09:00

34 lines
506 B
Go

package parser
import (
"strings"
)
type MemoryParser struct {
}
func (p *MemoryParser) Name() string {
return "mem"
}
func (p *MemoryParser) Parse(scanner *ParserScanner) (map[string]string, error) {
var (
stats = map[string]string{}
)
for scanner.Scan() {
line := scanner.Text()
parts := strings.Fields(line)
key := parts[0][:len(parts[0])-1]
stats[key] = parts[1]
}
//res, err := mem.parse(keys, stats)
//if err != nil {
// return nil, err
//}
return stats, scanner.Err()
}