Loadmonitor

Image

What is it?

This script is a Bash script that will reguarly connect to one or more hosts using ssh (or localhost) and show the following statistics:

  • Average load (during last minute, same as from uptime command)
  • Average CPU usage in %
  • Current memory usage in %
  • Average disk activity (write and read) in kb/s
  • Average network activity (receive and transmit) in kb/s

How to run

loadmonitor.sh [OPTIONS] [HOSTS]

The script will connect to every host of the HOSTS at regular intervals, by default every 60 seconds. It can be changed when invoking the program, or interactively at run time.

The example above (the animated gif) basically shows the interactive usage (of version 1.0). It also shows that you can redirect it to file for further analysis.

Connection to remote host must be setup beforehand using SSH private/public key pairs instead of passwords.

Download

loadmonitor.sh, version 1.2 (2018-03-06)

  • Bugfix: Fixed bug when calculating number of processors.

loadmonitor.sh, version 1.1 (2017-08-17)

  • Network activity is for all devices (except lo), before: only first device
  • Disk activity is for all sd? devices, before: only sda
  • Monitor the local computer without using ssh (defined as special host . (dot))
  • Added uptime column to output (either seconds or human readable)
  • Show detailed view for sd? and network devices (with -d option)
  • Added -i option
  • In interactive mode: press P for pausing.
  • Bugfixes:
    - Non english locales works

Tested on: Ubuntu 17.04, 16.04 LTS (swedish),

loadmonitor.sh, version 1.0 (2017-08-01)

  • First version

Known Bugs

This is a list of known bugs for the latest version:

  • Inserting and removing disks with detailed option (flag -d) will give an error during first access.
  • Some distros use mmclbk0 instead of sda for harddisk (applies to Debian on Raspberry Pi at least), this will be shown as 0 reades/writes on disk.

Return to Linux stuff