grafana #51

Supports: focal bionic xenial


Grafana is the leading graph and dashboard builder for visualizing time series metrics.


This charm provides the latest stable version of Grafana.


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

To have dashboards delivered by charm relations, e.g. from Telegraf, add an extra relation as follows.

juju add-relation telegraf:dashboards grafana:dashboards


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="" login="john" password="redacted" \

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" \

To delete a user, you simply run:

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

Upgrade action

To perform an upgrade after changing snap_channel an upgrade action must be run:

juju run-action --wait grafana/0 do-upgrade

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="" 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.


After modifying code, you must assemble the charm:

charm build

Known Issues

  • LP#1901044: In stable/20.10, When deploying grafana, prometheus and prometheus-ceph-exporter for the first time, Grafana will check if Ceph related metrics exist in Prometheus. If such metrics don't exist at the time of adding the relation, the Ceph dashboards won't be imported. In order to fix this problem, the grafana:grafana-source relation should be recycled (juju remove-relation grafana:grafana-source prometheus, followed by juju add-relation grafana:grafana-source prometheus).

  • LP#1901041: Xenial functional tests fail when changing Grafana's port via Juju config.

Contact Information

Author: Alvaro Uria, Jacek Nykis

Report bugs at:


Release information

Release 20.08:

  • Note that in cs:grafana-36, the Grafana charm shipped a default dashboard for Telegraf. This is removed as of release 20.08, relying instead on the dashboard delivered by the grafana:dashboard relation endpoint.
  • Dashboard titles are now tagged with "[juju-{provider}]"
  • Folks upgrading to the current release will potentially need to add the relation for dashboard import:

    juju add-relation grafana:dashboards $application:dashboards


(string) Grafana admin password. Default, pwgen(16) random password. See also for instructions how to retrieve automatically generated password
(boolean) If false the Grafana HTTP responses will instruct browsers to not allow rendering Grafana in a <frame>, <iframe>, <embed> or <object>.
(boolean) Whether to allow anonymous users, defaults to False.
(string) The role given to anonymous users if enabled.
(string) production or development
(boolean) Whether to enable default auth.proxy config, defaults to False.
(string) Location where to put dashboard dumps
(string) Cron schedule for dashboards backups
(string) List of datasources in format: - type,name,access,url,password,user,database
(boolean) Enable debug level logging.
(string) List of default dashboards to be loaded on Grafana storage backend (default: sqlite3 backend)
(string) Name for the network which hosts the Public IP address space.
(string) Google Universal Analytics ID per
(string) Proxy URL to use for install_file
(string) Location where grafana .deb file can be found. If set install_sources and install_keys options are ignored. Example: install_file:
(string) YAML list of GPG keys for installation sources, as a string. For apt repository URLs, use the public key ID used to verify package signatures. For other sources such as PPA, use empty string. This list must have the same number of elements as install_sources, even if the key items are all empty string. An example to go with the above for install_sources: install_keys: | - "" - ""
- | -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1 mQENBFiHXVIBCADr3VDEAGpq9Sg/x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M58B56jRyXo18MqB6VYsC1X9wkcIs72thL3tThXO70oDGcoXzoo ywAHBH63EzEyduInOhecDIKlABEBAAGJAR8EGAECAAkFAliHXVICGwwACgkQjIw0 xSQJjLbWSwf/VIM5wEFBY4QLGUAfqfjDyfGXpcha58Y24Vv3n6MwJqnCIbTAaeWf 30CZ/wHg3NNIMB7I31vgmMOEbHQdv0LPTi9TG205VQeehcpNtZRZQ0D8TIetbxyi Emmn9osig9U3/7jaAWBabE/9bGx4TF3eLlEH9wmFrNYeXvgRqmyqVoqhIMCNAAOY REYyHyy9mzr9ywkwl0aroBqhzKIPyFlatZy9oRKllY/CCKO9RJy4DZidLphuwzqU ymdQ1sqe5nKvwG5GvcncPc3O7LMevDBWnpNNkgERnVxCqpm90TuE3ONbirnU4+/S tUsVU1DERc1fjOCnAm4pKIlNYphISIE7OQ== =0pMC -----END PGP PUBLIC KEY BLOCK-----
(string) How to install Grafana. If set to "apt", empty string or unset, the package will be installed using apt-get. If set to "snap", snap package will be installed
(string) Comma separated list of http(s) URLs where grafana plugin tarballs can be found. Example: install_plugins:
(string) YAML list of additional installation sources, as a string. The number of install_sources must match the number of install_keys. For example: install_sources: | - ppa:project1/ppa - ppa:project2/ppa
- 'deb stable main'
(string) Grafana instance name, for example "". If unset defaults to server hostname
(string) A string that will be prepended to instance name to set the host name in nagios. So for instance the hostname would be something like: juju-myservice-0 If you're running multiple environments with the same services in them this allows you to differentiate between them.
(string) Comma separated list of nagios servicegroups for the graphite check
(string) The port grafana will expose web services on.
(string) The full public facing url
(string) An unique site name for Grafana deployment
(string) The SMTP username and password that the Grafana plugin will authenticate with in "username:password" format. Example mysmtpuser:secret
(string) The SMTP from address that the Grafana plugin will use when addressing emails.
(string) The SMTP host and port that grafana will send emails via. If unset SMTP will not be enabled Example:
(boolean) Disable certificate verification when talking to SSL/TLS enabled SMTP servers (true allows self-signed certificates)
(string) If install_method is set to "snap" this option controls channel name being used. Note: a) changing this option will not automatically upgrade snaps -- see the do-upgrade action for this, b) downgrading snaps is unsupported, and c) using the track symbolic name "latest" is also unsupported (use an explicit track name instead, e.g. "7/stable")
(string) How often snapd handles updates for installed snaps. The default (an empty string) is 4x per day. Set to "max" to check once per month based on the charm deployment date. You may also set a custom string as described in the 'refresh.timer' section here:
(string) Base64 encoded TLS CA to use to communicate with other components in a deployment. For example: `juju config grafana ssl_ca=$(base64 -w 0 /path/to/ca.crt)` . . __NOTE__: This configuration option will take precedence over any certificates received over the ``certificates`` relation.
(string) Base64 encoded TLS certificate to install and use for any listening services. For example: `juju config grafana ssl_cert=$(base64 -w 0 /path/to/server.crt)` . __NOTE__: This configuration option will take precedence over any certificates received over the ``certificates`` relation.
(string) Base64 encoded TLS key to use with certificate specified as ``ssl_cert``. For example: `juju config grafana ssl_key=$(base64 -w 0 /path/to/server.key)` . __NOTE__: This configuration option will take precedence over any certificates received over the ``certificates`` relation.