Skip to content

lsmenicucci/top-mon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A simple script that collects CPU and memory usage from the leading processes listed by the top command and stores on a local sqlite database. Values are stores in a 'round-robin' fashion so older data gets removed when the storage hits its limits.

The collected can be later plotted using vega-lite, like this:

sample output

The number of processes as well as the maximum number of records stores can be adjusted in mon.sh.

Dependencies

For collecting:

  • top, awk
  • sqlite3

For plotting:

Usage

Start a store with:

./mon.sh data.db init

And record data with:

./mon.sh data.db record

Preferably, you may setup a cron like:

*   *   *   *   *   cd <path-to-this-folder> && ./mon.sh data.db record

which fetches data every minute.

Plotting:

To plot, simply do:

./plot.sh data.db  # output to out.png 
# or
/plot.sh data.db top-usage.png

Notes

  • Special thanks to this post which explains how to use a sqlite3 table as a circular buffer.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages