Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tenox7 committed Oct 12, 2018
1 parent a04701d commit 95d2271
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
```


Expand Down
10 changes: 5 additions & 5 deletions ttyplot.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);

Expand All @@ -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 );
Expand All @@ -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;
Expand All @@ -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();
}
Expand Down

0 comments on commit 95d2271

Please sign in to comment.