Skip to content
Snippets Groups Projects
Commit 694733d5 authored by Tibo's avatar Tibo
Browse files

Max memory

parent 845bec6a
No related branches found
No related tags found
No related merge requests found
......@@ -19,15 +19,16 @@ class MemInfo extends AbstractSensor {
foreach ($records as $record) {
$meminfo = $this->parseMeminfo($record->memory);
$used[] = new Point(
$record->time * 1000, $meminfo->used() / 1024);
$record->time * 1000, $meminfo->used() / 1000);
$used_cached[] = new Point(
$record->time * 1000,
($meminfo->used() + $meminfo->cached) / 1024);
($meminfo->used() + $meminfo->cached) / 1000);
}
return view("agent.meminfo", [
"used" => $used,
"used_cached" => $used_cached]);
"used_cached" => $used_cached,
"server" => $this->getServer()]);
}
public function status() {
......
......@@ -134,12 +134,20 @@ class Server extends Model
}
public function meminfo() {
return round($this->memoryTotal() / 1000 / 1000) . " GB";
}
/**
*
* @return int total memory (in KB)
*/
public function memoryTotal() {
$record = $this->lastRecordContaining("memory");
if ($record == null) {
return "";
return null;
}
return round($this->parseMeminfo($record->memory)/1000/1000) . " GB";
return $this->parseMeminfo($record->memory);
}
const MEMINFO = "/^MemTotal:\\s+([0-9]+) kB$/m";
......
......@@ -35,6 +35,27 @@
labelString: 'Memory [MB]'
}
}]
},
annotation: {
// Defines when the annotations are drawn.
// This allows positioning of the annotation relative to the other
// elements of the graph.
//
// Should be one of: afterDraw, afterDatasetsDraw, beforeDatasetsDraw
// See http://www.chartjs.org/docs/#advanced-usage-creating-plugins
drawTime: 'afterDatasetsDraw', // (default)
// Array of annotation configuration objects
// See below for detailed descriptions of the annotation options
annotations: [{
drawTime: 'afterDraw', // overrides annotation.drawTime if set
type: 'line',
mode: 'horizontal',
scaleID: 'y-axis-0',
value: '{{ $server->memoryTotal() / 1000 }}',
borderColor: 'red',
borderWidth: 2
}]
}
}
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment