Module for working with the Grafana v4 API
New in version 2017.7.0.
requests
This module requires a configuration profile to be configured in the minion config, minion pillar, or master config. The module will use the 'grafana' key by default, if defined.
For example:
grafana:
grafana_url: http://grafana.localhost
grafana_user: admin
grafana_password: admin
grafana_timeout: 3
Create a new datasource in an organisation.
Name of the data source.
Type of the datasource ('graphite', 'influxdb' etc.).
Use proxy or direct.
The URL to the data source API.
Optional - user to authenticate with the data source.
Optional - password to authenticate with the data source.
Optional - database to use with the data source.
Optional - set to True to use HTTP basic auth to authenticate with the data source.
Optional - HTTP basic auth username.
Optional - HTTP basic auth password.
Optional - additional json data to post (eg. "timeInterval").
Optional - set data source as default.
Optional - Whether credentials such as cookies or auth headers should be sent with cross-site requests.
Optional - Logo to use for this datasource.
Name of the organization in which the data source should be created.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.create_datasource
Create a new organization.
Name of the organization.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.create_org <name>
Add user to the organization.
Login or email of the user.
Admin
Editor
Read Only Editor
Viewer
Name of the organization in which users are added.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.create_org_user <orgname> loginOrEmail=<loginOrEmail> role=<role>
Create or update a dashboard.
A dict that defines the dashboard to create/update.
Whether the dashboard should be overwritten if already existing.
Name of the organization.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.create_update_dashboard dashboard=<dashboard> overwrite=True orgname=<orgname>
Create a new user.
Login of the new user.
Password of the new user.
Email of the new user.
Optional - Full name of the new user.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.create_user login=<login> password=<password> email=<email>
Delete a dashboard.
Slug (name) of the dashboard.
Name of the organization.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.delete_dashboard <slug>
Delete a datasource.
Id of the datasource.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.delete_datasource <datasource_id>
Delete an organization.
Id of the organization.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.delete_org <org_id>
Remove user from the organization.
Id of the user.
Name of the organization in which users are updated.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.delete_org_user <user_id> <orgname>
Delete a user.
Id of the user.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.delete_user <user_id>
Remove a user from an organization.
Id of the user.
Id of the organization.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.delete_user_org <user_id> <org_id>
Get a dashboard.
Slug (name) of the dashboard.
Name of the organization.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.get_dashboard <slug>
Show a single datasource in an organisation.
Name of the datasource.
Name of the organization.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.get_datasource <name> <orgname>
List all datasources in an organisation.
Name of the organization.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.get_datasources <orgname>
Show a single organization.
Name of the organization.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.get_org <name>
Get the organization address.
Name of the organization in which users are updated.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.get_org_address <orgname>
Get the organization preferences.
Name of the organization in which users are updated.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.get_org_prefs <orgname>
Get the list of users that belong to the organization.
Name of the organization.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.get_org_users <orgname>
List all organizations.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.get_orgs
Show a single user.
Login of the user.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.get_user <login>
Get user data.
Id of the user.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.get_user_data <user_id>
Get the list of organisations a user belong to.
Id of the user.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.get_user_orgs <user_id>
List all users.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.get_users
Switch the current organization.
Name of the organization to switch to.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.switch_org <name>
Update a datasource.
Id of the datasource.
Name of the data source.
Type of the datasource ('graphite', 'influxdb' etc.).
Use proxy or direct.
The URL to the data source API.
Optional - user to authenticate with the data source.
Optional - password to authenticate with the data source.
Optional - database to use with the data source.
Optional - set to True to use HTTP basic auth to authenticate with the data source.
Optional - HTTP basic auth username.
Optional - HTTP basic auth password.
Optional - additional json data to post (eg. "timeInterval").
Optional - set data source as default.
Optional - Whether credentials such as cookies or auth headers should be sent with cross-site requests.
Optional - Logo to use for this datasource.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.update_datasource <datasourceid>
Update an existing organization.
Id of the organization.
New name of the organization.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.update_org <org_id> name=<name>
Update the organization address.
Name of the organization in which users are updated.
Optional - address1 of the org.
Optional - address2 of the org.
Optional - city of the org.
Optional - zip_code of the org.
Optional - state of the org.
Optional - country of the org.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.update_org_address <orgname> country=<country>
Update the organization preferences.
Name of the organization in which users are updated.
Selected theme for the org.
Home dashboard for the org.
Timezone for the org (one of: "browser", "utc", or "").
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.update_org_prefs <orgname> theme=<theme> timezone=<timezone>
Update user role in the organization.
Id of the user.
Login or email of the user.
Admin
Editor
Read Only Editor
Viewer
Name of the organization in which users are updated.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.update_org_user <user_id> <orgname> loginOrEmail=<loginOrEmail> role=<role>
Update an existing user.
Id of the user.
Optional - Login of the user.
Optional - Email of the user.
Optional - Full name of the user.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.update_user <user_id> login=<login> email=<email>
Update a user password.
Id of the user.
New password of the user.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.update_user_password <user_id> password=<password>
Update a user password.
Id of the user.
Whether user is a Grafana admin.
Configuration profile used to connect to the Grafana instance. Default is 'grafana'.
CLI Example:
salt '*' grafana4.update_user_permissions <user_id> isGrafanaAdmin=<true|false>