cconf

package
v6.7.3 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const EVENT_EXAMPLE = `` /* 1429-byte string literal not displayed */

Variables

View Source
var Operations = Operation{}
View Source
var Plugins = []Plugin{
	{
		Id:       1,
		Category: "timeseries",
		Type:     "prometheus",
		TypeName: "Prometheus Like",
	},
	{
		Id:       2,
		Category: "logging",
		Type:     "elasticsearch",
		TypeName: "Elasticsearch",
	},
	{
		Id:       3,
		Category: "loki",
		Type:     "loki",
		TypeName: "Loki",
	},
	{
		Id:       4,
		Category: "timeseries",
		Type:     "tdengine",
		TypeName: "TDengine",
	},
}
View Source
var TDengineSQLTpl = map[string]string{
	"load5":                "SELECT _wstart as ts, last(load5) FROM $database.system WHERE host = '$server' and _ts >= $from and _ts <= $to interval($interval) fill(null)",
	"process_total":        "SELECT _wstart as ts, last(total) FROM $database.processes WHERE host = '$server' and _ts >= $from and _ts <= $to interval($interval) fill(null)",
	"thread_total":         "SELECT _wstart as ts, last(total) FROM $database.threads WHERE host = '$server' and _ts >= $from and _ts <= $to interval($interval) fill(null)",
	"cpu_idle":             "SELECT _wstart as ts, last(usage_idle) * -1 + 100 FROM $database.cpu WHERE (host = '$server' and cpu = 'cpu-total') and _ts >= $from and _ts <= $to interval($interval) fill(null)",
	"mem_used_percent":     "SELECT _wstart as ts, last(used_percent) FROM $database.mem WHERE (host = '$server') and _ts >= $from and _ts <= $to interval($interval) fill(null)",
	"disk_used_percent":    "SELECT _wstart as ts, last(used_percent) FROM $database.disk WHERE (host = '$server' and path = '/') and _ts >= $from and _ts <= $to interval($interval) fill(null)",
	"cpu_context_switches": "select ts, derivative(context_switches, 1s, 0) as context FROM (SELECT _wstart as ts, avg(context_switches) as context_switches FROM $database.kernel WHERE host = '$server' and _ts >= $from and _ts <= $to interval($interval) )",
	"tcp":                  "SELECT _wstart as ts, avg(tcp_close) as CLOSED, avg(tcp_close_wait) as CLOSE_WAIT, avg(tcp_closing) as CLOSING, avg(tcp_established) as ESTABLISHED, avg(tcp_fin_wait1) as FIN_WAIT1, avg(tcp_fin_wait2) as FIN_WAIT2, avg(tcp_last_ack) as LAST_ACK, avg(tcp_syn_recv) as SYN_RECV, avg(tcp_syn_sent) as SYN_SENT, avg(tcp_time_wait) as TIME_WAIT FROM $database.netstat WHERE host = '$server' and _ts >= $from and _ts <= $to interval($interval)",
	"net_bytes_recv":       "SELECT _wstart as ts, derivative(bytes_recv,1s, 1) as bytes_in FROM $database.net WHERE host = '$server' and interface = '$netif' and _ts >= $from and _ts <= $to group by tbname",
	"net_bytes_sent":       "SELECT _wstart as ts, derivative(bytes_sent,1s, 1) as bytes_out FROM $database.net WHERE host = '$server' and interface = '$netif' and _ts >= $from and _ts <= $to group by tbname",
	"disk_total":           "SELECT _wstart as ts, avg(total) AS total, avg(used) as used FROM $database.disk WHERE   path = '$mountpoint' and _ts >= $from and _ts <= $to  interval($interval) group by host",
}

Functions

func GetAllOps

func GetAllOps(ops []Ops) []string

func GetMetricDesc

func GetMetricDesc(lang, metric string) string

GetMetricDesc , if metric is not registered, empty string will be returned

func LoadMetricsYaml

func LoadMetricsYaml(configDir, metricsYamlFile string) error

func LoadOpsYaml

func LoadOpsYaml(configDir string, opsYamlFile string) error

func MergeOperationConf added in v6.3.0

func MergeOperationConf() error

Types

type AnonymousAccess

type AnonymousAccess struct {
	PromQuerier bool
	AlertDetail bool
}

type Center

type Center struct {
	Plugins                []Plugin
	MetricsYamlFile        string
	OpsYamlFile            string
	BuiltinIntegrationsDir string
	I18NHeaderKey          string
	MetricDesc             MetricDescType
	AnonymousAccess        AnonymousAccess
	UseFileAssets          bool
}

func (*Center) PreCheck

func (c *Center) PreCheck()

type MetricDescType

type MetricDescType struct {
	CommonDesc map[string]string `yaml:",inline" json:"common"`
	Zh         map[string]string `yaml:"zh" json:"zh"`
	En         map[string]string `yaml:"en" json:"en"`
}

metricDesc , As load map happens before read map, there is no necessary to use concurrent map for metric desc store

var MetricDesc MetricDescType

type Operation

type Operation struct {
	Ops []Ops `yaml:"ops"`
}

type Ops

type Ops struct {
	Name  string   `yaml:"name" json:"name"`
	Cname string   `yaml:"cname" json:"cname"`
	Ops   []string `yaml:"ops" json:"ops"`
}

type Plugin

type Plugin struct {
	Id       int64  `json:"id"`
	Category string `json:"category"`
	Type     string `json:"plugin_type"`
	TypeName string `json:"plugin_type_name"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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