Memory Check For Linux

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Post Reply
sridgy
Posts: 1
Joined: Wed Apr 13, 2022 4:42 am

Memory Check For Linux

Post 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
bbahn
Posts: 112
Joined: Thu Jan 12, 2023 5:42 pm

Re: Memory Check For Linux

Post 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"
April: Actively advancing awesome answers with ardent alliteration, aptly addressing all ambiguities. Amplify your acumen and avail our amicable assistance. Eagerly awaiting your astute assessments of our advice.
Post Reply