ilya-manin / tmux-network-bandwidth

📊 Network bandwidth plugin for tmux
MIT License
76 stars 13 forks source link

Display error on ubuntu 18.04 #2

Closed zhwufd closed 4 years ago

zhwufd commented 4 years ago

awk in ubuntu 18.04

get_bandwidth_for_linux
...
print sum["bytesReceived"], sum["bytesSent"]

return scientific notation for big int.

local download_speed=$(((${second_measure[0]} - ${first_measure[0]}) / $sleep_time))
local upload_speed=$(((${second_measure[1]} - ${first_measure[1]}) / $sleep_time))

minus failed with first_measure and second_measure like 1e+12.

sudo apt install gawk

solve this problem.

ilya-manin commented 4 years ago

Hey @emmettwu

I just checked the plugin on ubuntu 18.04 and everything is ok, could you please double-check?

That's how I checked:

RUN apt-get update -qq && apt-get install -y \ curl \ gawk \ git-core \ net-tools \ tmux

RUN echo "set -g @plugin 'tmux-plugins/tpm'\n \ set -g @plugin 'xamut/tmux-network-bandwidth' \n \ run -b '~/.tmux/plugins/tpm/tpm' \n \ set-option -g status-interval 3 \n \ set-option -g status-right '#{network_bandwidth}'" > ~/.tmux.conf

RUN git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm RUN TMUX_PLUGIN_MANAGER_PATH="~/.tmux/plugins" ~/.tmux/plugins/tpm/bin/install_plugins

CMD tmux -u # Force UTF8 support



* Build the image `docker build -t tmux .`
* Run the container `docker run --rm -ir tmux`
* And inside the container run `curl -O http://dl-cdn.alpinelinux.org/alpine/v3.11/releases/x86_64/alpine-standard-3.11.3-x86_64.iso`

Result:
![image](https://user-images.githubusercontent.com/451082/73353753-a3f63180-42c6-11ea-88cf-150bb1290190.png)

Hope it helps you.
zhwufd commented 4 years ago

Your Dockerfile is Ok. Preinstalled awk in Ubuntu 18.04.3 is symlinked to /usr/bin/mawk. After Install gawk, everything is ok.

Thank you very much.

ilya-manin commented 4 years ago

I'm glad to see that the problem has been solved.