A CLI tool to migrate Grafana dashboards from OpenTSDB to Prometheus data sources.
Dash-Porter helps convert existing Grafana dashboards that use OpenTSDB as a data source to use Prometheus instead. It handles dashboard migration and can create Prometheus datasources in your target Grafana instance.
- Dashboard Migration: Convert dashboards from OpenTSDB to Prometheus format
- Datasource Management: Create new Prometheus datasources
- Flipkart Mode: Optional enterprise-specific functionality via
--flipkartflag - Authentication Support: Works with API key, basic auth, or public Grafana instances
- Dry Run Mode: Preview changes without applying them
# Clone the repository
git clone <repository-url>
cd prometheus-dashboard-porter
# Build the application
go build -o dash-porter
# Run the application
./dash-porter --help- Source Grafana Instance: With OpenTSDB dashboards to migrate
- Target Grafana Instance: Where Prometheus datasources will be created
- Authentication: API keys or credentials for Grafana instances (if required)
Create a config.yaml file with your Grafana instance details:
source:
grafana_url: "https://source-grafana.example.com"
auth:
type: "api_key" # or "basic", "none" for public instances
api_key: "your-source-api-key"
target:
grafana_url: "https://target-grafana.example.com"
prometheus_url: "http://prometheus.example.com:9090"
auth:
type: "api_key"
api_key: "your-target-api-key"The tool provides two main commands:
# Migrate a single dashboard by UID
./dash-porter migrate dashboard <dashboard-uid>
# With options
./dash-porter migrate dashboard <dashboard-uid> \
--folder "target-folder" \
--target-datasource "prometheus-ds"
# With Flipkart mode
./dash-porter --flipkart migrate dashboard <dashboard-uid>
# Dry run to preview changes
./dash-porter --dry-run migrate dashboard <dashboard-uid># Create a new Prometheus datasource
./dash-porter datasource create <datasource-name>
# With custom Prometheus URL
./dash-porter datasource create <datasource-name> \
--prometheus-url "http://prometheus:9090"
# Set as default datasource
./dash-porter datasource create <datasource-name> --default
# Dry run to preview
./dash-porter datasource create <datasource-name> --dry-run--config, -c: Configuration file path (default: config.yaml)--dry-run, -d: Perform dry run without making changes--verbose, -v: Enable verbose output--flipkart: Enable Flipkart-specific functionality
# 1. Create the target datasource
./dash-porter datasource create "prometheus-main" \
--prometheus-url "http://prometheus.company.com:9090" \
--default
# 2. Migrate dashboards
./dash-porter migrate dashboard DASH-001 \
--target-datasource "prometheus-main"
./dash-porter migrate dashboard DASH-002 \
--target-datasource "prometheus-main"# 1. Create app-specific datasources
./dash-porter --flipkart datasource create "app1_hyd-1" \
--prometheus-url "http://prom-hyd.company.com:9090"
./dash-porter --flipkart datasource create "app1_ch-2" \
--prometheus-url "http://prom-ch.company.com:9090"
./dash-porter --flipkart datasource create "app2_hyd-1" \
--prometheus-url "http://prom-hyd.company.com:9090"
# 2. Migrate Flipkart dashboards (auto-assigns correct datasources)
./dash-porter --flipkart migrate dashboard FLIPKART-DASH-001
./dash-porter --flipkart migrate dashboard FLIPKART-DASH-002api_key: Standard Grafana API key authenticationbasic: HTTP basic authentication (username/password)none/public/"": No authentication (public instances)
folder_prefix: Prefix for migrated dashboard folderspreserve_uids: Keep original dashboard UIDstimeout: Operation timeout durationshow_null_values: Display null values in converted queries
--config: Specify config file path--dry-run: Preview operations without executing--verbose: Enable detailed logging--flipkart: Enable Flipkart-specific functionality
- Input Format:
appid.metric_name(e.g.,myapp.cpu_usage) - Output: Clean
metric_name(e.g.,cpu_usage) - Datasource: Automatic
appid_zoneassignment (e.g.,myapp_hyd-1)
- Default zones:
hyd-1,ch-2 - Zone detection from dashboard tags
- Configurable zone mappings
- Zone-based template variable updates
- AppID extraction and processing
- Datasource name generation
api_key: Use Grafana API key for authenticationbasic: Use username/password basic authenticationnone: For public Grafana instances (no authentication required)
When using --flipkart flag, the tool enables enterprise-specific features:
- Custom metric processing for Flipkart applications
- Zone-based datasource management
- Application-specific template handling
go build -o dash-porter
go test ./...
## Contributing
Contributions are welcome! Please feel free to submit issues and pull requests.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.