예제 #1
0
파일: smem.go 프로젝트: EvanKrall/fullerite
func (s *SmemStats) parseSmemLines(out string) []smemStatLine {
	raw := strings.Trim(out, "\n")
	lines := strings.Split(raw, "\n")
	stats := []smemStatLine{}

	for _, line := range lines {
		parts := strings.Fields(line)
		stats = append(stats, smemStatLine{
			proc: parts[3],
			pss:  util.StrToFloat(parts[0]),
			rss:  util.StrToFloat(parts[1]),
			vss:  util.StrToFloat(parts[2]),
		})
	}

	return stats
}
예제 #2
0
func (ss SocketQueue) emitSocketQueueMetrics(output []byte) {
	// Capture the receive queue size and the corres. port number from the output.
	lines := strings.Split(string(output), "\n")

	pmap := make(map[string]float64)
	for _, line := range lines[1:] {
		res := queueDataRegex.FindAllStringSubmatch(line, -1)
		for _, v := range res {
			sport, qsize := v[2], v[1]
			pmap[sport] = util.StrToFloat(qsize)
		}
	}

	for sport, qsize := range pmap {
		m := metric.WithValue("sq.listen", qsize)
		m.AddDimension("port", sport)
		ss.Channel() <- m
	}
}