contrib icon indicating copy to clipboard operation
contrib copied to clipboard

Traffic volume accounting plugin

Open madduck opened this issue 9 years ago • 7 comments

Hey @steveschnepp, I am taking you up on your "promise":

28 09:47 <@TheSnide> madduck: create an issue on contrib.git ? 
28 09:47 <@TheSnide> … i'll write the plugin for you :)

grin.

I am after a plugin that can graph accumulated volume of bits shoved over the wire, in style of the uptime graph, i.e. non-decreasing.

I found this nice idea using iptables and tags for counting (and then there is also /sys/class/net/$INTERFACE/statistics/rx_bytes), but the resulting plot shows bits-per-time-period, which is per-second.

It would be fantastic to have a stateful plugin, such that server resets and reboots don't leave too much of a dent, i.e. check the current value against the previous and if it's unreasonable (i.e. lower), then restart from the previous value.

Also, we'd need support for a reset threshold, ideally timezone-aware, so that a reset of the counter to zero happens automatically (and doesn't throw over the check logic) at a given point, e.g. on the first of each month at 00:00 local time.

Thanks for your consideration!

madduck avatar Jan 27 '16 21:01 madduck

If using the crontab is an option for the reset threshold feature, it will be much easier.

steveschnepp avatar Jan 27 '16 21:01 steveschnepp

The problem with crontab is of course that it runs on the server, while the resets depend on the timezone of the client. But of course, it's possible and easiest. And we are hardly going to be collecting super-accurate data anyway.

madduck avatar Jan 27 '16 21:01 madduck

If there's a way to say "reset counters for host foo.example.org now", e.g. a script of sorts, then cron can just be configured to fire off these resets at different times of the day. Easy.

madduck avatar Jan 27 '16 21:01 madduck

If there's a way to say "reset counters for host foo.example.org now"

The reset that is crontab-driven has to run on the node itself, so I don't really get it.

steveschnepp avatar Jan 27 '16 21:01 steveschnepp

Oh, the accumulation happens on the node? Well then, that's easy… Sorry, I was assuming that the server does the accumulating.

madduck avatar Jan 27 '16 22:01 madduck

Aside from the plugin itself, the main issue I encounter with this is always the same: rules ordering. (fail2ban will insert its own rules somewhere, ufw some others, custom blacklisting script may add to the un-ordering task) Just restart fail2ban for example and It's easy to end-up monitoring something else than initially thought.

drzraf avatar Mar 27 '17 22:03 drzraf

Stale issue message

github-actions[bot] avatar Apr 17 '21 02:04 github-actions[bot]