Merge pull request #6473 from JakubOnderka/misp-resource-widget

fix: [resource-widget] Use redisInfo method for getting info
pull/6478/head
Jakub Onderka 2020-10-21 09:13:51 +02:00 committed by GitHub
commit 197eee9013
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -16,14 +16,15 @@ class MispAdminResourceWidget
{
$this->Server = ClassRegistry::init('Server');
$data = array();
$redis = $this->Server->setupRedis();
if ($redis) {
$memory_stats = round($redis->rawCommand('memory', 'stats')[3] / 1024 / 1024) . 'M';
$redisInfo = $this->Server->redisInfo();
if ($redisInfo['connection']) {
$memory_stats = round($redisInfo['used_memory'] / 1024 / 1024) . 'M';
$data[] = array(
'title' => __('Current Redis memory usage'),
'value' => h($memory_stats)
);
$memory_stats = round($redis->rawCommand('memory', 'stats')[1] / 1024 / 1024) . 'M';
$memory_stats = round($redisInfo['used_memory_peak'] / 1024 / 1024) . 'M';
$data[] = array(
'title' => __('Peak Redis memory usage'),
'value' => h($memory_stats)