#prometheus-metrics #remote #write #sending #api #cli #helper

prometheus_remote_write

Helpers for writing metrics to Prometheus over the remote write API

3 unstable releases

0.2.1 Nov 1, 2023
0.2.0 Nov 1, 2023
0.1.0 Nov 1, 2023

#28 in #sending

23 downloads per month
Used in prom-write

MIT/Apache

13KB
220 lines

prometheus-remote-write

This repository contains a Rust library and a CLI for sending metrics to Prometheus over the remote write API.

The CLI is very useful for sending a small amount of ad-hoc metrics to Prometheus.

A prime use case is cronjobs.

CLI: Usage

# The help output contains detailed explanations and examples.
prom-write --help

# Consult the help for more examples, the below is a sneak peek.

prom-write --url http://localhost:9090/api/v1/write --name requests --value 1
prom-write --url http://localhost:9090/api/v1/write -n requests -t counter -v 1
prom-write --url http://localhost:9090/api/v1/write -n requests -v 1 --label method=GET -l path=/api/v1/write
prom-write --url http://localhost:9090/api/v1/write --file metrics.txt -l instance=localhost

CLI: Installation

Release Binaries

You can download release binaries for Windows, Mac OS and Linux from the Github releases: https://github.com/theduke/prom-write/releases

# Make sure to replace the <RELEASE_TAG> with the latest release!
curl -L https://github.com/theduke/prom-write/releases/download/<RELEASE_TAG>/prom-write-linux-x86 > prom-write
chmod +x prom-write
./prom-write --help

Nix(OS)

The prom-write binary is not in nixpkgs yet, but you can use the Nix Flake directly if you have Flake support enabled:

# Run once
nix run github:theduke/prom-write -- --help

# Open a shell
nix shell github:theduke/prom-write
prom-write --help

Cargo

If you have Rust and cargo installed, you can install the CLI through the crate:

cargo install --force prom-write

lib.rs:

Types and utilities for calling Prometheus remote write API endpoints.

Dependencies

~0.6–11MB
~121K SLoC