

Monitorix got in-built HTTP so you can check the utilization and other stuff on the web. Redirect the above commands output to a log file. Monitorix A lightweight open-source utility to monitor the Linux server. Redis, Logstash, ElasticSearch or Kibana in the above caseĤ. Print the process name along with the resource usage. This command will provide a real-time view of CPU and memory utilization, allowing you to quickly identify areas of high resource usage. Print current timestamp when printing the resource details (through date +"%T")ģ. How To Check Cpu And Memory Utilization In Linux To check the CPU and memory utilization in Linux, you can use the top command. It prints the usage for the first pid (redis in the above script)Ģ.

Specifying multiple variables in the awk pattern is not working. Intro: Web Nmon (stands for Nigels performance Monitor) tool, which is used to monitor all Linux resources such as CPU, Memory, Disk Usage. Print the resource usage for multiple processes. REDIS_PID=$(ps -ef | grep redis | grep -v grep | awk ''ġ. You will receive a output like the one below by mail.#A script to log the cpu and memory usage of linux processes namely - redis, logstash, elasticsearch and kibana Note: You will be getting an email alert everyday at 8 o’clock. Youll find vmstat on almost all implementations of UNIX. # crontab -eĠ 8 * * * /bin/bash /opt/scripts/cpu-memory-swap-2.sh The UNIX vmstat utility is especially useful for monitoring the performance of Oracle databases. # chmod +x /opt/scripts/cpu-memory-swap-2.shįinally add a cronjob to automate this. Set an executable Linux file permission to “cpu-memory-swap-2.sh” file. Scpu=$(ssh $server cat /proc/stat | awk '/cpu/')Įcho "$server, $scpu, $smem, $sswap" > /tmp/cpu-mem-swap.csvĮcho "CPU and Memory Report for `date +"%B %Y"`" | mailx -s "CPU and Memory Report on `date`" -a /tmp/cpu-mem-swap.csv /tmp/cpu-mem-swap.csv

# vi /opt/scripts/cpu-memory-swap.shĮcho "-"Įcho "Server_Name CPU(%) Memory(%) Swap(%)"įor server in `more /opt/scripts/server-list.txt` This script allows you to check CPU, memory and swap usage on multiple Linux system from the terminal. Method-1 : Shell Script to Check CPU, Memory and Swap usage on Multiple Linux System But I found msprint, a simple text-based tool shipped with Valgrind, to be of great help already.

A great graphical tool for analyzing these files is massif-visualizer. Three shell scripts are added in this tutorial to generate a report.Įach bash script has written with unique features and choose the one you need.Īlso, you can modify this script based on your needs. These provide, (1) a timeline of memory usage, (2) for each snapshot, a record of where in your program memory was allocated. You can use this script to generate a CPU, memory and swap usage for a multiple Linux system. This script will help you to create a report for you.
