Example #1
0
func updateWithMemStats(platform boshplatform.Platform, hb boshmbus.Heartbeat) (updatedHb boshmbus.Heartbeat) {
	updatedHb = hb
	memStats, err := platform.GetMemStats()
	if err != nil {
		return
	}

	percent := float64(memStats.Used) / float64(memStats.Total) * 100
	kb := memStats.Used / 1024

	updatedHb.Vitals.UsedMem = boshmbus.MemStats{
		Percent: fmt.Sprintf("%.0f", percent),
		Kb:      fmt.Sprintf("%d", kb),
	}
	return
}