Monitoring DigitalOcean Billing with InfluxDB
By
Ignacio Van Droogenbroeck /
Use Cases, Product, Developer
Feb 24, 2021
Navigate to:
I’ve always had a good experience using DigitalOcean, a cloud infrastructure provider which offers developers cloud services that help deploy and scale applications that run simultaneously on multiple computers. I’ve used DigitalOcean a lot for my personal projects for example, to host my personal blog, its stats, and a NextCloud instance, all running in Kubernetes.
Monitoring your server is always a good idea. When you have workloads in the cloud, monitoring turns critical because while you’re using a Cloud infrastructure, you remain responsible for the health of the servers/services you host. The Cloud provider mostly monitors their own infrastructure, but you’re on your own to monitor the software you run. If your application stops responding, this becomes a problem you have to solve.
Monitoring simplified with InfluxDB Templates
An InfluxDB Template, the DigitalOcean Billing Monitoring Template lets you quickly define your entire monitoring configuration (data sources, dashboards, and alerts) in one easily-shared, open-source text file that can be imported into InfluxDB with a single command.
Template import is built straight into the InfluxDB Cloud UI no software to download or command line syntax to memorize. All you have to do is copy a link to the Template you want, paste it into the page in your InfluxDB Cloud UI, and you’re done.
Controlling DigitalOcean account balance
The pricing of DigitalOcean is straightforward, with monthly billing cycles that depend on the price plan tier you’re on. I’m always charging my DigitalOcean account in advance, so the template allows me to control my balance to understand how much my resources cost per day and how much I owe without entering the DigitalOcean dashboard.
I use this data right next to the monitoring of my Kubernetes cluster running in DigitalOcean. I created this dashboard using the DigitalOcean API, and simply to have system monitoring and billing in only one place.
Using the DigitalOcean Billing Monitoring Template
You can use this InfluxDB Template to actively monitor your consumption of resources to manage your DigitalOcean Account spend. The template’s dashboard monitors current balance, consumption to date, and balance to date.
To gather monitoring data for the template, I use the Exec Telegraf Input Plugin (which parses supported Telegraf input data formats) and then use the InfluxDB Output Plugin to carry that JSON data to InfluxDB.