ackalctl-http-proxy


Overview

You can run the proxy (ackalctl-http-proxy) on a host machine using whichever port (PORT) you prefer.

The proxy is used by Prometheus instance(s) to scrape your gRPC health checks' metrics.

The proxy authenticates Prometheus requests using your Ackal credentials (${HOME}/.config/ackalctl/credentials.json).

When authorized by Ackal, Prometheus uses the proxy to access Ackal's listr service to discover a list of your gRPC health checks.

Prometheus then uses the proxy to scrape metrics from each of your gRPC health checks on the list that it discovered.

Config

Please see Container Images for the current version of ackalctl-htt-proxy.

ackalctl-http-proxy looks for its configuration in the following places in this order:

  1. Flags
  2. Environment variables
  3. config.json
NOTE We recommend that you use ${HOME}/.config/ackalctl/config.json

Flags

--customer_id
Your Ackal Customer ID
--endpoint
Endpoint of this proxy (default: 0.0.0.0:8080)
--renew
Ackal's token renewal endpoint (default: renew.ack.al:443)

Environment variables

ACKAL_CUSTOMER_ID
Your Ackal Customer ID
ACKAL_RENEW_ENDPOINT
Ackal's token renewal endpoint (default: renew.ack.al:443)

Run

ackalctl-http-proxy:

NOTE You can use any available port (PORT) value.

PORT="5000"
ENDPOINT="0.0.0.0:${PORT}"

ackalctl-http-proxy \
--endpoint=${ENDPOINT}
                  

You can view the container's logs using docker container logs ackalctl-http-proxy.

OPTIONAL Test the proxy with curl:


PORT="5000"
ENDPOINT="0.0.0.0:${PORT}"

curl \
--silent \
--request GET \
--proxy ${ENDPOINT} \
http://listr.ack.al:443/?format=prometheus \
| jq -r .

curl \
--silent \
--request GET \
--proxy ${ENDPOINT} \
${endpoint}/metrics \
| awk '\^ackal_exporter_check {print}
                    

Prometheus

Note You must replace the value of {ENDPOINT} with the value you used when you ran the ackalctl-http-proxy container in the previous step. The proxy_url (pointing to ackalctl-http-proxy) occurs twice in the Prometheus scrape_config configuration. The first time it proxies requests to Ackal's listr service to obtain the list of your gRPC health checks. The second time it proxies requests to your gRPC health check to scrape it for its metrics.

global:
  scrape_interval: 1m
  evaluation_interval: 1m

scrape_configs:             
  - job_name: "ackalctl-http-proxy"
    scheme: http
    proxy_url: http://{ENDPOINT}
    http_sd_configs:
    - refresh_interval: 1m
      url: http://listr.ack.al:443/?format=prometheus
      proxy_url: http://{ENDPOINT}
                

Then run a Prometheus instance using this config:


PROMETHEUS="docker.io/prom/prometheus"

docker run \
--detach --rm --tty \
--name="prometheus" \
--volume="${PROMETHEUS}:/etc/prometheus/prometheus.yml:ro" \
--publish="9090:9090" \
${PROMETHEUS} \
--config.file="/etc/prometheus/prometheus.yml" \
--web.enable-lifecycle
                

You can view the container's logs using docker container logs prometheus.

You can browse Prometheus' Web UI at

http://localhost:9090

You can confirm that the proxy is correctly enumerating your gRPC health checks by checking Prometheus' Targets at:

http://localhost:9090/targets

Developer

ackalctl-http-proxy implements Prometheus HTTP Service Discovery to retrieve the metrics for your Ackal gRPC health check targets.