Skip to content

Monitor metrics in a real-time time-series line-graph (a-la perfmon.exe)

License

Notifications You must be signed in to change notification settings

pragma-/grafmon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

grafmon

Monitor metrics in a real-time time-series line-graph

screenshot

Demonstration video

demo video

Features

  • Real-time time-series graph of metrics.
  • Provide your own metric command.
  • Several built-in metrics.
  • Polished graph interface.
  • Adjustable refresh rate.
  • Pausable updates.
  • Hide/show lines.
  • Clickable/hoverable lines.
  • Remembers window position/layout.

Install

pip install grafmon

Usage

usage: grafmon [-h] [-m MONITOR | -c COMMAND] [-r REFRESHRATE] [-t MAXTICKS]
               [-l MAXLABELS] [--list-monitors]

Monitor metrics in a real-time time-series graph

options:
  -h, --help            show this help message and exit
  -m MONITOR, --monitor MONITOR
                        Select from builtin monitors to feed data into monitor
                        [default: pcpu]
  -c COMMAND, --command COMMAND
                        User command to feed data into monitor [example: ps
                        -eo rss,pid,comm --no-headers]
  -r REFRESHRATE, --refreshrate REFRESHRATE
                        Refresh rate in milliseconds [default: 1000]
  -t TICKS, --ticks TICKS
                        Count of ticks on X axis [default: 60]
  -l LABELS, --labels LABELS
                        Count of labels on X axis [default: 10]
  --list-monitors       List available builtin monitors

Builtin monitors

avgpcpu    Average CPU% (using `ps`) over lifetime of all processes
cuc        CPU%, including dead children, in extended ##.### format of all processes
cuu        CPU% in extended ##.### format of all processes
drs        Data resident set size of all processes
pcpu       Immediate CPU% (using `top`) of all processes
pmem       Physical memory percentage of all processes
pss        Proportional share size of all processes
rbytes     Number of bytes really fetched from storage layer of all processes
rchars     Number of bytes read from storage of all processes
rops       Number of read I/O operations of all processes
rss        Resident set size (physical memory usage, in kilobytes) of all processes
sz         Physical pages used of all processes
thcount    Thread counts of all processes
trs        Text resident set (executable code memory usage) of all processes
vsz        Virtual memory usage of all processes
wbytes     Number of bytes really written to storage layer of all processes
wcbytes    Number of canceled write bytes of all processes
wchars     Number of bytes written to storage of all processes
wops       Number of write I/O operations of all processes

Custom monitor

Grafmon is not limited to the builtin monitors. Grafmon also accepts user-provided commands for monitoring. Grafmon can monitor smart plug metrics to track power usage of appliances. Grafmon can monitor IoT sensors and more!

The command must output lines in the format of <float> <string> to STDIN. The <float> will be the value associated with <string>. The <string> may contain spaces. Grafmon will invoke the command every refresh-rate tick. It may be necessary to write a small wrapper script to convert the data to the correct formatting.

Examples:

grafmon -c 'ps -eo pcpu,pid,comm --no-headers'

grafmon -c 'cat somefile_that_gets_overwritten'

grafmon -c 'socat TCP-LISTEN:13510 -'

Notes

I needed an easy-to-install app that can graph in real-time various system metrics, notably percentages of CPU usages for all active processes. The KDE and Gnome system monitors/task managers graphed overall CPU usage rather than per-process usage.

Grafmon is inspired in part by Windows' perfmon.exe. The graph does not scroll, but instead updates in a "wipe". A vertical line will move from left-to-right as the metrics are read each tick. When the line reaches the end, it resets back to the beginning. This allows easy hovering over of graph elements to inspect the data. A moving scrolling graph would be more difficult to hover over the lines and their peaks.

Lines may be clicked on to highlight them to more easily see them in the graph. Lines may be hovered-over to see a tooltip of their values. Their values will also appear in the status bar at the bottom of the window.

To zoom the graph in to inspect lower valued lines, you can untick the checkboxes in the list on the left. Unticking checkboxes for lines with the highest peaks will hide the lines and the graph will zoom in to fit the next highest peaks.

About

Monitor metrics in a real-time time-series line-graph (a-la perfmon.exe)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published