Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/czantoine/grafana-dashboard-badge

This project generates badges displaying the download count for Grafana dashboards
https://github.com/czantoine/grafana-dashboard-badge

Last synced: about 2 months ago
JSON representation

This project generates badges displaying the download count for Grafana dashboards

Awesome Lists containing this project

README

        

# Grafana Dashboard Badge


Twitter
Linkedin
Stars
Issues
Last Commit

`Grafana Dashboard Badge` is a tool to retrieve download count metrics for a Grafana dashboard and generate badges displaying these metrics. These badges are an easy way to visualize and share the popularity of your dashboards.

**Live Example:**
- Download Count Badge: ![Download Badge](https://grafana-dashboard-badge.netlify.app/.netlify/functions/api/badge?id_dashboard=21378)
- Download Count Badge with logo : ![Download Badge](https://grafana-dashboard-badge.netlify.app/.netlify/functions/api/badge?id_dashboard=21378&logo=true)
- Revision Badge: ![Revision Badge](https://grafana-dashboard-badge.netlify.app/.netlify/functions/api/revision-badge?id_dashboard=21378)

---

## Table of Contents

1. [Project Overview](#project-overview)
2. [Usage Examples](#usage-examples)
3. [Customization](#customization)
4. [API Documentation](#api-documentation)
5. [Development with Netlify](#development-with-netlify)

## Project Overview

The `Grafana Dashboard Badge` application scrapes Grafana’s site for dashboard data, specifically download counts, and generates an SVG badge with this count. The deployment and API endpoints are managed via Netlify, making it accessible online.

## Usage Examples

Here’s how you can use the badges in your project or website:

1. **Image Badge**

```html
Grafana Dashboard Download Badge
```

2. **Link with Badge**

```html

Grafana Dashboard Download Badge

```

3. **Markdown Integration**

```markdown
![Grafana Dashboard Download Badge](https://grafana-dashboard-badge.netlify.app/.netlify/functions/api/badge?id_dashboard=21378)
```

## Customization

You can customize the badge with optional parameters for text and color to better fit your design.

![Custom Grafana Dashboard Badge with Logo](https://grafana-dashboard-badge.netlify.app/.netlify/functions/api/badge?id_dashboard=21378&text=My%20Custom%20Badge&color=blue&logo=true)

- **Parameters**:
- `text` (default: "Dashboard Downloads"): Set custom text.
- `color` (default: auto-generated based on download count): Define a specific color in hex or color name.
- `logo` (optional): Set to `true` to add a Grafana logo to the badge.

Example of the default auto-generated based on download count [here](ColorScheme.md).

**Example**:

```html
Custom Grafana Badge
```

## API Documentation

### Badge Generation Endpoint

- **Endpoint**: `/badge`
- **Method**: `GET`
- **Description**: Generates a badge with the Grafana dashboard download count.

**Query Parameters**:
- `id_dashboard` (required): The Grafana dashboard ID.
- `text` (optional): Custom label text.
- `color` (optional): Custom color for the badge.
- `logo` (optional): Set to `true` to add a Grafana logo.

**Example**:

```bash
curl "https://grafana-dashboard-badge.netlify.app/.netlify/functions/api/badge?id_dashboard=21378&text=Downloads&color=green&logo=true"
```

## Development with Netlify

Netlify deployment:



Netlify Status

1. **Install Netlify CLI**:
```bash
npm install -g netlify-cli
```

2. **Run Locally**:
```bash
netlify dev
```

This starts a local server simulating the Netlify environment for testing, dev and debugging.

---

If you find this project useful, please give it a star ⭐️ ! Your support is greatly appreciated. Also, feel free to contribute to this project. All contributions, whether bug fixes, improvements, or new features, are welcome!

## Special Thanks

A special thanks to **jangaraj** from the [Grafana Community](https://community.grafana.com/u/jangaraj/summary) for their invaluable guidance and support.

## License

This project is licensed under the MIT License. See the LICENSE file for details.