lmkaaround.blogg.se

Check ram utilization in linux
Check ram utilization in linux










check ram utilization in linux

In this tutorial, learn some of the useful command-line tools to check CPU usage and their usage in Linux-based distros. Operating systems have built-in system calls which these tools rely on to extract the performance readings. There are a lot of tools available to monitor and display CPU performance. Monitoring the performance of the CPU is essential to debug processes inside any system, manage system resources, make system decisions, and evaluate and examine systems in real-time.

check ram utilization in linux

Output: You will receive an email alert similar to the one below.CPU performance is one aspect of measuring the performance of a system. 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. 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 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