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')
|
stats['salt_days'] = require('/home/thannos/xo-server/salt_days.json')
|
||||||
|
|
||||||
// ===================================================================
|
// ===================================================================
|
||||||
|
|
||||||
// xo-cli generateCpuReport machine=lab1
|
// xo-cli generateCpuReport machine=lab1
|
||||||
this._unsets.push(this._xo.api.addMethod('generateCpuReport', ({ machine }) => {
|
this._unsets.push(this._xo.api.addMethod('generateCpuReport', ({ machine }) => {
|
||||||
// TODO: compute and returns CPU mean, min & max.
|
// 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('generateLoadLab1', () => {
|
||||||
this._unsets.push(this._xo.api.addMethod('generateLoadMaxL1Days', () => {
|
let maxLoad = computeMax(stats['lab1_days'].stats.load)
|
||||||
return computeMax(parsedHostDaysLab1.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
|
||||||
|
}
|
||||||
}))
|
}))
|
||||||
|
// memory
|
||||||
this._unsets.push(this._xo.api.addMethod('generateLoadMinL1Days', () => {
|
this._unsets.push(this._xo.api.addMethod('generateMemoryLab1', () => {
|
||||||
return computeMin(parsedHostDaysLab1.stats.load)
|
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