datasource

package
v1.0.0-rc1.0...-e18caea Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MODE_METRICS   = "0"
	MODE_ITSERVICE = "1"
	MODE_TEXT      = "2"
	MODE_ITEMID    = "3"
	MODE_TRIGGERS  = "4"
	MODE_PROBLEMS  = "5"
)
View Source
const RANGE_VARIABLE_VALUE = "range_series"

Variables

View Source
var (
	ErrFunctionsNotSupported      = errors.New("zabbix queries with functions are not supported")
	ErrNonMetricQueryNotSupported = errors.New("non-metrics queries are not supported")
)

Functions

func MustFloat64

func MustFloat64(p QueryFunctionParam) (float64, error)

func MustString

func MustString(p QueryFunctionParam) (string, error)

Types

type AggDataProcessingFunc

type AggDataProcessingFunc = func(series []*timeseries.TimeSeriesData, params ...interface{}) ([]*timeseries.TimeSeriesData, error)

type DBConnectionPostProcessingRequest

type DBConnectionPostProcessingRequest struct {
	Query     QueryModel                     `json:"query"`
	TimeRange TimeRangePostProcessingRequest `json:"timeRange"`
	Series    []*timeseries.TimeSeriesData   `json:"series"`
}

type DataProcessingFunc

type DataProcessingFunc = func(series timeseries.TimeSeries, params ...interface{}) (timeseries.TimeSeries, error)

type PreProcessingFunc

type PreProcessingFunc = func(query *QueryModel, items []*zabbix.Item, params ...interface{}) error

type QueryFilter

type QueryFilter struct {
	Filter string `json:"filter"`
}

QueryOptions model

type QueryFunction

type QueryFunction struct {
	Def    QueryFunctionDef     `json:"def"`
	Params []QueryFunctionParam `json:"params"`
	Text   string               `json:"text"`
}

QueryOptions model

type QueryFunctionDef

type QueryFunctionDef struct {
	Name          string                  `json:"name"`
	Category      string                  `json:"category"`
	Params        []QueryFunctionParamDef `json:"params"`
	DefaultParams []QueryFunctionParam    `json:"defaultParams"`
}

QueryOptions model

type QueryFunctionParam

type QueryFunctionParam = interface{}

type QueryFunctionParamDef

type QueryFunctionParamDef struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type QueryModel

type QueryModel struct {
	// Deprecated `mode` field, use QueryType instead
	Mode      int64  `json:"mode"`
	QueryType string `json:"-"`

	Group       QueryFilter `json:"group"`
	Host        QueryFilter `json:"host"`
	Application QueryFilter `json:"application"`
	ItemTag     QueryFilter `json:"itemTag"`
	Item        QueryFilter `json:"item"`

	// Item ID mode
	ItemIDs string `json:"itemids,omitempty"`

	Functions []QueryFunction `json:"functions,omitempty"`
	Options   QueryOptions    `json:"options"`

	// Direct from the gRPC interfaces
	RefID         string            `json:"-"`
	TimeRange     backend.TimeRange `json:"-"`
	MaxDataPoints int64             `json:"-"`
	Interval      time.Duration     `json:"-"`
}

QueryModel model

func ReadQuery

func ReadQuery(query backend.DataQuery) (QueryModel, error)

ReadQuery will read and validate Settings from the DataSourceConfg

type QueryOptions

type QueryOptions struct {
	ShowDisabledItems     bool   `json:"showDisabledItems"`
	DisableDataAlignment  bool   `json:"disableDataAlignment"`
	UseZabbixValueMapping bool   `json:"useZabbixValueMapping"`
	UseTrends             string `json:"useTrends"`
}

QueryOptions model

type ScopedVar

type ScopedVar struct {
	Text  string `json:"text"`
	Value string `json:"value"`
}

type TimeRangePostProcessingRequest

type TimeRangePostProcessingRequest struct {
	From int64
	To   int64
}

type ZabbixAPIResourceRequest

type ZabbixAPIResourceRequest struct {
	DatasourceId int64                  `json:"datasourceId"`
	Method       string                 `json:"method"`
	Params       map[string]interface{} `json:"params,omitempty"`
}

type ZabbixAPIResourceResponse

type ZabbixAPIResourceResponse struct {
	Result interface{} `json:"result,omitempty"`
}

func BuildAPIResponse

func BuildAPIResponse(responseData *interface{}) (*ZabbixAPIResourceResponse, error)

type ZabbixDatasource

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

func NewZabbixDatasource

func NewZabbixDatasource() *ZabbixDatasource

func (*ZabbixDatasource) CheckHealth

CheckHealth checks if the plugin is running properly

func (*ZabbixDatasource) DBConnectionPostProcessingHandler

func (ds *ZabbixDatasource) DBConnectionPostProcessingHandler(rw http.ResponseWriter, req *http.Request)

func (*ZabbixDatasource) QueryData

func (*ZabbixDatasource) RootHandler

func (ds *ZabbixDatasource) RootHandler(rw http.ResponseWriter, req *http.Request)

func (*ZabbixDatasource) ZabbixAPIHandler

func (ds *ZabbixDatasource) ZabbixAPIHandler(rw http.ResponseWriter, req *http.Request)

type ZabbixDatasourceInstance

type ZabbixDatasourceInstance struct {
	Settings *settings.ZabbixDatasourceSettings
	// contains filtered or unexported fields
}

ZabbixDatasourceInstance stores state about a specific datasource and provides methods to make requests to the Zabbix API

func (*ZabbixDatasourceInstance) TestConnection

func (ds *ZabbixDatasourceInstance) TestConnection(ctx context.Context) (string, error)

TestConnection checks authentication and version of the Zabbix API and returns that info

func (*ZabbixDatasourceInstance) ZabbixAPIQuery

ZabbixAPIQuery handles query requests to Zabbix API

Jump to

Keyboard shortcuts

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