How does it work? - absalon-james/grafanizer GitHub Wiki

Phases of Grafanizer

  • Load templates
  • Gather entities
  • Create dashboards with entities and templates

###Load templates A directory is configured to be the template directory for Grafanizer. Grafanizer will consider every file in this directory to be a template. A file is ignored if the file does not validate as a template. Successfully validated templates are stored in a list for later use.

The template directory can be configured by:

  • configuration file: template_dir
  • environment variable: G_TEMPLATE_DIR
  • command line: --g-template-dir

Optionally, templating can be limited to single file via the command line argument --file

###Gather entities Grafanizer will build a tree for each entity that contains checks as children of the entity and metrics as children of the checks. This tree can be used later to determine if an entity is fit for a template.

The Rackspace Monitoring libcloud driver is used to obtain this information. An initial api call is performed to obtain a list of entities and then a green pile is used to create the tree for each entity. Creating the tree is one api call to get a list of checks and then one api call per check to get a list of metrics.

###Create dashboards with entities and templates A list of templates and an iterable green pile of entities are available at this point. The green pile is iterated over, and each entity is passed to each template. Templates examine each entity with a special querying language to determine if the entity is fit for a dashboard. If the entity is fit, a context with relevant information is used to create Grafana targets. Templates produce dashboards which are saved in Elasticsearch as if they had been created in Grafana.