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

Tell for how long has been the program running #63

Closed
vemv opened this issue Mar 28, 2016 · 3 comments
Closed

Tell for how long has been the program running #63

vemv opened this issue Mar 28, 2016 · 3 comments

Comments

@vemv
Copy link

vemv commented Mar 28, 2016

Hey there,

I run nethogs via upstart, e.g. it is supposed to be permanently running (and logging the output to files which I later analyse).

I run it with the -t and -v 3 options.

It'd be tremendously useful if the output said for how long has the nethogs process been running in total. That way I can identify each 'run' instantly, allowing me to discard 99% of the logs.

Current behavior

Refreshing:
/usr/bin/ssh/21045/1000 0.000234604 0.00025177
unknown TCP/0/0 0   0

Refreshing:
/usr/bin/ssh/21045/1000 0.000234604 0.00025177
unknown TCP/0/0 0   0

Desired behavior

nethogs started at 1459185766, and it has been running for 180 seconds now.
Refreshing:
/usr/bin/ssh/21045/1000 0.000234604 0.00025177
unknown TCP/0/0 0   0

nethogs started at 1459185766, and it has been running for 240 seconds now.
Refreshing:
/usr/bin/ssh/21045/1000 0.000234604 0.00025177
unknown TCP/0/0 0   0

Could you please implement this? Sounds easy :)

Surely this feature would be better added as an opt-in feature, disabled by default.

Cheers - Victor

@vemv
Copy link
Author

vemv commented Mar 28, 2016

Probably the following format would be better (as it's more machine-readable)

started_at: 1459185766
running_for: 240

@vemv
Copy link
Author

vemv commented Mar 28, 2016

Hmmm I just thought of solving this the unixy way:

nethogs -t p1p1 -d 3 -v 3 | awk -v now=$(date +%s) '{print now " " systime() " " $0}'

It just works :) closing.

@vemv vemv closed this as completed Mar 28, 2016
@raboof
Copy link
Owner

raboof commented Mar 29, 2016

Nice ;)

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