cbmonitor build with Grafana for Couchbase Server Prometheus Metrics.
This repo contains two main services organized as independent projects:
The main cbmonitor implementation. It is built as a Grafana app plugin containing multiple dashboards and backend services.
A REST server responsible for creating and managing scrape target configurations for metrics collection agents such as the Grafana Alloy. It provides APIs to:
- Create scrape target configurations
- List existing configurations
- Update configurations
- Remove configurations when no longer needed
├── config-manager/ # Config manager service
│ ├── internal/
│ │ ├── api/ # REST API handlers
│ │ ├── config/ # Configuration management
│ │ ├── storage/ # File storage for scrape targets
│ │ └── models/ # Data models
│ ├── tests/ # Service-specific tests
│ ├── go.mod
│ └── main.go
├── cbmonitor/ # Grafana app extension (mixed Go/Node.js)
│ ├── src/ # Frontend source code
│ ├── pkg/ # Go backend packages
│ ├── package.json
│ └── go.mod
├── pkg/ # Shared packages
├── configs/ # Configuration files
├── deployments/ # Deployment configurations
│ └── docker/ # Docker files
├── docs/ # Documentation
├── scripts/ # Build and utility scripts
-
Build all services:
make build
-
Build individual services:
make build-cm # Config manager make build-plugin # Grafana app plugin
-
Run tests:
make test-cm # Config manager tests
- Build and run config-manager with docker:
make build-cm-docker
- Build and run the Grafana plugin with docker:
make build-plugin-docker
For more make commands see: make help
- Config Manager:
configs/config-manager/config.yaml
- Grafana extension:
cbmonitor/example.env
This project uses independent Go modules for each service. Each service manages its own dependencies and can be built independently.
- config-manager:
github.com/couchbase/config-manager
- cbmonitor:
github.com/couchbase/cbmonitor
# Config Manager
./bin/config-manager -config /path/to/config # config path is optional
Configurations can be overriden as startup flags. Flag overrides take precedence over config file values. The format is: section.field=value
. The section and field should match the yaml values of the Config
struct.
Examples:
config-manager server.port=8081
config-manager server.port=8081 agent.directory=/custom/path
config-manager logging.level=debug
To run the Grafana app, use the docker command above or follow the instructions at cbmonitor/README.md.
Each service has its own tests located in the service directory:
- config-manager:
config-manager/tests/
- cbmonitor:
cbmonitor/tests/
(when implemented)
- git clone the repo
- cd cbmonitor2
- git submodule init
- git submodule update
or, just do
- git clone --recurse-submodules