api

package
v0.0.2-0...-4ce78c8 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RoutePathSeries        = "/v1/n9e/series"
	RoutePathCheckRuns     = "/api/v1/check_run"
	RoutePathIntake        = "/intake/" // hostMetadata
	RoutePathValidate      = "/api/v1/validate"
	RoutePathEvents        = "/api/v2/events"
	RoutePathServiceChecks = "/api/v2/service_checks"
	RoutePathSketchSeries  = "/api/beta/sketches"
	RoutePathMetadata      = "/api/v2/metadata"
	RoutePathCollector     = "/api/v1/collector"
	RoutePathContainer     = "/api/v1/container"
	RoutePathOrchestrator  = "/api/v1/orchestrator"
	RoutePathLogs          = "/v1/logs/input"
	//RoutePathSeries        = "/api/v2/series"
	//RoutePathHostMetadata  = "/api/v2/host_metadata"
	//
	RoutePathGetCollectRules        = "/api/collect-rules"
	RoutePathGetCollectRulesSummary = "/api/collect-rules-summary"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CollectRule

type CollectRule struct {
	ID   int64  `jso:id`      // option rule.ID
	Name string `json:"name"` // option Config.instances[$] ruleID
	Type string `json:"type"` // required Config.Name checkName
	Data string `json:"data"` // required Config.Instances[$]

	Interval  int    `json:"step"`       // -> Config.Instances[$].MinCollectionInterval
	Tags      string `json:"appendTags"` // -> Config.Instances[$].Tags   a:b,b:c
	CreatedAt int64  `json:"createAt"`   // deprecated
	UpdatedAt int64  `json:"updateAt"`   // deprecated
	Creator   string `json:"createBy"`   // deprecated
	Updater   string `json:"updateBy"`   // deprecated
}

type CollectRulesSummary

type CollectRulesSummary struct {
	LatestUpdatedAt int64 `json:"latestUpdatedAt"`
	Total           int   `json:"total"`
}

type CommonInstanceConfig

type CommonInstanceConfig struct {
	MinCollectionInterval int      `json:"minCollectionInterval"` // This changes the collection interval of the check - default: 15
	EmptyDefaultHostname  bool     `json:"emptyDefaultHostname"`  // This forces the check to send metrics with no hostname. This is useful for cluster-level checks.
	Tags                  []string `json:"tags"`                  // A list of tags to attach to every metric and service check emitted by this instance, <key_1>:<value_1>
	Service               string   `json:"service"`               // Attach the tag `service:<SERVICE>` to every metric, event, and service check emitted by this integration.
	Name                  string   `json:"name"`                  //
	Namespace             string   `json:"namespace"`             //
}

CommonInstanceConfig holds the reserved fields for the yaml instance data

type ConfigFormat

type ConfigFormat struct {
	ADIdentifiers           []string      `json:"adIdentifiers"`
	ClusterCheck            bool          `json:"clusterCheck"`
	InitConfig              interface{}   `json:"initConfig"`
	MetricConfig            interface{}   `json:"jmxMetrics"`
	LogsConfig              interface{}   `json:"logs"`
	Instances               []interface{} `json:"instances"`
	IgnoreAutodiscoveryTags bool          `json:"ignoreAutodiscoveryTags"` // Use to ignore tags coming from autodiscovery
}

from pkg/autodiscovery/providers/file.go: configFormat format of collectRule.Data

func ParseConfigFormatJson

func ParseConfigFormatJson(data []byte) (*ConfigFormat, error)

func ParseConfigFormatYaml

func ParseConfigFormatYaml(data []byte) (*ConfigFormat, error)

Converts YAML to JSON then uses JSON to unmarshal into ConfigFormat

type Initializer

type Initializer interface {
	// Init performs one time setup of the plugin and returns an error if the
	// configuration is invalid.
	Init() error
}

Initializer is an interface that all plugin types: Inputs, Outputs, Processors, and Aggregators can optionally implement to initialize the plugin.

type Logger

type Logger interface {
	// Errorf logs an error message, patterned after log.Printf.
	Errorf(format string, args ...interface{})
	// Error logs an error message, patterned after log.Print.
	Error(args ...interface{})
	// Debugf logs a debug message, patterned after log.Printf.
	Debugf(format string, args ...interface{})
	// Debug logs a debug message, patterned after log.Print.
	Debug(args ...interface{})
	// Warnf logs a warning message, patterned after log.Printf.
	Warnf(format string, args ...interface{})
	// Warn logs a warning message, patterned after log.Print.
	Warn(args ...interface{})
	// Infof logs an information message, patterned after log.Printf.
	Infof(format string, args ...interface{})
	// Info logs an information message, patterned after log.Print.
	Info(args ...interface{})
}

Logger defines an plugin-related interface for logging.

type PluginDescriber

type PluginDescriber interface {
	// SampleConfig returns the default configuration of the Processor
	SampleConfig() string

	// Description returns a one-sentence description on the Processor
	Description() string
}

PluginDescriber contains the functions all plugins must implement to describe themselves to Telegraf. Note that all plugins may define a logger that is not part of the interface, but will receive an injected logger if it's set. eg: Log telegraf.Logger `toml:"-"`

type PortCollectFormat

type PortCollectFormat struct {
	InitConfig struct {
		Timeout int `json:"timeout"`
	} `json:"initConfig"`
	Instances []struct {
		CommonInstanceConfig
		Protocol string `json:"protocol" description:"udp or tcp"`
		Port     int    `json:"port"`
	} `json:"instances"`
}

type ScriptCollectFormat

type ScriptCollectFormat struct {
	InitConfig struct {
		Root    string `json:"root"`
		Env     string `json:"env"`
		Timeout int    `json:"timeout"`
	} `json:"initConfig"`
	Instances []struct {
		CommonInstanceConfig
		FilePath string `json:"filePath"`
		Root     string `json:"root"`
		Params   string `json:"params"`
		Env      string `json:"env"`
		Stdin    string `json:"stdin"`
		Timeout  int    `json:"timeout"`
	} `json:"instances"`
}

Jump to

Keyboard shortcuts

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