Skip to content
This repository was archived by the owner on Mar 4, 2024. It is now read-only.

juju-solutions/interface-grafana-dashboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Interface grafana-dashboard

This is a Juju interface layer that enables a charm which provides dashboards to be imported into Grafana.

You can download existing Grafana Dashboards or use the Grafana Dashboard Reference to create your own.

Example Usage

First, you must define the relation endpoint in your charm's metadata.yaml:

provides:
  grafana:
    interface: grafana-dashboard

Next, you must ensure the interface layer is included in your layer.yaml:

includes:
  - interface:grafana-dashboard

Then, in your reactive code, add the following, modifying the dashboard data as your charm needs:

import json
from charms.reactive import endpoint_from_flag


@when('endpoint.grafana.joined')
def register_grafana_dashboards():
    grafana = endpoint_from_flag('endpoint.grafana.joined')
    for dashboard_file in Path('files/grafana').glob('*.json'):
        dashboard = json.loads(dashboard_file.read_text())
        grafana.register_dashboard(name=dashboard_file.stem,
                                   dashboard=dashboard)

Reference

Contact Information

Maintainer: Cory Johns <Cory.Johns@canonical.com>

About

Interface layer for importing dashboards into Grafana

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages