Skip to content

Monitoring scripts and commands

Noxhaa edited this page Mar 30, 2022 · 4 revisions

In addition to the external links available on the wiki in order to track the activity of a node, here are some scripts that can be use to log CPU/RAM/network activities. These can be useful to monitor the node and/or help identify the issues that might occur. Note, the commands below are meant for Ubuntu server. The install commands only need to be run once.

Useful commands

CPU and RAM usage

View processes and their usages and kill them:
apt install htop
htop

Collect data every minute and save it in a file:
apt-get install sysstat
nohup pidstat -d -r -s -u -h -p $(pidof massa-node) 60 >> sys_load_cpu_ram_io.txt &

See the whole file starting from the end:
tail -f sys_load_cpu_ram_io.txt
See the whole file starting from the beginning:
cat -f sys_load_cpu_ram_io.txt
See the last 1000 lines:
tail -n 1000 logs.txt

Bandwith usage

Displays the transmit/receive data in a table:
sudo apt install vnstat
vnstat //for monthly usage + daily usage (today + yesterday)
vnstat -d //for daily usage (1 month period)
vnstat -h //for hourly usage (today + yesterday)

Displays the transmit/receive data in a png file:
sudo apt install vnstati
vnstati -s -i eth0 -o ~/network-log.png //for daily usage (today + yesterday)
vnstati -h -i eth0 -o ~/network-log.png //for hourly usage (today + yesterday)

Internet connection

Setting for eth0 (useful to see if your server is in full-duplex. See FAQ:
ethtool eth0

Get the ip address of your server (needed for the routability setup:
wget -qO- eth0.me

Info about the connection:
ip a

Python script

soon™