Documentation ¶
Index ¶
- Constants
- func DefaultRow() grafanaclient.Row
- func DefaultSelectAttribute() grafanaclient.Select
- type Grafana
- func (g *Grafana) AddPanel(paneltype PanelType, paneltitle string, measurement string, fields []string) grafanaclient.Panel
- func (g *Grafana) ConstructSelectQueriesFromFields(fields []string, aggregareFuntionSelects grafanaclient.Select) []grafanaclient.Selects
- func (g *Grafana) CreateDashboard(dbtitle string)
- func (g *Grafana) CreateDataSource(name string, dbname string, dbuname string, dbpass string, dburl string, ...) error
- func (g *Grafana) CreateRow(rowname string)
- func (g *Grafana) CreateTarget(measurement string, fields []string, aggregateFunction string)
- func (g *Grafana) UploadToDashboard()
- type GrafanaManipulator
- type PanelType
Constants ¶
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 = "*" )
const ( // ContainerEvent is the Container events measurement name ContainerEvent = "ContainerEvents" // FlowEvent is the Flow events measurement name FlowEvent = "FlowEvents" )
const (
// Count - aggregate function
Count = "count"
)
const (
// InfluxDB - datasource DB
InfluxDB = "influxdb"
)
Variables ¶
This section is empty.
Functions ¶
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 ¶
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) CreateTarget ¶
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" )