grafana

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

README

grafana

Usage

source:
  name: grafana
  config:
    base_url: grafana_server
    api_key: your_api_key
    exclude:
      dashboards:
        - dashboard_ud_1
        - dashboard_ud_2
      panels:
        - dashboard_uid_3.panel_id_1

Inputs

Key Value Example Description
base_url string http://localhost:3000 URL of the Grafana server required
api_key string Bearer qweruqwryqwLKJ API key to access Grafana API required
exclude.dashboards []string [dashboard_ud_1, dashboard_ud_2] List of dasboards to be excluded from crawling optional
exclude.panels []string [dashboard_uid_3.panel_id_1] List of panels to be excluded from crawling optional

Outputs

Field Sample Value
resource.urn grafana.HzK8qNW7z
resource.name new-dashboard-copy
resource.service grafana
resource.url http://localhost:3000/d/HzK8qNW7z/new-dashboard-copy
charts []chart
Chart
Field Sample Value
urn 5WsKOvW7z.4
name Panel Random
type table
source grafana
description random description for this panel
url http://localhost:3000/d/5WsKOvW7z/test-dashboard-updated?viewPanel=4
data_source postgres
raw_query SELECT\n urn,\n created_at AS \"time\"\nFROM resources\nORDER BY 1
dashboard_urn grafana.5WsKOvW7z
dashboard_source grafana

Contributing

Refer to the contribution guidelines for information on contributing to this module.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(httpClient *http.Client, config Config) (*Client, error)

func (*Client) GetAllDashboardDetails

func (c *Client) GetAllDashboardDetails(ctx context.Context, uids []string) ([]DashboardDetail, error)

func (*Client) GetAllDatasources

func (c *Client) GetAllDatasources(ctx context.Context) (map[string]DataSource, error)

func (*Client) GetDashboardDetail

func (c *Client) GetDashboardDetail(uid string) (DashboardDetail, error)

func (*Client) SearchAllDashboardUIDs

func (c *Client) SearchAllDashboardUIDs(ctx context.Context) ([]string, error)

type Config

type Config struct {
	BaseURL string  `json:"base_url" yaml:"base_url" mapstructure:"base_url" validate:"required"`
	APIKey  string  `json:"api_key" yaml:"api_key" mapstructure:"api_key" validate:"required"`
	Exclude Exclude `json:"exclude" yaml:"exclude" mapstructure:"exclude"`
}

Config holds the set of configuration for the grafana extractor

type Dashboard

type Dashboard struct {
	UID         string  `json:"uid"`
	Description string  `json:"description"`
	Panels      []Panel `json:"panels"`
}

type DashboardDetail

type DashboardDetail struct {
	Meta      Meta      `json:"meta"`
	Dashboard Dashboard `json:"dashboard"`
}

type DataSource

type DataSource struct {
	Name      string `json:"name"`
	Type      string `json:"type"`
	IsDefault bool   `json:"isDefult"`
}

type Exclude

type Exclude struct {
	Dashboards []string `json:"dashboards" yaml:"dashboards" mapstructure:"dashboards"`
	Panels     []string `json:"panels" yaml:"panels" mapstructure:"panels"`
}

type Extractor

type Extractor struct {
	plugins.BaseExtractor
	// contains filtered or unexported fields
}

Extractor manages the communication with the Grafana Server

func New

func New(logger log.Logger) *Extractor

New returns a pointer to an initialized Extractor Object

func (*Extractor) Extract

func (e *Extractor) Extract(ctx context.Context, emit plugins.Emit) error

Extract checks if the extractor is configured and if so, then it extracts the assets from the extractor.

func (*Extractor) Init

func (e *Extractor) Init(ctx context.Context, config plugins.Config) error

Init initializes the extractor

type Meta

type Meta struct {
	Slug string `json:"slug"`
	URL  string `json:"url"`
}

type Panel

type Panel struct {
	ID          int      `json:"id"`
	Title       string   `json:"title"`
	Type        string   `json:"type"`
	Description string   `json:"description"`
	DataSource  string   `json:"datasource"`
	Targets     []Target `json:"targets"`
}

type Target

type Target struct {
	RawSQL string `json:"rawSQL"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL