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

Net plugin bytes sent/recieved resets to 0 if host reboots #4531

Closed
douglasg14b opened this issue Aug 8, 2018 · 4 comments
Closed

Net plugin bytes sent/recieved resets to 0 if host reboots #4531

douglasg14b opened this issue Aug 8, 2018 · 4 comments
Labels
discussion Topics for discussion

Comments

@douglasg14b
Copy link

douglasg14b commented Aug 8, 2018

Bug? Maybe feature request?

On freebsd.

Current behavior:

Collecting Net data bytes_sent and bytes_recv go sup over time, as expected. However when the host reboots these are set to 0 and go up again as data is sent/recieved.

Desired behavior:

The bytes_sent and bytes_recv maintain their previous values and continue to go up.

Use case:

When this reset to 0 is completely breaks any total bandwidth usage queries as it relies on the first vs last bytes_sent and bytes_recv for the timerange to get a total.

Ie. start: 100 bytes, end: 4000 bytes. Total for range is 3900 bytes. If it was to reset to 0 in the middle of a daterange you get negative bandwith usage using this.

@douglasg14b douglasg14b changed the title Net plugin bytes sent/recieved resets to 0 if hosts reboots Net plugin bytes sent/recieved resets to 0 if host reboots Aug 8, 2018
@voiprodrigo
Copy link
Contributor

voiprodrigo commented Aug 8, 2018

It’s the OS that resets the counter. Use non negative difference or non negative derivative for calculations.

Sent with GitHawk

@danielnelson danielnelson added the discussion Topics for discussion label Aug 8, 2018
@douglasg14b
Copy link
Author

douglasg14b commented Aug 8, 2018

@voiprodrigo Can you explain what you mean by a non-negative derivative to avoid something like this. Do you have an example? I've been struggling to figure this out for weeks, and have not been able to find an answer.... I'm pretty desperate at this point.

I'm not using a derivative for this item

Example of what happens when it sets to 0 in the middle of a time range:

image

Query:

SELECT (last("bytes_sent") - first("bytes_sent")) + (last("bytes_recv") - first("bytes_recv")) FROM "net" WHERE ("interface" = 'em4') AND $timeFilter GROUP BY time($__interval) fill(null)

@douglasg14b
Copy link
Author

Oh I see, I can use SELECT non_negative_difference("bytes_recv") FROM "net" WHERE ("interface" = 'em4') AND $timeFilter to get the difference.

Though it does make sparklines look terrible.
image

@voiprodrigo
Copy link
Contributor

voiprodrigo commented Aug 8, 2018

Add a last() to bytes_recv within non_negative_difference() and group by time. The larger the time value, the less resolution you'll see in the lines. Suit to taste.

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

No branches or pull requests

3 participants