Mthaddon Grafana

juju deploy mthaddon-grafana
Show information
You will need Juju 2.9 to be able to run this command. Learn how to upgrade to Juju 2.9.
Channel Version Revision Published Runs on
latest/stable 4 4 19 Mar 2021
Ubuntu 18.04 Ubuntu 16.04 Ubuntu 14.04

Platform:

Ubuntu
16.04 18.04 14.04

About

Graph and Dashboard builder Read more


Discuss this charm

Share your thoughts on this charm with the community on discourse.

Join the discussion

Overview

This charm provides the latest stable version of Grafana.

Usage

juju deploy grafana
juju add-relation prometheus:grafana-source grafana:grafana-source

Above will automatically configure prometheus as grafana datasource

If admin password is not set using configuration option it is autogenerated.

To retrieve autogenerated password run:

juju run-action --wait grafana/0 get-admin-password

Actions

This charm supports importing dashboards, simply run:

juju run-action --wait grafana/0 import-dashboard dashboard="$(base64 mydashboard.json)"

where mydashboard.json is a json file:

{ "dashboard": { exported-json-dashboard }, "overwrite": true }

If you don't want to overwrite the dashboard, set overwrite to false.

There is also an action to create an API key, run:

juju run-action --wait grafana/0 create-api-key keyname=<name> keyrole=<role>

where the keyrole is one of Viewer, Editor, Read Only Editor or Admin.

User Management Actions

Currently user management is only implemented to manipulate users in the default organisation.

You can retrieve the admin password, via:

juju run-action --wait grafana/0 get-admin-password

You can create a user:

juju run-action -w grafana/0 create-user name="John Citizen" \
    email="john@example.com" login="john" password="redacted" \
    role="Viewer"

where the role is one of Viewer, Editor, Read Only Editor or Admin. This will create the user in the default organisation.

To reset a user's password:

juju run-action --wait grafana/0 set-user-password \
    login=john new-password=citizen2

This again assumes the user is in the default organisation, if it isn't it won't find the user.

If you need to change the user's role, run:

juju run-action --wait grafana/0 change-user-role login="john" \
    new-role="Admin"

To delete a user, you simply run:

juju run-action --wait grafana/0 delete-user login=john

Auth proxy

If deployed behind a reverse proxy, you can configure Grafana to let it handle authentication by enabled auth-proxy.

juju config grafana auth-proxy=true

Check grafana documentation on how to configure apache as the reverse proxy.

Users will be created/signup automatically with "Viewer" permissions. To change the default permissions of a user, use the change-user-role action passing the openID identifier or the email if the user updated it as the "login":

juju run-action --wait grafana/0 change-user-role \
    login="user@company.com" new-role="Admin"

If not all URL paths are behind the reverse proxy auth, and anonymous=true is set, those paths will be accessible (view only) to non-authenticated users.

Development

Explicitly set JUJU_REPOSITORY:

export JUJU_REPOSITORY=/path/to/charms
mkdir -p $JUJU_REPOSITORY/layers

Branch code to

$JUJU_REPOSITORY/layers/layer-grafana/

Modify

Assemble the charm:

charm build

Contact Information

Author: Alvaro Uria alvaro.uria@canonical.com, Jacek Nykis jacek.nykis@canonical.com Report bugs at: https://bugs.launchpad.net/grafana-charm Location: Composed grafana charm: cs:~prometheus-charmers/grafana Grafana layer: https://code.launchpad.net/grafana-charm