Matthew Binning
800bdeaefe
In the build code, the C library to interoperate with the Prometheus metrics system is added. Now a heartbeat is published over that connection. |
||
---|---|---|
cli.c | ||
cli.h | ||
Containerfile | ||
hailstone.c | ||
hailstone.h | ||
heartbeat.c | ||
heartbeat.h | ||
main.c | ||
Makefile | ||
metadata.h | ||
README.md |
Hailstone
Project Hailstone is a system to test benchmark different middleware. At its core, there is a hailstone sequence generator. Those numbers are pushed through a NATS connection. Both the sender and the receiver log their times of sending and receiving. It exports these times as well as a basic heartbeat to Prometheus via the C API.
The hailstone sequence is tweakable with arguments The client can be controlled via signals once launched.
Build
docker build -f Containerfile -t hailstone .
Run
To view the CLI output, use the -i
flag as below. To free up the terminal
(e.g. only the metrics at the endpoint are of interest), dettach with the -d
flag.
docker run --rm --name hailstone -tip 8000:8000 hailstone
Stop
If running interactively, send a SIGINT with Ctrl+c.
If running dettached, simply stop with: docker stop hailstone
Test
curl http://localhost:8080/metrics
also available from web browsers near you.
On an additional command or a refresh, the heartbeat metric should increase.
Install
On the install target, the container may be run, or the client may be copied out of the container and run directly on the target host.
To run directly on a target host, the dynamically linked dependencies for a
Prometheus client will need to be available on the target host. For a dpkg-
based host (e.g. Debian, Ubuntu, etc.) follow the commands in the
Containerfile
. For installing libraries in a non-Debian (but typical Linux
FHS), i.e. RHEL, use the below steps in place of the base stage of the
Containerfile.
FROM ${BASE_IMAGE}:${BASE_VERSION} as base
ADD "https://github.com/digitalocean/prometheus-client-c/releases/download/v0.1.3/libprom-dev-0.1.3-Linux.tar.gz" ./
RUN tar -xzf libprom*.tar.gz && \
rm libprom*.tar.gz && \
mv libprom*/lib/* /usr/lib/ && \
mv libprom*/include/* /usr/include