Memory/Filesystem Percentage


In my case, I'm getting 0.96 memory used percentage, however, it should be 96.24 percentage

memory.used:            2018578432
memory.used.pct:       0.9624           2097442816

Looking into the code, I see in memory.go

	perc := float64(m.Mem.Used) / float64(m.Mem.Total)
	m.UsedPercent = common.Round(perc, common.DefaultDecimalPlacesCount)

	actualPerc := float64(m.Mem.ActualUsed) / float64(m.Mem.Total)
	m.ActualUsedPercent = common.Round(actualPerc, common.DefaultDecimalPlacesCount)

Same in

func AddFileSystemUsedPercentage(f *FileSystemStat) {
	perc := float64(f.Used) / float64(f.Used+f.Avail)
	f.UsedPercent = common.Round(perc, common.DefaultDecimalP)lacesCount

Shouldn't percentage be multiplied by 100.0. Is this an issue or am I missing something.

We store .pct values as you described above and let Kibana convert it to values from 0-100 in the visualisation. If you need it to be between 0 and 100 you need to multiply it by 100.

Additional note: Not for memory but in the CPU case pct can be > 1 (100) as there are mutliple CPU's.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.