grafana #26

Supports: xenial bionic trusty

Add to new model

Description

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


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= keyrole=

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

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


Configuration

admin_password
(string) Grafana admin password. Default, pwgen(16) random password. See also README.md for instructions how to retrieve automatically generated password
anonymous
(boolean) Whether to allow anonymous users, defaults to False.
anonymous_role
(string) The role given to anonymous users if enabled.
Viewer
app_mode
(string) production or development
production
dashboards_backup_dir
(string) Location where to put dashboard dumps
/srv/backups
dashboards_backup_schedule
(string) Cron schedule for dashboards backups
datasources
(string) List of datasources in format: - 'prometheus,BootStack Prometheus,proxy,http://localhost:9090,,,'
debug
(boolean) Enable debug level logging.
default_dashboards
(string) List of default dashboards to be loaded on Grafana storage backend (default: sqlite3 backend)
external_network
(string) \ Name for the network which hosts the Public IP address space.
ext_net
google_analytics_ua_id
(string) Google Universal Analytics ID per http://docs.grafana.org/installation/configuration/#google-analytics-ua-id
http_proxy
(string) Proxy URL to use for install_file
install_file
(string) Location where grafana .deb file can be found. If set install_sources and install_keys options are ignored. Example: install_file: http://my.company.com/packages/grafana/grafana_3.0.0_amd64.deb
install_keys
(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.4.11 (GNU/Linux) mQINBFu7jn8BEAC+f2xaHm8VnvpsoK2mD9dQAPDf9Pslvv0EH0Rhs6D54LpkF7hj VjeUH+cpNha7Gcr4vTubcVVAsq5mHplatn54UmHUg1inuNbe32vVcoDF/UPtg4tg nq9CbGFQvCRX4gEGVfiOsoipKhu50hv09LEyN7y8bYoWSrYcjPL2fswr94Bm4+Kq IFdHwKBKYrJQ390NuIrP+ncBDIJ5ubdMtM5S2gpKEW4daO/4pnfr7YmgfQr34+Xe 5SkVcOix3CqPXwQ/OyTPwhZJssXljxcWbcOM09hCZBRqADAshuFJwlvn/meXRWK4 5Mlnr3BaCEDhLgaLHlBRdT0jF6LYl4K0qY2o60NUlnPFWLRYB+jJFFISFrhiwpoQ mo+6erbBa2AHB7MoZmzpXzWDz8UQSux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BvC5wJP5C ZHoaKVW9+o1CKmFKYz+1woY6qugYB/8Uy7gy3C9qGbi7UZwMFUJUCYxu5htHuB/a tTUJ4nM//ichv9TCsTA5X/tYJBD0USEVl0bMV4CtS+qP2il17D846bA= =ewdt -----END PGP PUBLIC KEY BLOCK-----
install_method
(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
apt
install_plugins
(string) Comma separated list of http(s) URLs where grafana plugin tarballs can be found. Example: install_plugins: http://my.company.com/packages/grafana/plugins/plugin-panel.tar.gz
install_sources
(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 https://packagecloud.io/grafana/stable/debian/ stretch main'
instance_name
(string) Grafana instance name, for example "grafana.example.com". If unset defaults to server hostname
nagios_context
(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.
juju
nagios_servicegroups
(string) Comma separated list of nagios servicegroups for the graphite check
juju
port
(string) The port grafana will expose web services on.
3000
root_url
(string) The full public facing url
%(protocol)s://%(domain)s:%(http_port)s/
smtp_auth
(string) The SMTP username and password that the Grafana plugin will authenticate with in "username:password" format. Example mysmtpuser:secret
smtp_from_address
(string) The SMTP from address that the Grafana plugin will use when addressing emails.
admin@grafana.localhost
smtp_host
(string) The SMTP host and port that grafana will send emails via. If unset SMTP will not be enabled Example: smtp.example.com:25
smtp_skip_cert_verification
(boolean) Disable certificate verification when talking to SSL/TLS enabled SMTP servers (true allows self-signed certificates)
snap_channel
(string) If install_method is set to "snap" this option controlls channel name. Supported values are: "stable", "candidate", "beta" and "edge"
stable
snap_proxy
(string) DEPRECATED. Use snap-http-proxy and snap-https-proxy model configuration settings. HTTP/HTTPS web proxy for Snappy to use when accessing the snap store.
snap_proxy_url
(string) DEPRECATED. Use snap-store-proxy model configuration setting. The address of a Snap Store Proxy to use for snaps e.g. http://snap-proxy.example.com
snapd_refresh
(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: https://forum.snapcraft.io/t/system-options/87