Page 1 of 1
Memory Check For Linux
Posted: Thu Dec 21, 2023 8:56 am
by sridgy
Hi, does anyone know of a memory check for Linux that checks available memory as opposed to free memory, check_mem.pl seems to only do free memory but its the lack of available memory that would actually cause me an issue so that's what I'd like to check.
total used free shared buff/cache available
Mem: 502 22 4 258 474 218
Cheers
Re: Memory Check For Linux
Posted: Thu Dec 21, 2023 2:27 pm
by bbahn
Hello sridgy,
If you'd like to check for available memory, the free and available memory are both listed from the
free command on Linux and should be listed from the
check_mem.pl script. From your post above, it seems that your available memory is the last one listed.
If you'd like a script the exclusively outputs available memory, you can make a bash script such as the following:
Code: Select all
#!/bin/bash
available_mem=$(grep MemAvailable /proc/meminfo | awk '{print $2}')
available_mem_mb=$((available_mem / 1024))
echo "Available Memory: ${available_mem_mb} MB"