Skip to content

Create and manage Grafana Dashboards as code,

Notifications You must be signed in to change notification settings

ddias-dev/grafana-dashboards

Repository files navigation

Grafana Dashboards

Create and manage Grafana Dashboards as code.

Description

This project aims to create and manage Grafana Dashboards as code, using AWS CDK Custom resources together with Grafonnet and Grafana HTTP APIs.

Grafonnet is a new library from Grafana that allows users to create and manage Grafana dashboards using Jsonnet, a data templating language. Grafonnet simplifies the process of defining dashboards as code, making them easier to version, share and reuse.

Grafana HTTP APIs are used to interact with Grafana instances and perform operations such as creating, updating, and deleting dashboards.

AWS CDK Custom resources are used to integrate Grafonnet and Grafana HTTP APIs with AWS CloudFormation, allowing users to define and deploy Grafana dashboards as part of their AWS infrastructure.

Getting Started

Requirements

  • AWS CLI - To configure the AWS Credentials.
  • AWS CDK - To run the local commands and deploy the application.
  • Docker - To run the local commands and deploy the application.
  • nmv - to set up Node.js v18
  • go-jsonnet - Grafonnet uses the Jsonnet programming language.

    NOTE: There is a significant performance issue with the C implementation of Jsonnet. You are strongly recommended to use the newer go-jsonnet Jsonnet implementation. This is also the implementation recommended by the Jsonnet developers themselves. It requires Go

  • jsonnet-bundler - a package manager for Jsonnet

Local Commands

  • aws sso login to log in to development/production AWS SSO account
  • npm install install package.json dependencies
  • npm run clean-packages perform a npm packages clean up
  • npm run dashboard-gen generate Grafana Dashboards json models
  • npm run deploy-[dev|prod] build and deploy this stack to specific environment
  • npm run format run a code formatter for entire application
  • npm run test perform eslint and jest snapshot testing

References