Real-time montoring script RAM bug
BMPCreated with Sketch.BMPZIPCreated with Sketch.ZIPXLSCreated with Sketch.XLSTXTCreated with Sketch.TXTPPTCreated with Sketch.PPTPNGCreated with Sketch.PNGPDFCreated with Sketch.PDFJPGCreated with Sketch.JPGGIFCreated with Sketch.GIFDOCCreated with Sketch.DOC Error Created with Sketch.
Question

Real-time montoring script RAM bug

by
ChristianB
Created on 2018-08-18 10:12:24 (edited on 2024-09-04 14:24:40) in Virtual Private Servers

Hi,

Running Ubuntu 16.04, it looks like there is a bug in the ram part of the rtm script (https://docs.ovh.com/gb/en/dedicated/install-rtm/)

Here is the output of free:
>total used free shared buff/cache available
>Mem: 16198832 3225488 3522340 253672 9451004 12327944
>Swap: 523260 4 523256

The script gives me -114% as a result for ram consumption.

Looking at the script
> $mem_swap_usage{'mem_total'} = $1;
> $mem_swap_usage{'mem_used'} = $2;
> $mem_swap_usage{'mem_free'} = $3;
> $mem_swap_usage{'mem_shared'} = $4;
> $mem_swap_usage{'mem_buffers'} = $5;
> $mem_swap_usage{'mem_cached'} = $6;
> $mem_swap_usage{'mem_used_pr'} = sprintf("%d", (($2-$5-$6)/$1*100));

mem_cached is actually "available" from free, so it does used - cached - available / total, which doesn't make sense.

Maybe the script assume a different "free" format, or was based upon "/proc/meminfo", but I think the proper value should be:
> $mem_swap_usage{'mem_used_pr'} = sprintf("%d", (($1-$6)/$1*100));

Blockquote


Replies are currently disabled for this question.