A Kubernetes metrics adapter that collects and exposes metrics from DigitalOcean Managed Databases. This adapter retrieves metrics from the DigitalOcean API and exposes them in a format compatible with Kubernetes metrics API, making it ideal for monitoring DigitalOcean databases in a Kubernetes environment.
- Retrieves metrics from DigitalOcean Managed Databases
- Exposes metrics via HTTP endpoints
- Supports Kubernetes metrics API format
- Includes health and readiness checks
- Provides version information
- Supports secure metrics authentication
- Go 1.21.6 or later
- DigitalOcean API Token
- Database name to monitor
- Docker (for container deployment)
- Kubernetes (for Helm deployment)
The application is configured through environment variables:
DEBUG
: Enable debug logging (boolean)PORT
: Server port numberDO_TOKEN
: DigitalOcean API tokenDATABASE_NAME
: Name of the DigitalOcean database to monitor
-
Clone the repository:
git clone https://github.com/supporttools/do-database-metrics-adapter.git cd do-database-metrics-adapter
-
Build and run:
go mod download go build ./do-database-metrics-adapter
-
Build the container:
docker build -t do-database-metrics-adapter .
-
Run the container:
docker run -e DO_TOKEN=<your-token> \ -e DATABASE_NAME=<your-database> \ -e PORT=8080 \ -p 8080:8080 \ do-database-metrics-adapter
The project includes a Helm chart for Kubernetes deployment:
-
Add the repository:
helm repo add supporttools https://charts.support.tools helm repo update
-
Install the chart:
helm install do-database-metrics-adapter supporttools/do-database-metrics-adapter \ --set doToken=<your-token> \ --set databaseName=<your-database>
/metrics
: Exposes database metrics in Prometheus format/healthz
: Health check endpoint/readyz
: Readiness check endpoint/version
: Returns version information
.
├── main.go # Application entry point
├── Dockerfile # Container build instructions
├── go.mod # Go module definition
├── pkg/
│ ├── config/ # Configuration handling
│ ├── digitalocean/ # DigitalOcean API integration
│ ├── health/ # Health check endpoints
│ ├── logging/ # Logging configuration
│ └── version/ # Version information
└── charts/ # Helm chart for Kubernetes deployment
- Go 1.21.6
github.com/sirupsen/logrus
: Structured logginggithub.com/stretchr/testify
: Testing framework- Additional indirect dependencies managed through Go modules
go test -v ./...
make build
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
- Matt Mattox ([email protected])