Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Unix Timestamp #82

Open
jean2 opened this issue Apr 24, 2020 · 1 comment
Open

Feature: Unix Timestamp #82

jean2 opened this issue Apr 24, 2020 · 1 comment

Comments

@jean2
Copy link

jean2 commented Apr 24, 2020

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 !

@parseword
Copy link

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
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants