Skip to content

AWS SQS metric exporter for Prometheus

License

Notifications You must be signed in to change notification settings

wr8fdy/sqs-exporter

Repository files navigation

AWS SQS exporter

A Prometheus SQS metrics exporter

Metrics

Metric Description
aws_sqs_approximate_number_of_messages Number of messages available
aws_sqs_approximate_number_of_messages_delayed Number of messages delayed
aws_sqs_approximate_number_of_messages_not_visible Number of messages in flight

Lables

  • queue name
  • tags - you can disable with flag

For more information see the AWS SQS Documentation

Configuration

Flags:

  • interval - how often to update queue list, env INTERVAL
  • prefix - filter queue list by prefix (filtered on AWS API side), env PREFIX
  • regex - filter queues by regex (filtered in app), env REGEX
  • tags - add tags as lables, env TAGS

Credentials to AWS are provided in the following order:

  • Environment variables (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY)
  • Shared credentials file (~/.aws/credentials)
  • IAM role for Amazon EC2

For more information see the AWS SDK Documentation

AWS IAM permissions

The app needs sqs list and read access to the sqs policies

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "sqs:GetQueueAttributes",
                "sqs:GetQueueUrl",
                "sqs:ListDeadLetterSourceQueues",
                "sqs:ListQueueTags"
                "sqs:ListQueues",
            ],
            "Resource": "*"
        }
    ]
}

Running

You need to specify the region you to connect to Running on an ec2 machine using IAM roles: docker run -e AWS_REGION=<region> -d -p 9108:9108 sqs-exporter

Or running it externally: docker run -d -p 9108:9108 -e AWS_ACCESS_KEY_ID=<access_key> -e AWS_SECRET_ACCESS_KEY=<secret_key> -e AWS_REGION=<region> sqs-exporter