vnstat
vnstat copied to clipboard
Send interface traffic result periodically to external server (URL) to avoid writing in the device
I would like to request a feature please. Is it possible to send the traffic stats to external server via http request?
I have an EdgeRouter X where I install vnstat but I read that frequent write will increase the wear and tear of the storage which is bad. Is there a way we can send the statistics periodically to a server via http request with the following params?
download (Bytes) upload (Bytes) timestamp interface device_name
The daemon will look for a config file in /etc/vnstat/url.conf
which contains following config format
external_url = http://public_ip_address/custom_url # the public url where http post data will be send
device_name = switch_router_001_example # user define name of the device
timeout = 60 # send stats every 60 secs
It will send the data to the external URL and wait for a basic "ok" response otherwise it will try to send again after 5 or 10 secs and if it is still a false it will stop sending and try to send again on the next schedule.
If it received an "ok" response after sending to the external URL it will then clear the statistics back to zero then record again the traffic which be sent on the next schedule.
The benefits is that if we have this option it will be increase lifespan of the storage since the logs are sent in the external server.
I'm learning C again and will take me too long to understand the code of vnstat for me to add modification. Bear with me. Thank you.