项目作者: rrey

项目描述 :
Automatically publish annotations in grafana when you execute your playbooks !
高级语言: Python
项目地址: git://github.com/rrey/ansible-callback-grafana-annotations.git
创建时间: 2018-01-11T17:46:17Z
项目社区:https://github.com/rrey/ansible-callback-grafana-annotations

开源协议:GNU General Public License v3.0

下载


DEPRECATED: This plugin is now maintained under the Grafana Collection, please report any issue there.

ansible callback grafana_annotations

Automatically publish annotations in grafana when you execute your playbooks !
This callback was accepted in Ansible and should be available in version 2.6

Configuration

The configuration can be set through ansible cfg by declaring te callback section.
The following configuration represent the default values:

  1. [callback_grafana_annotations]
  2. grafana_url = "http://127.0.0.1:3000/api/annotations"
  3. validate_grafana_certs = 1
  4. http_agent = 'Ansible (grafana_annotations callback)'
  5. grafana_user = ansible
  6. grafana_password = ansible

The configuration can be overridden using environment variables.
Check the DOCUMENTATION string to have the full list of parameters.

Quickstart

  • Copy the callback_plugins directory in you playbook directory
  • Export the required environement variables:
  1. $ export GRAFANA_URL=<your_grafana_url>

The URL must be the Grafana annotations api URL, example: http:///api/annotations
The protocal can be either http or https.

For token based authentication:

  1. $ export GRAFANA_API_KEY=<your_grafana_api_key>

For basic http authentication:

  1. $ export GRAFANA_USER=<your_grafana_user>
  2. $ export GRAFANA_PASSWORD=<your_grafana_user_password>
  • Run your playbook:
    1. $ ansible-playbook test.yml
  • See the deployment in grafana:
    Grafana annotations

Restrict the annotations to a specific dashboard

If the annotations should be restricted to a particular dashboard, you can
specify its dashboard id through the dedicated environment variable:

  1. $ export GRAFANA_DASHBOARD_ID=<the_grafana_dashboard_id>

Restrict the annotations to a specific panel in a dashboard

If the annotations should be restricted to a particular panel in a dashboard, you can
specify both dashboard id and panel id through the dedicated environment variables:

  1. $ export GRAFANA_DASHBOARD_ID=<the_grafana_dashboard_id>
  2. $ export GRAFANA_PANEL_ID=<the_grafana_panel_id>