bmon icon indicating copy to clipboard operation
bmon copied to clipboard

Feature: Unix Timestamp

Open jean2 opened this issue 5 years ago • 1 comments

A quick feature request. When output is ASCII, it would be nice if it would dump the unix timestamp (i.e. date/time) with each record. This way, it can be correlated with other source of data, such as a tcpdump. A simple call to clock_gettime(CLOCK_REALTIME) should work, just dump the raw 64 bit number, no need to convert it to a date/time string (scripts are pretty good at that job, simple numbers are easier to parse). See tcpdump -tt for example. Thanks in advance !

jean2 avatar Apr 24 '20 00:04 jean2

I ended up here while Googling for "bmon" "timestamp" to see if it was already a feature. As a workaround, I'm piping the output through a little loop to prepend the epoch, maybe someone will find this useful:

[user@host]$ bmon -p alc0,dc0 -o format:'$(element:name) $(attr:rxrate:bytes) \
    $(attr:txrate:bytes) $(attr:rxrate:packets) $(attr:txrate:packets)' \
    | while read line; do echo "`date +%s` $line"; done

1598927949 alc0 1529311976 40593917056 14509911 32029946
1598927949 dc0 38970481370 1618897808 32370475 15671695
1598927950 alc0 1529313850 40593998336 14509941 32030016
1598927950 dc0 38970562318 1618899394 32370547 15671724
1598927951 alc0 1529319224 40594125183 14509991 32030125
1598927951 dc0 38970688833 1618904444 32370649 15671771
...

parseword avatar Sep 01 '20 02:09 parseword