stra

package
v0.0.0-...-b6b44b4 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const PATTERN_EXCLUDE_PARTITION = "```EXCLUDE```"

Variables

View Source
var Collect model.Collect

Functions

func DeepCopyStringMap

func DeepCopyStringMap(p map[string]string) map[string]string

func GetCollects

func GetCollects()

func GetCollectsRetry

func GetCollectsRetry() (model.Collect, error)

func GetPatAndTimeFormat

func GetPatAndTimeFormat(tf string) (string, string)

func GetPortCollects

func GetPortCollects() map[int]*model.PortCollect

func GetProcCollects

func GetProcCollects() map[string]*model.ProcCollect

func Init

func Init(stra StraSection)

func NewPortCollect

func NewPortCollect(port, step int, tags string, modTime time.Time) *model.PortCollect

func NewProcCollect

func NewProcCollect(method, name, tags string, step int, modTime time.Time) *model.ProcCollect

Types

type CollectResp

type CollectResp struct {
	Dat model.Collect `json:"dat"`
	Err string        `json:"err"`
}

type StraSection

type StraSection struct {
	Enable   bool   `yaml:"enable"`
	Interval int    `yaml:"interval"`
	Api      string `yaml:"api"`
	Timeout  int    `yaml:"timeout"`
	PortPath string `yaml:"portPath"`
	ProcPath string `yaml:"procPath"`
	LogPath  string `yaml:"logPath"`
}
var StraConfig StraSection

type Strategy

type Strategy struct {
	ID              int64                     `json:"id"`
	Name            string                    `json:"name"`        //监控策略名
	FilePath        string                    `json:"file_path"`   //文件路径
	TimeFormat      string                    `json:"time_format"` //时间格式
	Pattern         string                    `json:"pattern"`     //表达式
	Exclude         string                    `json:"-"`
	MeasurementType string                    `json:"measurement_type"`
	Interval        int64                     `json:"interval"` //采集周期
	Tags            map[string]string         `json:"tags"`
	Func            string                    `json:"func"` //采集方式(max/min/avg/cnt)
	Degree          int64                     `json:"degree"`
	Unit            string                    `json:"unit"`
	Comment         string                    `json:"comment"`
	Creator         string                    `json:"creator"`
	SrvUpdated      string                    `json:"updated"`
	LocalUpdated    int64                     `json:"-"`
	TimeReg         *regexp.Regexp            `json:"-"`
	PatternReg      *regexp.Regexp            `json:"-"`
	ExcludeReg      *regexp.Regexp            `json:"-"`
	TagRegs         map[string]*regexp.Regexp `json:"-"`
	ParseSucc       bool                      `json:"parse_succ"`
}

func GetCollectFromFile

func GetCollectFromFile(logPath string) []*Strategy

func GetLogCollects

func GetLogCollects() []*Strategy

func ToStrategy

func ToStrategy(p *model.LogCollect) *Strategy

Jump to

Keyboard shortcuts

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