manhattangre.blogg.se

Check ram utilization in linux
Check ram utilization in linux







check ram utilization in linux

Why do you need to learn about Memory usage in Linux?īefore we start, it is essential to learn about memory usage.

  • Ability to install new packages, such as access to the APT package manager.
  • Access to a terminal or command line interface.
  • Access to a Linux user account with sudo privileges.
  • To follow the guide, you must have the following: You can still follow the guide using any other Linux distribution, as these command line tools work on all Linux distributions. It’ll help sysadmins and developers to use these tools to manage system memory confidently.įor this tutorial, we’re going to use Ubuntu 22.04.1 LTS. We’ll cover a detailed explanation of each Command and how to read the results. And that’s why, in this article, we’ll learn five ways to check memory usage in Linux. However, it doesn’t offer an intuitive way to check memory. Linux’s memory usage is low compared to other operating systems. Output: You will receive an email alert similar to the one below.Have you ever wondered how much memory is available on your Linux system? If you do, you’re not alone. Say for example If your system reaches the given limit after 8.25 minutes then you will be getting an email alert on the second cycle i.e after 10 minutes ( 2nd 5 minute cycle) Note: Since the script is scheduled to run once every 5 minutes, you will receive an email alert every 5 minutes. */5 * * * * /bin/bash /opt/scripts/memory-alert-1.sh SUBJECT="ATTENTION: Memory Utilization is High on $(hostname) at $(date)"Įcho "Memory Current Usage is: $ramusage%" > $MESSAGEĮcho "-" > $MESSAGEĮcho "Top Memory Consuming Processes Using top command" > $MESSAGEĮcho "$(top -b -o +%MEM | head -n 20)" > $MESSAGEĮcho "Top Memory Consuming Processes Using ps command" > $MESSAGEĮcho "$(ps -eo pid,ppid,%mem,%cpu,cmd -sort=-%mem | head)" > $MESSAGEįinally add a cronjob to automate this.

    check ram utilization in linux

    This will trigger an email when more than 60% of your system memory is used.

    check ram utilization in linux

    I preferred to go with this method for most of the time. This is very simple and straightforward one line script. If you want to get only the current Memory utilization percentage through mail when the system reaches the given threshold, use the following script. Method-1 : Linux shell script to monitor memory usage with email alert

    check ram utilization in linux

    When the system reaches the given threshold then it will trigger a mail to given email id. In this tutorial we have added two shell script to monitor Memory utilization on Linux system. If you only have few systems and want to monitor them then writing a small shell script can make your task very easy. It monitors everything such as CPU utilization, Memory utilization, swap utilization, disk space utilization and much more. There are many open source monitoring tools are currently available in market to monitor Linux systems performance which will send an email alert when the system reaches the specified threshold limit.









    Check ram utilization in linux