I know this might be a stupid question, but as I am new to Ubuntu I don't even know how google it.
I want to show network stats using bmon in a special format so I can read it later with another script.
I read through help, and I was able to achieve most of my need using this command:
bmon -p 'ens3' -r 3 -o format:fmt='rx=$(attr:rx:bytes) tx=$(attr:tx:bytes)\n'
The problem with this command is that it keeps posting stats every x amount of seconds. I want it to only show stats once.
I found in the help that I can use quitafter:
root@domain:~# bmon -o format:help
format - Formatable Output
Formatable ASCII output for scripts. Calls a drawing function for
every item per node and outputs according to the specified format
string. The format string consists of normal text and placeholders
in the form of $(placeholder).
Author: Thomas Graf <tgraf@suug.ch>
Options:
fmt=FORMAT Format string
stderr Write to stderr instead of stdout
quitafter=NUM Quit bmon after NUM outputs
But I can't make it work. I tried a lot of things:
bmon -p 'ens3' -r 3 -o format:quitafter=1:fmt='rx=$(attr:rx:bytes) tx=$(attr:tx:bytes)\n'
bmon -p 'ens3' -r 3 -o format:quitafter=1 fmt='rx=$(attr:rx:bytes) tx=$(attr:tx:bytes)\n'
bmon -p 'ens3' -r 3 -o format:fmt='rx=$(attr:rx:bytes) tx=$(attr:tx:bytes)\n' quitafter=1
bmon -p 'ens3' -r 3 -o format:fmt='rx=$(attr:rx:bytes) tx=$(attr:tx:bytes)\n':quitafter=1
None worked.
Please help me, thanks.