ttyplot

Realtime terminal plotter
git clone git://git.sgregoratto.me/ttyplot
Log | Files | Refs | README | LICENSE

commit 95d2271a7b1c9d587352b8f983483e1a5c3588a4
parent a04701dbd148472734cf7e29bd885911a249b756
Author: Antoni Sawicki <as@tenoware.com>
Date:   Fri, 12 Oct 2018 01:22:06 -0700

fixes

Diffstat:
MREADME.md | 9+++++++--
Mttyplot.c | 10+++++-----
2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/README.md b/README.md @@ -51,6 +51,11 @@ snmpdelta -v 2c -c public -Cp 10 10.23.73.254 1.3.6.1.2.1.2.2.1.10.9 1.3.6.1.2. { while true; do curl -s http://10.4.7.180:9100/metrics | gawk '/^node_load1 / { print $2; fflush(); }'; sleep 1; done } | ttyplot ``` +### Disk Throughput from iostat +``` +iostat -xmy 1 | gawk '/^nvme0n1/ { print $4,$5; fflush(); }' | ttyplot -2 -t "nvme0n1 throughput" -u MB/s +``` + ### CPU temperature ``` { while true; do gawk '{ printf("%.1f\n", $1/1000); fflush(); }' /sys/class/thermal/thermal_zone0/temp; sleep 1; done } | ttyplot -t "cpu temp" -u C @@ -75,9 +80,9 @@ rate calculator for counters { while true; do snmpget -v 2c -c public 10.23.73.254 1.3.6.1.2.1.2.2.1.10.9 1.3.6.1.2.1.2.2.1.16.9 | gawk '{ print $NF/1000/1000; fflush(); }'; sleep 10; done } | ttyplot -2 -r -u "MB/s" ``` -### prometheus node exporter disk write MB/s for sda device +### prometheus node exporter disk throughput for sda device using two lines ``` -{ while true; do curl -s http://10.11.0.173:9100/metrics | gawk '/^node_disk_written_bytes_total{device="sda"}/ { printf("%f\n", $2/1024/1024); fflush(); }'; sleep 1; done } | ttyplot -r -u MB/s -t "10.11.0.173 sda writes" +{ while true; do curl -s http://10.11.0.173:9100/metrics | gawk '/^node_disk_.+_bytes_total{device="sda"}/ { printf("%f\n", $2/1024/1024); fflush(); }'; sleep 1; done } | ttyplot -r -2 -u MB/s -t "10.11.0.173 sda writes" ``` diff --git a/ttyplot.c b/ttyplot.c @@ -22,7 +22,7 @@ int usage() { exit(0); } -int getminmax(int pw, int n, double *values, double *min, double *max, double *avg) { +void getminmax(int pw, int n, double *values, double *min, double *max, double *avg) { double tot=0; int i=0; @@ -44,7 +44,7 @@ int getminmax(int pw, int n, double *values, double *min, double *max, double *a *avg=tot/pw; } -int draw_axes(int h, int w, int ph, int pw, double max, char *unit) { +void draw_axes(int h, int w, int ph, int pw, double max, char *unit) { mvhline(h-3, 2, ACS_HLINE, pw); mvaddch(h-3, 2+pw, ACS_RARROW); @@ -59,7 +59,7 @@ int draw_axes(int h, int w, int ph, int pw, double max, char *unit) { mvprintw((ph*3/4)+1, 4, "%.1f %s", max/4, unit); } -int draw_line(int ph, int l1, int l2, int x, chtype plotchar) { +void draw_line(int ph, int l1, int l2, int x, chtype plotchar) { if(l1 > l2) { mvvline(ph+1-l1, x, plotchar, l1-l2 ); mvvline(ph+1-l2, x, plotchar|A_REVERSE, l2 ); @@ -73,7 +73,7 @@ int draw_line(int ph, int l1, int l2, int x, chtype plotchar) { } -int draw_values(int h, int w, int ph, int pw, double *v1, double *v2, double max, int n, chtype plotchar) { +void draw_values(int h, int w, int ph, int pw, double *v1, double *v2, double max, int n, chtype plotchar) { int i; int x=3; int l1=0, l2=0; @@ -92,7 +92,7 @@ int draw_values(int h, int w, int ph, int pw, double *v1, double *v2, double max } -int resize(int sig) { +void resize(int sig) { endwin(); refresh(); }