Fix app docker (#14080)

* docker app: polling - RRD dataset and fields value mismatch

RRD dataset definitions and fields array keys passed to data_update
have to be in the same order. There is no match based on key before
building the rrdtool update command.

Fixes mem_perc ending as NaN because it ended with a value above 100
as it was given mem_limit bytes value.

* docker app - remove misleading divider

The mem_perc and cpu_usage are already in percent, no need to divide
them by a hundred. The values were then made into milli percent or micro
percent.
This commit is contained in:
Alban Browaeys
2022-07-15 16:12:20 +02:00
committed by GitHub
parent a9d5c378f7
commit a6bc7490e2
3 changed files with 2 additions and 4 deletions

View File

@@ -2,6 +2,5 @@
$unit_text = 'CPU (%)';
$rrdVar = 'cpu_usage';
$divider = 100;
require 'docker-common.inc.php';

View File

@@ -2,6 +2,5 @@
$unit_text = 'Memory (%)';
$rrdVar = 'mem_perc';
$divider = 100;
require 'docker-common.inc.php';

View File

@@ -55,9 +55,9 @@ foreach ($docker_data as $data) {
$fields = [
'cpu_usage' => (float) $data['cpu'],
'pids' => $data['pids'],
'mem_limit' => convertToBytes($data['memory']['limit']),
'mem_used' => convertToBytes($data['memory']['used']),
'mem_perc' => (float) $data['memory']['perc'],
'mem_used' => convertToBytes($data['memory']['used']),
'mem_limit' => convertToBytes($data['memory']['limit']),
];
$metrics[$container] = $fields;