Skip to content

Commit

Permalink
UCD buffers and cache discovered with inverted free/used values
Browse files Browse the repository at this point in the history
(polling was correct)
  • Loading branch information
murrant committed Nov 1, 2023
1 parent 7c542d7 commit a1aeb3b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions LibreNMS/Modules/Mempools.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,15 @@ private function calculateAvailable(Collection $mempools)
if ($system !== null) {
$old = Number::formatBi($system->mempool_free);
$system->fillUsage(($system->mempool_used - $buffers - $cached) / $system->mempool_precision, $system->mempool_total / $system->mempool_precision);

dd([
'used' => Number::formatBi($system->mempool_used),
'buffers' => Number::formatBi($buffers),
'cached' => Number::formatBi($cached),
'actual_used' => Number::formatBi($system->mempool_used - $buffers - $cached),
'old' => $old,
'free' => Number::formatBi($system->mempool_free),
]);
$new = Number::formatBi($system->mempool_free);
Log::debug("Free memory adjusted by availability calculation: {$old} -> {$new}\n");
}
Expand Down
4 changes: 2 additions & 2 deletions LibreNMS/OS/Traits/UcdResources.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function discoverMempools()
'mempool_precision' => 1024,
'mempool_descr' => 'Memory buffers',
'mempool_used_oid' => '.1.3.6.1.4.1.2021.4.14.0',
]))->fillUsage(null, $data[0]['memTotalReal'], $data[0]['memBuffer']));
]))->fillUsage($data[0]['memBuffer'], $data[0]['memTotalReal']));
}

if ($this->oidValid($data, 'memCached')) {
Expand All @@ -107,7 +107,7 @@ public function discoverMempools()
'mempool_precision' => 1024,
'mempool_descr' => 'Cached memory',
'mempool_used_oid' => '.1.3.6.1.4.1.2021.4.15.0',
]))->fillUsage(null, $data[0]['memTotalReal'], $data[0]['memCached']));
]))->fillUsage($data[0]['memCached'], $data[0]['memTotalReal']));
}

if ($this->oidValid($data, 'memSysAvail')) {
Expand Down

0 comments on commit a1aeb3b

Please sign in to comment.