diff options
author | Vladimir Kobal <vlad@prokk.net> | 2019-02-11 13:35:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-11 13:35:42 +0200 |
commit | 30f7324a6cdeaefbfee2960ffcc2a3b60e58c168 (patch) | |
tree | 8399a01558c370a2ca095f8d2df8123f711045b1 /web | |
parent | 2f6f8155dba6951256f5f8e080aafca6e6836dfc (diff) |
Add cgroup cpu and memory limits and alarms (#5172)
* Add memory limit variables
* Add memory usage alarms
* Add CPU limit variables
* Add cpu usage alarm
* Fix quota calculation, minor cleanup
* Update the documentation
* Add charts with limits
* Fix Codacy issues
* Change units for the mem_usage_limit chart
* Change the behaviour of the cpu_limit chart
Diffstat (limited to 'web')
-rw-r--r-- | web/gui/dashboard_info.js | 64 |
1 files changed, 61 insertions, 3 deletions
diff --git a/web/gui/dashboard_info.js b/web/gui/dashboard_info.js index 00cac63174..4de6081ec7 100644 --- a/web/gui/dashboard_info.js +++ b/web/gui/dashboard_info.js @@ -618,6 +618,10 @@ netdataDashboard.submenu = { // colors: the dimension colors of the chart (the default colors are appended) // height: the ratio of the chart height relative to the default // + +var cgroupCPULimitIsSet = 0; +var cgroupMemLimitIsSet = 0; + netdataDashboard.context = { 'system.cpu': { info: function (os) { @@ -1416,11 +1420,15 @@ netdataDashboard.context = { // ------------------------------------------------------------------------ // containers - 'cgroup.cpu': { + 'cgroup.cpu_limit': { + valueRange: "[0, null]", mainheads: [ function (os, id) { void(os); + cgroupCPULimitIsSet = 1; return '<div data-netdata="' + id + '"' + + ' data-dimensions="used"' + + ' data-gauge-max-value="100"' + ' data-chart-library="gauge"' + ' data-title="CPU"' + ' data-units="%"' @@ -1435,14 +1443,41 @@ netdataDashboard.context = { ] }, - 'cgroup.mem_usage': { + 'cgroup.cpu': { + mainheads: [ + function (os, id) { + void(os); + if (cgroupCPULimitIsSet === 0) { + return '<div data-netdata="' + id + '"' + + ' data-chart-library="gauge"' + + ' data-title="CPU"' + + ' data-units="%"' + + ' data-gauge-adjust="width"' + + ' data-width="12%"' + + ' data-before="0"' + + ' data-after="-CHART_DURATION"' + + ' data-points="CHART_DURATION"' + + ' data-colors="' + NETDATA.colors[4] + '"' + + ' role="application"></div>'; + } + else + return ''; + } + ] + }, + + 'cgroup.mem_usage_limit': { mainheads: [ function (os, id) { void(os); + cgroupMemLimitIsSet = 1; return '<div data-netdata="' + id + '"' + + ' data-dimensions="used"' + + ' data-append-options="percentage"' + + ' data-gauge-max-value="100"' + ' data-chart-library="gauge"' + ' data-title="Memory"' - + ' data-units="MB"' + + ' data-units="%"' + ' data-gauge-adjust="width"' + ' data-width="12%"' + ' data-before="0"' @@ -1454,6 +1489,29 @@ netdataDashboard.context = { ] }, + 'cgroup.mem_usage': { + mainheads: [ + function (os, id) { + void(os); + if (cgroupMemLimitIsSet === 0) { + return '<div data-netdata="' + id + '"' + + ' data-chart-library="gauge"' + + ' data-title="Memory"' + + ' data-units="MB"' + + ' data-gauge-adjust="width"' + + ' data-width="12%"' + + ' data-before="0"' + + ' data-after="-CHART_DURATION"' + + ' data-points="CHART_DURATION"' + + ' data-colors="' + NETDATA.colors[1] + '"' + + ' role="application"></div>'; + } + else + return ''; + } + ] + }, + 'cgroup.throttle_io': { mainheads: [ function (os, id) { |