Simple resource logging tool/script for Linux?

Hello, I need to evaluate “how much” of my lab computational server resources are actually used (RAM,CPU,disk, network) and which are the bottlenecks before eventually update the server to a bigger one.
So, I plan to have some, let’s say hour observations of these parameters, and after a month or so evaluate the average resources usage/peak frequency.
Is there some “simple” tool that allow me to do that? I have saw stuff like prometheus but it seems overwhelm for this simple job. Perhaps someone already wrote a simple script can can be run with cron and do the job…

My server is Ubuntu 20.04

1 Like

I have solved with the following script (adapted from this blog):

nano /var/log/resource_usage.csv

chmod 664 /var/log/resource_usage.csv 

nano /usr/bin/
#! /bin/bash
printf -v TIME '%(%Y%m%d%H%M%S)T\t'
MEMORY=$(free -m | awk 'NR==2{printf "%.3f\t", $3/$2 }')
DISK=$(df -h | awk '$NF=="/"{printf "%.3f\t", $5/100}')
CPU=$(top -bn1 | grep load | awk '{printf "%.3f\t\n", $(NF-2)/100}')

nano /etc/crontab
*/5   *  *   *   *   root /usr/bin/ >>  /var/log/resource_usage.csv
1 Like

I am currently monitoring some of my private VMs with monitorix.