Skip to content

jmriebold/sqs-prometheus-exporter

Repository files navigation

SQS Prometheus Exporter

build Artifact Hub

A simple, lightweight Prometheus metrics exporter for AWS' Simple Queue Service, written in Go. Potential use cases are monitoring SQS queues or scaling off SQS queues (e.g. with a Kubernetes HPA).

Use

The SQS Prometheus Exporter can be run using the Docker image with either the docker-compose file or the Helm chart. To use the Helm chart, execute helm install sqs-prometheus-exporter oci://ghcr.io/jmriebold/charts/sqs-prometheus-exporter.

Configuration

AWS

In order to authenticate with AWS, the SQS Prometheus Exporter will need AWS credentials either in environment variables (i.e. AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY), a creds file mounted into the container, or a role to assume via IRSA or kiam/kube2iam. For more information on authenticating with AWS, see the official documentation.

The user or role that the service will be using to monitor the SQS queues will need the permissions contained in AWS' AmazonSQSReadOnlyAccess policy.

Application

To set the queues scraped by the Exporter, set the SQS_QUEUE_URLS environment variable to a comma-separated list of the SQS queue URLs. For example: SQS_QUEUE_URLS=https://sqs.[region].amazonaws.com/[account-id]/[queue-name-1],https://sqs.[region].amazonaws.com/[account-id]/[queue-name-2]

By default the application will scrape queue metrics every 30 seconds. To change this interval, set the SQS_MONITOR_INTERVAL_SECONDS environment variable.

Examples

Examples of how to run SQS Prometheus Exporter locally (such as via systemd) can be found under the examples directory. See the chart README for Helm-specific examples.

Metrics

The SQS Prometheus Exporter serves the following metrics:

  • sqs_approximatenumberofmessages
  • sqs_approximatenumberofmessagesdelayed
  • sqs_approximatenumberofmessagesnotvisible

Each has a queue label, which will be populated with the queue name and metric value.

Dependencies

SQS Prometheus Exporter uses the following Go packages:

Dev Dependencies