https://github.com/contember/prometheus-rds-service-discovery
Prometheus HTTP Service Discovery for AWS RDS cluster instances
https://github.com/contember/prometheus-rds-service-discovery
aws-rds prometheus service-discovery
Last synced: 7 months ago
JSON representation
Prometheus HTTP Service Discovery for AWS RDS cluster instances
- Host: GitHub
- URL: https://github.com/contember/prometheus-rds-service-discovery
- Owner: contember
- License: apache-2.0
- Created: 2024-01-24T14:13:10.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-19T11:54:44.000Z (about 1 year ago)
- Last Synced: 2025-02-04T14:33:53.371Z (8 months ago)
- Topics: aws-rds, prometheus, service-discovery
- Language: Go
- Homepage:
- Size: 23.4 KB
- Stars: 2
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🔎 Prometheus Service Discovery for AWS RDS
Discover and monitor your AWS RDS clusters effortlessly with this Golang Prometheus HTTP ServiceDiscovery tool. 🚀
This service solves issues in case you have RDS autoscaling, and you need to measure metrics per instance (user cpu time, number of connections etc).
Pre-built docker image is available on [Docker Hub](https://hub.docker.com/r/contember/prometheus-rds-service-discovery)
currently supporting ARM architecture.
If you need a different architecture, please open an issue.## Table of Contents
1. [Setup](#setup)
2. [HTTP Endpoints](#http-endpoints)
3. [IAM Permissions](#iam-permissions)
4. [Example Usage](#example-usage)---
## Setup
Before you start monitoring your AWS RDS clusters, follow these steps to set up the service discovery:
1. Define the port on which you want to run your app by setting the `$PORT` environment variable. The default fallback port is `8080`.
2. Ensure AWS credentials are properly configured if needed. (This service is ECS and EKS ready, so container credentials can also be used.)To configure clusters for discovery, follow this naming convention:
- `SCRAPER_0_CLUSTER_ARN=arn:aws:rds:::cluster:`
- `SCRAPER_1_CLUSTER_ARN=arn:aws:rds:::cluster:`You can configure N scraper clusters by incrementing the number in the middle of the environment variable name.
This service supports multi-region and multi-account clusters discovery.---
## HTTP Endpoints
This service provides the following HTTP endpoints:
- `/.health`: Use this endpoint for health checks.
- `/discovery`: This endpoint provides Prometheus HTTP-SD compatible output in JSON format.---
## IAM Permissions
Ensure your service has the necessary IAM permissions to function correctly.
You should grant the `DescribeDBInstances` permission in the specific AWS region where your RDS clusters are located.```terraform
data "aws_iam_policy_document" "rds_service_discovery" {
statement {
actions = [
"rds:DescribeDBInstances",
]resources = [
"*"
]
}
}
```---
## Example Usage
### Usage with Prometheus Postgres Exporter
```yaml
- job_name: 'rds'
metrics_path: /probe
params:
auth_module: [internal]
http_sd_configs:
- url: http://rds-service-discovery:3000/discovery
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 'pg_exporter.svc.cluster.local'
```