All Projects → banzaicloud → spot-termination-exporter

banzaicloud / spot-termination-exporter

Licence: Apache-2.0 License
Prometheus spot instance exporter to monitor AWS instance termination with Hollowtrees

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects
Dockerfile
14818 projects
shell
77523 projects

Projects that are alternatives of or similar to spot-termination-exporter

nvidia gpu exporter
Nvidia GPU exporter for prometheus using nvidia-smi binary
Stars: ✭ 85 (+183.33%)
Mutual labels:  prometheus-exporter
sentry exporter
Prometheus exporter for Sentry
Stars: ✭ 23 (-23.33%)
Mutual labels:  prometheus-exporter
metagraf
metaGraf is a opinionated specification for describing a software component and what its requirements are from the runtime environment. The mg command, turns metaGraf specifications into Kubernetes resources, supporting CI, CD and GitOps software delivery.
Stars: ✭ 15 (-50%)
Mutual labels:  pipeline
starboard-exporter
A standalone exporter for vulnerability reports and other CRs created by Starboard.
Stars: ✭ 22 (-26.67%)
Mutual labels:  prometheus-exporter
zfs exporter
Prometheus ZFS exporter
Stars: ✭ 52 (+73.33%)
Mutual labels:  prometheus-exporter
Computer-Architecture-Task-2
Riscv32 CPU Project
Stars: ✭ 43 (+43.33%)
Mutual labels:  pipeline
TIL
Today I Learned
Stars: ✭ 43 (+43.33%)
Mutual labels:  pipeline
prometheus-mysql-exporter
Prometheus MySQL Exporter
Stars: ✭ 33 (+10%)
Mutual labels:  prometheus-exporter
sfpowerscripts
A build system for modular development in Salesforce, delivered as a sfdx plugin that can be implemented in any CI/CD system of choice
Stars: ✭ 121 (+303.33%)
Mutual labels:  pipeline
pipelines-as-code
Pipelines as Code
Stars: ✭ 37 (+23.33%)
Mutual labels:  pipeline
bash-streams-handbook
💻 Learn Bash streams, pipelines and redirection, from beginner to advanced.
Stars: ✭ 153 (+410%)
Mutual labels:  pipeline
github exporter
Prometheus exporter for GitHub
Stars: ✭ 21 (-30%)
Mutual labels:  prometheus-exporter
deluge exporter
Prometheus exporter for the Deluge BitTorrent client
Stars: ✭ 24 (-20%)
Mutual labels:  prometheus-exporter
gin-metrics
gin-gonic/gin metrics for prometheus.
Stars: ✭ 87 (+190%)
Mutual labels:  prometheus-exporter
py-spotme
A CLI tool that creates AWS spot instances on the fly
Stars: ✭ 16 (-46.67%)
Mutual labels:  spot-instances
tailseeker
Software for measuring poly(A) tail length and 3′-end modifications using a high-throughput sequencer
Stars: ✭ 17 (-43.33%)
Mutual labels:  pipeline
companion
This repository has been archived, currently maintained version is at https://github.com/iii-companion/companion
Stars: ✭ 21 (-30%)
Mutual labels:  pipeline
prose
A python framework to process FITS images. Built for Astronomy.
Stars: ✭ 21 (-30%)
Mutual labels:  pipeline
bifrost
A stream processing framework for high-throughput applications.
Stars: ✭ 48 (+60%)
Mutual labels:  pipeline
infinity
AWS Spot instances for ML
Stars: ✭ 38 (+26.67%)
Mutual labels:  spot-instances

Spot instance termination exporter

Prometheus exporters are used to export metrics from third-party systems as Prometheus metrics - this is an exporter to scrape for AWS spot price termination notice on the instance for Hollowtrees.

Spot instance lifecycle

  • User submits a bid to run a desired number of EC2 instances of a particular type. The bid includes the price that the user is willing to pay to use the instance for an hour.
  • If the bid price exceeds the current spot price (that is determined by AWS based on current supply and demand) the instances are started.
  • If the current spot price rises above the bid price or there is no available capacity, the spot instance is interrupted and reclaimed by AWS. 2 minutes before the interruption the internal metadata endpoint on the instance is updated with the termination info.
  • If the instance is interrupted the action taken by AWS varies depending on the interruption behaviour (start, stop or hibernate) and the request type (one-time or persistent). These can be configured when requesting the instance. See more about this here

Spot instance termination notice

The Termination Notice is accessible to code running on the instance via the instance’s metadata at http://169.254.169.254/latest/meta-data/spot/termination-time. This field becomes available when the instance has been marked for termination and will contain the time when a shutdown signal will be sent to the instance’s operating system. At that time, the Spot Instance Request’s bid status will be set to marked-for-termination.
The bid status is accessible via the DescribeSpotInstanceRequests API for use by programs that manage Spot bids and instances.

Quick start

The project uses the promu Prometheus utility tool. To build the exporter promu needs to be installed. To install promu and build the exporter:

go get github.com/prometheus/promu
promu build

The following options can be configured when starting the exporter:

./spot-termination-exporter --help
Usage of ./spot-termintation-exporter:
  -bind-addr string
        bind address for the metrics server (default ":9189")
  -log-level string
        log level (default "info")
  -metadata-endpoint string
        metadata endpoint to query (default "http://169.254.169.254/latest/meta-data/")
  -metrics-path string
        path to metrics endpoint (default "/metrics")

Test locally

The AWS instance metadata is available at http://169.254.169.254/latest/meta-data/. By default this is the endpoint that is being queried by the exporter but it is quite hard to reproduce a termination notice on an AWS instance for testing, so the meta-data endpoint can be changed in the configuration. There is a test server in the utils directory that can be used to mock the behavior of the metadata endpoint. It listens on port 9092 and provides dummy responses for /instance-id and /spot/instance-action. It can be started with:

go run util/test_server.go

The exporter can be started with this configuration to query this endpoint locally:

./spot-termination-exporter --metadata-endpoint http://localhost:9092/latest/meta-data/ --log-level debug

Metrics

# HELP aws_instance_metadata_service_available Metadata service available
# TYPE aws_instance_metadata_service_available gauge
aws_instance_metadata_service_available{instance_id="i-0d2aab13057917887"} 1
# HELP aws_instance_termination_imminent Instance is about to be terminated
# TYPE aws_instance_termination_imminent gauge
aws_instance_termination_imminent{instance_action="stop",instance_id="i-0d2aab13057917887"} 1
# HELP aws_instance_termination_in Instance will be terminated in
# TYPE aws_instance_termination_in gauge
aws_instance_termination_in{instance_id="i-0d2aab13057917887"} 119.888545

Default Hollowtrees node exporters associated to alerts:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].