grafana

package
v0.0.0-...-ce8ebf7 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2021 License: Apache-2.0 Imports: 2 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// FlowEventsCount - Title for Singlestat flowevents panel
	FlowEventsCount = "FlowEventsCount"
	// ContainerEventsCount - Title for Singlestat containerevents panel
	ContainerEventsCount = "ContainerEventsCount"
	// FourTupleWithAction - Title for Table flowtuple panel
	FourTupleWithAction = "FourTupleWithAction"
	// ContainerEventFields - Title for Table containerevents panel
	ContainerEventFields = "ContainerEventFields"
	// FlowEventFields -  Title for Table flowevents panel
	FlowEventFields = "FlowEventFields"
	// ContainerEventsGraph - Title for Graph containerevents  panel
	ContainerEventsGraph = "ContainerEventsGraph"
	// FlowEventsGraph - Title for Graph flowevents panel
	FlowEventsGraph = "FlowEventsGraph"
	// AllFields - To retrieve all the fields from DB
	AllFields = "*"
)
View Source
const (
	// ContainerEvent is the Container events measurement name
	ContainerEvent = "ContainerEvents"
	// FlowEvent is the Flow events measurement name
	FlowEvent = "FlowEvents"
)
View Source
const (
	// Count - aggregate function
	Count = "count"
)
View Source
const (
	// InfluxDB - datasource DB
	InfluxDB = "influxdb"
)

Variables

This section is empty.

Functions

func DefaultRow

func DefaultRow() grafanaclient.Row

DefaultRow is a default row generator

func DefaultSelectAttribute

func DefaultSelectAttribute() grafanaclient.Select

DefaultSelectAttribute is a default select attribute generator

Types

type Grafana

type Grafana struct {
	Row grafanaclient.Row
	// contains filtered or unexported fields
}

Grafana is the structure which holds required grafana fields Implements GrafanaManipulator interface

func (*Grafana) AddPanel

func (g *Grafana) AddPanel(paneltype PanelType, paneltitle string, measurement string, fields []string) grafanaclient.Panel

AddPanel is used to add different panels into rows

func (*Grafana) ConstructSelectQueriesFromFields

func (g *Grafana) ConstructSelectQueriesFromFields(fields []string, aggregareFuntionSelects grafanaclient.Select) []grafanaclient.Selects

ConstructSelectQueriesFromFields is used to create select queries for panels to visualize

func (*Grafana) CreateDashboard

func (g *Grafana) CreateDashboard(dbtitle string)

CreateDashboard is used to create a new dashboard

func (*Grafana) CreateDataSource

func (g *Grafana) CreateDataSource(name string, dbname string, dbuname string, dbpass string, dburl string, access string) error

CreateDataSource is used to create a new datasource based on users arguements

func (*Grafana) CreateRow

func (g *Grafana) CreateRow(rowname string)

CreateRow is used to create a new row in the dashboard

func (*Grafana) CreateTarget

func (g *Grafana) CreateTarget(measurement string, fields []string, aggregateFunction string)

CreateTarget is used to create targets to query panels

func (*Grafana) UploadToDashboard

func (g *Grafana) UploadToDashboard()

UploadToDashboard is used to push all created panels ans rows into the dashboard

type GrafanaManipulator

type GrafanaManipulator interface {
	CreateDataSource(name string, dbname string, dbuname string, dbpass string, dburl string, access string) error
	CreateDashboard(dbr string)
	AddPanel(panel PanelType, title string, measurement string, fields []string) grafanaclient.Panel
	CreateRow(rowname string)
	CreateTarget(measurement string, fields []string, aggregateFunction string)
	ConstructSelectQueriesFromFields(fields []string, aggregareFuntionSelects grafanaclient.Select) []grafanaclient.Selects
	UploadToDashboard()
}

GrafanaManipulator is the interface which has all methods to interact with the grafana ui

func NewUISession

func NewUISession(user string, pass string, addr string) (GrafanaManipulator, error)

NewUISession is used to create a new session and return grafana handle

type PanelType

type PanelType string

PanelType is the type of panels used to append to rows

const (
	// SingleStat - Type of panel used in grafana
	SingleStat PanelType = "singlestat"
	// Graph - Type of panel used in grafana
	Graph PanelType = "graph"
	// Diagram - Type of panel used in grafana
	Diagram PanelType = "jdbranham-diagram-panel"
	// Table - Type of panel used in grafana
	Table PanelType = "table"
)

Jump to

Keyboard shortcuts

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