Visualize sar/sysstat data in multipane terminal with "zooming" possibility and multiple host support. An alternative to kSar, sarplot.
Prerequisites:
- python 3.12+
apt-get install sysstat- obvious, you probably have this already running
For panel support:
apt-get install tmuxapt-get install rlwrap- (optional) to provide command line history
Installation:
git clone git@github.com:brablc/lazysar.git /usr/local/lib/lazysar
/usr/local/lib/lazysar/install.shlazysar calls sar command to get data. It would pass all parameters unknown to it to sar. Additionally it would simplify selecting days by transforming --ago=N to something like -f /var/log/sysstat/sa$(date -d 'N days ago' +'%d'). You can specify minutes ago too --ago=15m, this would select current date and pass -s with time 15 minutes ago.
Some charts have multiple sets of data, namely disk and network. Use --dev=sda or --iface=eth1 to select the right set. For cpu use sar's arguments -P 0 (to select CPU 0), try with lazysar panel cpu4.
Tip
- Save default parameters to
$HOME/.config/lazysar/defaults, they will be added to every command.
lazysar --ago=1
lazysar --ago=15mPresets combine multiple parameters, like excluding, including columns, describing labels, ... to make the charts more readable.
See presets.json. File in $HOME/.config/lazysar/presets.json has precedence.
# Show one chart
lazysar --preset=cpu
# Show all charts
lazysar -l | xargs -I{} lazysar --dev=sda --iface=eth1 --ago=1 --preset={} --height=30Show multiple charts in predefined tmux layout. Layout will be searched first in $HOME/.config/lazysar/layouts/ and if not found in project's ./layouts.
When panelized lazysar will show legend on top, out of the screen to maximize chart area. You can scroll the pane to see the legend.
lazysar panel [LAYOUT_NAME] [DEFAULTS...]
# list available layouts
lazysar panel -l
lazysar panel --list
# start panel and refresh ever 5 seconds
lazysar panel --refresh=5
lazysar panel --host=node1Use the bottom panel to send different set of arguments to all panes (in all sessions!) at once. Examples:
# today
--dev=sda --iface=eth1
# yesterday - "zommed" to time 06:00 to 07:00
--dev=sda --iface=eth1 --ago=1 -s 06:00 -e 07:00Uses layouts/basic.sh - should work out of the box.
Uses layouts/swarm-nodes.sh - discovers Docker Swarm nodes automatically via docker node ls. Runs sar locally on the current host and over SSH on remote nodes.
The basic example uses cpu preset, while mutliple hosts uses cpu100 so the charts are comparable.
Prepare a script with selected reports (useful even for quick check from terminal):
#!/usr/bin/env bash
lazysar --ago=1 --preset=cpu100 --height=10 --width=80 --title="CPU mng" --no-legend
lazysar --ago=1 --preset=cpu100 --height=10 --width=80 --title="CPU node1" --host="node1"
lazysar --ago=1 --preset=cpu100 --height=10 --width=80 --title="CPU node2" --host="node2"
Configure cron - requires apt-get install aha:
MAILTO="admin@example.com"
CONTENT_TYPE="text/html; charset=utf-8"
00 01 * * * root lazysar-report |& color-chart-to-html
Important
- Ensure you have a password-less SSH access from your reporting node to other nodes.
Uses Plotille for visualization.

