Giter Site home page Giter Site logo

hcloud-usage-exporter's Introduction

hcloud-usage-exporter

Export HCloud cost totals as Prometheus metrics. Uses Selenium to scrape data from the Hetzner Cloud web interface.

Usage

  • The container image is available from ghcr.io/niklasrosenstein/hcloud-usage-exporter.
  • The exporter listens on port 3000 and serves metrics at /.
  • The exporter requires the following environment variables:
    • HCLOUD_USERNAME: The Hetzner Cloud username.
    • HCLOUD_PASSWORD: The Hetzner Cloud password.
    • HCLOUD_TOTP_SECRET: The Hetzner Cloud TOTP secret, if two-factor authentication is enabled.
  • The default scrape interval is 5 minutes.

Example

$ docker run --rm -d \
    -p 3000:3000 \
    -v /dev/shm:/dev/shm \
    -e HCLOUD_USERNAME=... \
    -e HCLOUD_PASSWORD=... \
    -e HCLOUD_TOTP_SECRET=... \
    ghcr.io/niklasrosenstein/hcloud-usage-exporter
$ curl localhost:3000
...

Metrics

  • hcloud_usage_exporter_project_cost_eur{project_name}
  • hcloud_usage_exporter_state{hcloud_usage_exporter_state="pending|healthy|error}
  • ... todo

Troubleshooting

Chrome crashes

Considering granting the pod a larger /dev/shm volume, or mount the host's /dev/shm into the container.

Service logs

You can find them under /var/log/supervisor/hcloud-usage-exporter*.log.

Inspect page state on error

A history of the five last page loads are stored in /var/lib/hcloud-usage-exporter/error-history, allowing you to inspect the screenshot and page source when an error occurs. The easiest way to inspect these files is to send them to a service like file.io.

$ cd /var/lib/hcloud-usage-exporter/error-history
$ curl -F file=@2024-04-13_19-25-39.png https://file.io

hcloud-usage-exporter's People

Contributors

niklasrosenstein avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.