grafana #30

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


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
auth-proxy
(boolean) Whether to enable default auth.proxy config, defaults to False.
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: - type,name,access,url,password,user,database
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 mQENBFiHXVIBCADr3VDEAGpq9Sg/xrPVu1GGqWGXdbnTbbNKeveCtFHZz7/GSATW iwiY1skvlAOBiIKCqJEji0rZZgd8WxuhdfugiCBk1hDTMWCpjI0P+YymV77jHjYB jHrKNlhb+aLjEd9Gf2EtbKUT1fvGUkz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GUAfqfjDyfGXpcha58Y24Vv3n6MwJqnCIbTAaeWf 30CZ/wHg3NNIMB7I31vgmMOEbHQdv0LPTi9TG205VQeehcpNtZRZQ0D8TIetbxyi Emmn9osig9U3/7jaAWBabE/9bGx4TF3eLlEH9wmFrNYeXvgRqmyqVoqhIMCNAAOY REYyHyy9mzr9ywkwl0aroBqhzKIPyFlatZy9oRKllY/CCKO9RJy4DZidLphuwzqU ymdQ1sqe5nKvwG5GvcncPc3O7LMevDBWnpNNkgERnVxCqpm90TuE3ONbirnU4+/S tUsVU1DERc1fjOCnAm4pKIlNYphISIE7OQ== =0pMC -----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://packages.grafana.com/oss/deb stable 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