Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 85 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,100 @@
<div align="center">
<h1>PATH<br/>Path API & Toolkit Harness</h1>
<img src="https://storage.googleapis.com/grove-brand-assets/Presskit/Logo%20Joined-2.png" alt="Grove logo" width="500"/>
# Grafana + VictoriaMetrics Export Guide

</div>
<br/>
This guide shows how to use Grafana’s HTTP API with a **service account token** to export metrics and dashboards.
Tested on **Grafana v12.0.2**.

![Static Badge](https://img.shields.io/badge/Maintained_by-Grove-green)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/buildwithgrove/path/main-build.yml)
![GitHub last commit](https://img.shields.io/github/last-commit/buildwithgrove/path)
![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/buildwithgrove/path)
![GitHub Release](https://img.shields.io/github/v/release/buildwithgrove/path)
![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/buildwithgrove/path/total)
![GitHub Issues or Pull Requests](https://img.shields.io/github/issues/buildwithgrove/path)
![GitHub Issues or Pull Requests](https://img.shields.io/github/issues-pr/buildwithgrove/path)
![GitHub Issues or Pull Requests](https://img.shields.io/github/issues-closed/buildwithgrove/path)
---

## 🔑 1. Create a Service Account Token

1. Go to **Administration → Users and access → Service accounts**.
2. Click **New service account**, name it `metrics-exporter`, and assign role = **Viewer**.
3. Open the service account → click **Add service account token**.
4. Copy the token (looks like `glsa_XXXXXXXX...`).
> ⚠️ Keep this secret — it allows read access to Grafana data sources.

## Overview
---

**PATH** (Path API & Toolkit Harness) is an open source framework for enabling
access to a decentralized supply network.
## 📥 2. Export All Metric Names

It provides various tools and libraries to streamline the integration and
interaction with decentralized protocols.
```bash
curl -s \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
"https://grafana.tooling.grove.city/api/datasources/proxy/uid/ad44f9fa-1c08-4eae-ad3a-3a12d9fe762d/api/v1/label/__name__/values" \
| jq -r '.data[]' > metrics.txt
```

## Documentation
This saves all metric names into `metrics.txt`.

Please visit [path.grove.city](https://path.grove.city) for documentation.
---

The source code for the documentation is available in the `docs` directory.
## 📦 3. Export Metrics + Labels (Full Series)

## Support
```bash
curl -s \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
"https://grafana.tooling.grove.city/api/datasources/proxy/uid/ad44f9fa-1c08-4eae-ad3a-3a12d9fe762d/api/v1/series?match[]={__name__=~\".*\"}" \
| jq -c '.data[]' > series.json
```

For Bug Reports and Enhancement Requests, please open an [Issue](https://github.com/buildwithgrove/path/issues).
Each entry in `series.json` looks like:

For Technical Support please open a ticket in [Grove's Discord](https://discord.gg/build-with-grove).
```json
{ "__name__": "http_requests_total", "method": "GET", "status": "200" }
```

---

## License
## 📊 4. Export a Single Dashboard (JSON)

Find the dashboard UID in its URL:
Example:

```
https://grafana.tooling.grove.city/d/bff5eb04-0c27-4cbd-ac27-d97b25530f5d/...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = UID
```

Export:

```bash
curl -s \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
"https://grafana.tooling.grove.city/api/dashboards/uid/bff5eb04-0c27-4cbd-ac27-d97b25530f5d" \
| jq '.dashboard' > dashboard.json
```

---

This project is licensed under the MIT License; see the [LICENSE](https://github.com/buildwithgrove/path/blob/main/LICENSE) file for details.
## 📚 5. Export All Dashboards

List all dashboards:

```bash
curl -s \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
"https://grafana.tooling.grove.city/api/search?query=" \
| jq -r '.[].uid'
```

Loop through and save each:

```bash
for uid in $(curl -s -H "Authorization: Bearer YOUR_TOKEN_HERE" \
"https://grafana.tooling.grove.city/api/search?query=" | jq -r '.[].uid'); do
echo "Exporting $uid..."
curl -s -H "Authorization: Bearer YOUR_TOKEN_HERE" \
"https://grafana.tooling.grove.city/api/dashboards/uid/$uid" \
| jq '.dashboard' > "dashboard-${uid}.json"
done
```

---

## ⚠️ Security Notes

- Treat your token like a password.
- Rotate/revoke tokens when not needed.
- Restrict tokens to **Viewer** role unless more is required.

---
Loading