npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@matchory/hetzner-cloud-prometheus-sd

v1.0.1

Published

A simple web server exposing Hetzner cloud instances for consumption by the Prometheus HTTP service discovery.

Downloads

2

Readme

Prometheus: Hetzner Service Discovery Current Release License Build Weekly Downloads Docker Build Status

A server to provide automatic node discovery for Hetzner Cloud to Prometheus via HTTP service discovery.

In contrary to the integrated Hetzner SD configuration, this lets you use internal IPs and filter the node list using Hetzner labels or node filters, for example.

Installation

The easiest option will be using our Docker image matchory/hetzner-cloud-prometheus-sd:

docker run -p 127.0.0.1:7764:7764 matchory/hetzner-cloud-prometheus-sd --hetzner-api-token $HETZNER_API_TOKEN

You can also install the npm package globally:

npx @matchory/hetzner-cloud-prometheus-sd --hetzner-api-token $HETZNER_API_TOKEN

Usage

Upon starting the server, it will continuously synchronize its list of Hetzner cloud nodes with the Hetzner API, and return those to requests on the /sd endpoint. Additionally, the server also provides its own metrics endpoint.

Configuration

The server may be configured using command-line options, environment variables, or its configuration file. The following table shows all available settings:

| CLI option | Environment variable | Default value | Description | |:---------------------------|:-------------------------------|---------------|--------------------------------------------------------------------------------------------------------------------------| | -t, --api-token | HETZNER_SD_API_TOKEN | - | API token obtained from Hetzner Cloud (required). | | -h, --hostname | HETZNER_SD_HOSTNAME | localhost | Hostname to listen on. | | -a, --auth-bearer | HETZNER_SD_AUTH_BEARER | - | Bearer token to verify on incoming requests. Mutually exclusive with --auth-basic. | | -A, --auth-basic | HETZNER_SD_AUTH_BASIC | - | Basic auth credentials to verify on incoming requests, provided as user:pass. Mutually exclusive with --auth-bearer. | | -p, --port | HETZNER_SD_PORT | 7764 | Port to listen on. | | -H, --https | HETZNER_SD_HTTPS | false | Use HTTPS for the listening socket. Required for mTLS. | | --m-tls-ca | HETZNER_SD_MTLS_CA | - | Path to the mTLS certificate authority file. Ignored unless https is enabled. | | -r, --refresh-interval | HETZNER_SD_REFRESH_INTERVAL | 30000 (30s) | How often to synchronize with the Hetzner API in ms. | | --metrics-endpoint | HETZNER_SD_METRICS_ENDPOINT | /metrics | Endpoint to provide server metrics on. | | --node-port | HETZNER_SD_NODE_PORT | 9090 | Port on the nodes Prometheus should connect to. | | --node-network | HETZNER_SD_NODE_NETWORK | - | Name, ID, or CIDR range of the network to prefer when resolving nodes. If omitted, the public IP will be preferred. | | --node-label-prefix | HETZNER_SD_NODE_LABEL_PREFIX | hetzner | Prefix for labels attached to discovered nodes- | | --log-level | HETZNER_SD_LOG_LEVEL | debug | Log level for the server (must be one of debug, info, warn or error). | | --debug | HETZNER_SD_DEBUG | false | Enable debug mode. This will also include additional debugging information in HTTP responses. |

Note:
You can provide token parameters in secret files using the environment variables with a _FILE suffix, e.g. HETZNER_SD_API_TOKEN_FILE. This variable is expected to contain an absolute path to a file on the filesystem which contains the secret. Trailing whitespace will be removed; the secret will be read once, and cached for the runtime of the server. This works for the API token and authentication credentials, so currently we support the following secret files:

  • HETZNER_SD_API_TOKEN_FILE
  • HETZNER_SD_AUTH_BEARER_FILE
  • HETZNER_SD_AUTH_BASIC_FILE

Development

For local development, you'll want to use yarn dev to compile the TypeScript sources and start the server.

Contributing

We welcome all contributions. If you need help or would like to see a feature implemented, please get in touch.

Releasing

To publish a new release, use the np utility on the command line.