max, min and mean in the same function
This commit is contained in:
parent
56f99b2129
commit
8ea6989ea4
@ -86,22 +86,54 @@ class UsageReportPlugin {
|
||||
stats['salt_days'] = require('/home/thannos/xo-server/salt_days.json')
|
||||
|
||||
// ===================================================================
|
||||
|
||||
// xo-cli generateCpuReport machine=lab1
|
||||
this._unsets.push(this._xo.api.addMethod('generateCpuReport', ({ machine }) => {
|
||||
// TODO: compute and returns CPU mean, min & max.
|
||||
}))
|
||||
|
||||
this._unsets.push(this._xo.api.addMethod('generateLoadMeanL1Days', () => {
|
||||
return computeMean(parsedHostDaysLab1.stats.load)
|
||||
}))
|
||||
|
||||
this._unsets.push(this._xo.api.addMethod('generateLoadMaxL1Days', () => {
|
||||
return computeMax(parsedHostDaysLab1.stats.load)
|
||||
this._unsets.push(this._xo.api.addMethod('generateLoadLab1', () => {
|
||||
let maxLoad = computeMax(stats['lab1_days'].stats.load)
|
||||
let minLoad = computeMin(stats['lab1_days'].stats.load)
|
||||
let meanLoad = computeMean(stats['lab1_days'].stats.load)
|
||||
// return `${maxLoad}${space}${minLoad}${space}${meanLoad}`
|
||||
return {
|
||||
'max': maxLoad,
|
||||
'min': minLoad,
|
||||
'mean': meanLoad
|
||||
}
|
||||
}))
|
||||
|
||||
this._unsets.push(this._xo.api.addMethod('generateLoadMinL1Days', () => {
|
||||
return computeMin(parsedHostDaysLab1.stats.load)
|
||||
// memory
|
||||
this._unsets.push(this._xo.api.addMethod('generateMemoryLab1', () => {
|
||||
let maxMemory = computeMax(stats['lab1_days'].stats.memory)
|
||||
let minMemory = computeMin(stats['lab1_days'].stats.memory)
|
||||
let meanMemory = computeMean(stats['lab1_days'].stats.memory)
|
||||
return {
|
||||
'max': maxMemory,
|
||||
'min': minMemory,
|
||||
'mean': meanMemory
|
||||
}
|
||||
}))
|
||||
// memoryUsed
|
||||
this._unsets.push(this._xo.api.addMethod('generateMemoryUsedLab1', () => {
|
||||
let maxMemoryUsed = computeMax(stats['lab1_days'].stats.memoryUsed)
|
||||
let minMemoryUsed = computeMin(stats['lab1_days'].stats.memoryUsed)
|
||||
let meanMemoryUsed = computeMean(stats['lab1_days'].stats.memoryUsed)
|
||||
return {
|
||||
'max': maxMemoryUsed,
|
||||
'min': minMemoryUsed,
|
||||
'mean': meanMemoryUsed
|
||||
}
|
||||
}))
|
||||
// memoryFree
|
||||
this._unsets.push(this._xo.api.addMethod('generateMemoryFreeLab1', () => {
|
||||
let maxMemoryFree = computeMax(stats['lab1_days'].stats.memoryFree)
|
||||
let minMemoryFree = computeMin(stats['lab1_days'].stats.memoryFree)
|
||||
let meanMemoryFree = computeMean(stats['lab1_days'].stats.memoryFree)
|
||||
return {
|
||||
'max': maxMemoryFree,
|
||||
'min': minMemoryFree,
|
||||
'mean': meanMemoryFree
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user