A set of Grafana dashboards and Prometheus alerts for OpenCost.
This mixin is designed to be vendored into the repo with your infrastructure config. To do this, use jsonnet-bundler:
You then have three options for deploying your dashboards
- Generate the config files and deploy them yourself
- Use jsonnet to deploy this mixin along with Prometheus and Grafana
- Use prometheus-operator to deploy this mixin
Or import the dashboard using json in ./dashboards_out
, alternatively import them from the Grafana.com
dashboard page.
You can manually generate the alerts, dashboards and rules files, but first you must install some tools:
go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
brew install jsonnet
Then, grab the mixin and its dependencies:
git clone https://github.com/adinhodovic/opencost-mixin
cd opencost
jb install
Finally, build the mixin:
make prometheus_alerts.yaml
make dashboards_out
The prometheus_alerts.yaml
file then need to passed
to your Prometheus server, and the files in dashboards_out
need to be imported
into you Grafana server. The exact details will depending on how you deploy your
monitoring stack.
This mixin has its configuration in the config.libsonnet
file. You can disable the alerts for cost alerts and anomalies by setting the enabled
field to false
.
{
_config+:: {
alerts: {
budget: {
// Alerts if the cost is 200 USD (example).
// You need to configure this alert.
enabled: true,
monthlyCostThreshold: 200,
},
anomaly: {
// Alerts if the cost spiked by 20% or more
enabled: true,
anomalyPercentageThreshold: 20,
},
},
},
}
The mixin has all components enabled by default and all the dashboards are generated in the dashboards_out
directory. You can import them into Grafana.
The mixin follows the monitoring-mixins guidelines for alerts.