container_network/crawler/ssh/parser/memory_parser.go

34 lines
505 B
Go
Raw Permalink Normal View History

2018-04-19 15:46:38 +00:00
package parser
import (
"strings"
)
type MemoryParser struct {
}
2018-06-21 10:49:14 +00:00
func (p *MemoryParser) Key() string {
2018-04-19 15:46:38 +00:00
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()
}