How to avoid paying extra for additional traffic?
Hey guys,
I am kinda stuck with the question how I can avoid paying for additional traffic when my included traffic is used. Most providers do have unlimited traffic or stop the server when your included traffic is used.
I do have a server with servarica which has a limit of 2 TB per month. I'm kinda sure this will be more than enough but I am always scared of this bad awakening when something bad happens (misconfiguration or whatever).
So what do you think might be my best bet to add a protection? I am thinking about calculation the traffic and stop the server if it hits 1,9 tb in a month.
Many thanks in advance!
Comments
use vnstat to calculate/count traffic
maybe some small bash script to shutdown the VPS if touches 1.9 TB ?
good idea, let me try to whip something up
EDIT: I've ran outta talent, so far this is what I whipped up, which errors with
traffic_stop.sh: line 10: [: 2.37: integer expression expected
if someone can improve it, would be cool![:) :)](https://lowendspirit.com/plugins/emojiextender/emoji/twitter/smile.png)
CrownCloud - Internet Services | Los Angeles, California | Frankfurt, Germany | Amsterdam, The Netherlands | Atlanta, Georgia | Miami, Florida
You can ask your provider for a hard-cap if you’re willing to accept some downtime until resolved bandwidth. However, if you consistently go over I’d suggest just upgrading to have additional bandwidth.
Alternatively, you can do proactive monitoring, have custom alerts sent to you (eg, nagios) when criteria is reached, etc.
Here is a partial perl script that I use.
LittleCreekHosting.com
hi, well obviously 1.9 is not an integer so
-gt
fails.There are several ways to do it
or my personal favorite
you can lookup "bash compare floats" to find them all
Hey. How about considering a provider who offers unlimited bandwidth with no cap?
At least that way you wouldn't need to worry about anything.
The other option is to use the above as discussed.
hostworld.uk - Web Hosting, Reseller Hosting, NVMe SSD VPS, Dedicated Servers & Domains. UK & US data centres & 24/7 UK support.
Consider also if there are ways to save on traffic by leveraging caching and optimizing assets. You could also consider using Cloudflare (perhaps just for a
cdn.yourwebsite.com
subdomain so you don't get MITMd on sensitive stuff).If you are going to do this also use subresource integrity for any JS/CSS/etc you run.