A prometheus exporter for metrics from Spotinst.
- Ocean AWS cost metrics for ocean clusters, namespaces and workloads
- Ocean AWS resource suggestions ("right sizing") for workloads and their containers
Run make build to build a local binary, or make docker-build to build a docker image.
The spotinst-metrics-exporter requires the SPOTINST_ACCOUNT and
SPOTINST_TOKEN environment variables to be set. Furthermore you can configure
the listen address via the --listen-address flag.
The exporter will listen on 0.0.0.0:8080 by default and exposes prometheus
metrics at /metrics and a health endpoint at /healthz.
The helm chart provided in this repository can be used to deploy the metrics exporter.
First, add the helm repository:
helm repo add spotinst-metrics-exporter \
https://bonial-international-gmbh.github.io/spotinst-metrics-exporterCreate a values.yaml and add a spotinst section with the account ID and
token, for example:
---
spotinst:
account: act-12345678
token: the-spotinst-tokenFor more helm configuration options have a look into the values.yaml
defaults.
Finally use helm to install the metrics exporter:
helm upgrade spotinst-metrics-exporter spotinst-metrics-exporter/spotinst-metrics-exporter \
--install --namespace kube-system --values values.yamlAlternatively, you can also pass spotinst.account and spotinst.token to the
helm command directly instead of using a values.yaml file:
helm upgrade spotinst-metrics-exporter spotinst-metrics-exporter/spotinst-metrics-exporter \
--install --namespace kube-system \
--set spotinst.account=act-12345678,spotinst.token=the-spotinst-tokenAll metrics are gauge values. The values of CPU metrics are in milli-CPU, memory values are in MiB and cost values are in $USD. Cost metrics display the running costs of the current month and are reset on every 1st.
spotinst_ocean_aws_cluster_cost{ocean_id="o-12345678",ocean_name="my-ocean"} 301.86862
spotinst_ocean_aws_namespace_cost{namespace="kube-system",ocean_id="o-12345678",ocean_name="my-ocean"} 28.858004
spotinst_ocean_aws_workload_cost{name="coredns",namespace="kube-system",ocean_id="o-12345678",ocean_name="my-ocean",workload="deployment"} 1.2382613
spotinst_ocean_aws_workload_container_cpu_requested{container="coredns",name="coredns",namespace="kube-system",ocean_id="o-12345678",ocean_name="my-ocean",workload="deployment"} 100
spotinst_ocean_aws_workload_container_cpu_suggested{container="coredns",name="coredns",namespace="kube-system",ocean_id="o-12345678",ocean_name="my-ocean",workload="deployment"} 100
spotinst_ocean_aws_workload_container_memory_requested{container="coredns",name="coredns",namespace="kube-system",ocean_id="o-12345678",ocean_name="my-ocean",workload="deployment"} 70
spotinst_ocean_aws_workload_container_memory_suggested{container="coredns",name="coredns",namespace="kube-system",ocean_id="o-12345678",ocean_name="my-ocean",workload="deployment"} 34
spotinst_ocean_aws_workload_cpu_requested{name="coredns",namespace="kube-system",ocean_id="o-12345678",ocean_name="my-ocean",workload="deployment"} 100
spotinst_ocean_aws_workload_cpu_suggested{name="coredns",namespace="kube-system",ocean_id="o-12345678",ocean_name="my-ocean",workload="deployment"} 100
spotinst_ocean_aws_workload_memory_requested{name="coredns",namespace="kube-system",ocean_id="o-12345678",ocean_name="my-ocean",workload="deployment"} 70
spotinst_ocean_aws_workload_memory_suggested{name="coredns",namespace="kube-system",ocean_id="o-12345678",ocean_name="my-ocean",workload="deployment"} 34
The source code of spotinst-metrics-exporter is released under the MIT License. See the bundled LICENSE file for details.