Skip to content

SupportTools/rancher-centralized-monitoring

Repository files navigation

Rancher Centralized Monitoring Relay

CI/CD Docker Image Helm Chart

A Go-based monitoring relay agent that uses Rancher's service proxy functionality to access Prometheus and Loki server pods in remote clusters. The relay makes monitoring data from remote clusters accessible to centralized monitoring infrastructure.

🎯 Overview

The Rancher Centralized Monitoring Relay is designed to run as a deployment in the Rancher local cluster. Each deployment instance acts as a relay for a specific remote cluster, providing a bridge between centralized monitoring systems and remote cluster monitoring services that would otherwise be inaccessible from outside the cluster.

Key Features

  • πŸ”— Service Proxy Integration: Uses Rancher's built-in service proxy to reach remote monitoring services
  • πŸ“Š Multi-Service Support: Configurable for Prometheus, Loki, and custom remote services
  • πŸ”’ Secure Authentication: Uses Rancher API keys for secure access
  • πŸ“ˆ Health Monitoring: Built-in health checks and metrics endpoints
  • βš™οΈ Flexible Configuration: Environment variable based configuration
  • πŸš€ Production Ready: Includes Helm charts, CI/CD pipeline, and comprehensive monitoring

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Centralized        β”‚    β”‚   Rancher Local     β”‚    β”‚   Remote Cluster    β”‚
β”‚  Monitoring         │────│   Cluster           │────│   c-xxxxx           β”‚
β”‚  (Prometheus/Grafana)β”‚    β”‚                     β”‚    β”‚                     β”‚
β”‚                     β”‚    β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚    β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚                     β”‚    β”‚ β”‚ Monitoring      β”‚ β”‚    β”‚ β”‚ Prometheus      β”‚ β”‚
β”‚                     β”‚    β”‚ β”‚ Relay Agent     β”‚ β”‚    β”‚ β”‚ Loki            β”‚ β”‚
β”‚                     β”‚    β”‚ β”‚                 β”‚ β”‚    β”‚ β”‚ Custom Services β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚    β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
                           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Quick Start

Using Helm (Recommended)

# Add the Support Tools Helm repository
helm repo add supporttools https://charts.support.tools/
helm repo update

# Install the monitoring relay
helm install my-relay supporttools/rancher-monitoring-relay \
  --set rancher.apiEndpoint="https://your-rancher-server" \
  --set rancher.clusterId="c-xxxxx" \
  --set rancher.auth.accessKey="token-xxxxx" \
  --set rancher.auth.secretKey="your-secret-key"

Using Docker

docker run -d \
  -e RANCHER_API_ENDPOINT="https://your-rancher-server" \
  -e RANCHER_API_ACCESS_KEY="token-xxxxx" \
  -e RANCHER_API_SECRET_KEY="your-secret-key" \
  -e CLUSTER_ID="c-xxxxx" \
  -p 9000:9000 \
  supporttools/rancher-monitoring-relay:latest

πŸ“‹ Prerequisites

  • Rancher server with remote clusters
  • Valid Rancher API credentials with cluster access permissions
  • Kubernetes cluster for deployment (Rancher local cluster recommended)
  • Prometheus/Loki or other monitoring services running in remote clusters

πŸ“š Documentation

πŸ”§ Configuration

Required Environment Variables

Variable Description Example
RANCHER_API_ENDPOINT Rancher server URL https://rancher.example.com
RANCHER_API_ACCESS_KEY API access key token-xxxxx
RANCHER_API_SECRET_KEY API secret key your-secret-key
CLUSTER_ID Target cluster ID c-m-xxxxxxx

Service Configuration

# Prometheus (defaults shown)
PROMETHEUS_NAMESPACE=cattle-monitoring-system
PROMETHEUS_SERVICE=rancher-monitoring-prometheus
PROMETHEUS_PORT=9090

# Loki (defaults shown)
LOKI_NAMESPACE=cattle-logging-system
LOKI_SERVICE=loki
LOKI_PORT=3100

# Custom service
REMOTE_NAMESPACE=monitoring
REMOTE_SERVICE=custom-service
REMOTE_PORT=8080

πŸ₯ Health Checks

The relay provides several HTTP endpoints for monitoring:

  • GET /health - Basic Rancher API connectivity check
  • GET /ready - Comprehensive service connectivity check
  • GET /version - Version and build information
  • GET /metrics - Prometheus metrics

πŸ”¨ Development

Building from Source

# Clone the repository
git clone https://github.com/supporttools/rancher-centralized-monitoring
cd rancher-centralized-monitoring

# Install dependencies
go mod download

# Build the application
go build -o rancher-monitoring-relay main.go

# Run tests
make test

# Build Docker image
make build TAG=latest

Local Development

# Install development tools
make install-tools

# Run full CI pipeline locally
make ci

# Start development server
export RANCHER_API_ENDPOINT="https://your-rancher"
export RANCHER_API_ACCESS_KEY="token-xxxxx"
export RANCHER_API_SECRET_KEY="your-secret"
export CLUSTER_ID="c-xxxxx"
export DEBUG=true

go run main.go

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

πŸ“„ License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

πŸ†˜ Support


Made with ❀️ by Support Tools

About

Rancher Centralized Monitoring

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •