configs

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package configs 所有任务Config的基类文件

Package configs 该文件提供给tcp udp http script作为TaskConfig基类使用,其他的任务的TaskConfig基类已修改为base.go中的BaseTaskConfig

Index

Constants

View Source
const (
	DiskRO
	DiskSpace
	Core
	OOM
)
View Source
const (
	EncodingUTF8 = "utf-8"
	EncodingGBK  = "gbk"

	// 任务类型
	TaskTypeRawLog  = "raw_log"
	TaskTypeKeyword = "keyword"

	ConfigTypeKeyword = define.ModuleKeyword

	// 结果聚合发送方式
	OutputFormatEvent      = "event"
	DefaultRetainFileBytes = 1024 * 1024 // 1MB
)
View Source
const (
	DefaultTargetHost     string = "127.0.0.1"
	DefaultTargetPort     int    = 80
	DefaultResponseFormat string = "startswith"
)
View Source
const (
	ConfigTypeHTTP = define.ModuleHTTP
)
View Source
const (
	ConfigTypeKubeevent = "kubeevent"
)
View Source
const (
	ConfigTypeMetric = "metricbeat"
)

config类型定义

View Source
const (
	ConfigTypePing = define.ModulePing
)

config类型定义

View Source
const (
	ConfigTypeScript = define.ModuleScript
)
View Source
const (
	ConfigTypeStatic = define.ModuleStatic
)

config类型定义

View Source
const (
	ConfigTypeTCP = define.ModuleTCP
)
View Source
const (
	ConfigTypeTrap = define.ModuleTrap
)

config类型定义

View Source
const (
	ConfigTypeUDP = define.ModuleUDP
)
View Source
const (
	DefaultBufferSize int = 102400
)

默认的网络通信读写缓存长度

Variables

View Source
var DefaultBasereportConfig = BasereportConfig{
	Cpu: CpuConfig{
		StatTimes:     4,
		InfoPeriod:    1 * time.Minute,
		InfoTimeout:   30 * time.Second,
		ReportCpuFlag: false,
	},
	Disk: DiskConfig{
		StatTimes:           1,
		DiskWhiteList:       []*regexp.Regexp{},
		DiskBlackList:       []*regexp.Regexp{},
		PartitionWhiteList:  []*regexp.Regexp{},
		PartitionBlackList:  []*regexp.Regexp{},
		MountpointWhiteList: []*regexp.Regexp{},
		MountpointBlackList: []*regexp.Regexp{},
	},
	Mem: MemConfig{
		InfoTimes:     1,
		SpecialSource: false,
	},
	Net: NetConfig{
		StatTimes:           4,
		InterfaceWhiteList:  []*regexp.Regexp{},
		InterfaceBlackList:  []*regexp.Regexp{},
		RevertProtectNumber: 100,
	},
	ReportCrontab: false,
	ReportHosts:   false,
	ReportRoute:   false,
}
View Source
var DefaultExceptionBeatConfig = ExceptionBeatConfig{
	CheckBit:               0,
	CheckMethod:            "",
	CheckDisRoInterval:     time.Hour,
	CheckDiskSpaceInterval: time.Hour,
	CheckOutOfMemInterval:  time.Hour,
	OutOfMemReportGap:      time.Minute,
	DiskUsagePercent:       90,
	DiskMinFreeSpace:       10,
	CoreFileReportGap:      time.Minute,
	CoreFilePattern:        "",
}
View Source
var DisableNetlink bool // 是否禁用 netlink 禁用:true 不禁用 false,默认 false
View Source
var FastBasereportConfig = BasereportConfig{
	Cpu: CpuConfig{
		StatTimes:     1,
		StatPeriod:    1,
		InfoPeriod:    1 * time.Minute,
		InfoTimeout:   30 * time.Second,
		ReportCpuFlag: false,
	},
	Disk: DiskConfig{
		StatTimes:           1,
		StatPeriod:          1,
		DiskWhiteList:       []*regexp.Regexp{},
		DiskBlackList:       []*regexp.Regexp{},
		PartitionWhiteList:  []*regexp.Regexp{},
		PartitionBlackList:  []*regexp.Regexp{},
		MountpointWhiteList: []*regexp.Regexp{},
		MountpointBlackList: []*regexp.Regexp{},
	},
	Mem: MemConfig{
		InfoTimes:     1,
		InfoPeriod:    1,
		SpecialSource: false,
	},
	Net: NetConfig{
		StatTimes:           1,
		StatPeriod:          1,
		InterfaceWhiteList:  []*regexp.Regexp{},
		InterfaceBlackList:  []*regexp.Regexp{},
		RevertProtectNumber: 100,
	},
	ReportCrontab: false,
	ReportHosts:   false,
	ReportRoute:   false,
}

Functions

func EnsureProcsyncHash

func EnsureProcsyncHash(i int32) int32

func IsContainerMode

func IsContainerMode() bool

func IsProcsyncHash

func IsProcsyncHash(i int32) bool

func SetContainerMode

func SetContainerMode(v bool)

Types

type BaseTaskMetaParam

type BaseTaskMetaParam struct {
	DataID     int32         `config:"dataid" validate:"required"`
	MaxTimeout time.Duration `config:"max_timeout" validate:"min=1s"`
	MinPeriod  time.Duration `config:"min_period" validate:"min=1s"`
}

BaseTaskMetaParam : 基础组任务信息

func NewBaseTaskMetaParam

func NewBaseTaskMetaParam() BaseTaskMetaParam

NewBaseTaskMetaParam :

func (*BaseTaskMetaParam) CleanParams

func (c *BaseTaskMetaParam) CleanParams() error

CleanParams :

func (*BaseTaskMetaParam) CleanTask

func (c *BaseTaskMetaParam) CleanTask(task define.TaskConfig) error

CleanTask :

func (*BaseTaskMetaParam) GetDataID

func (c *BaseTaskMetaParam) GetDataID() int32

GetDataID :

type BaseTaskParam

type BaseTaskParam struct {
	Ident             string              `config:"ident,ignore"`
	DataID            int32               `config:"dataid"`
	BizID             int32               `config:"bk_biz_id"`
	TaskID            int32               `config:"task_id" validate:"required"`
	Timeout           time.Duration       `config:"timeout"`
	AvailableDuration time.Duration       `config:"available_duration"`
	Period            time.Duration       `config:"period" validate:"min=1s"`
	Labels            []map[string]string `config:"labels"`
	Tags              map[string]string   `config:"tags"`

	Sorted define.Tags
	// contains filtered or unexported fields
}

BaseTaskParam 任务基础信息,实现了TaskConfig中除Clean以外的所有接口,实现了CompositableConfig的CleanConfig接口,以便进行配置批量清洗操作

func NewBaseTaskParam

func NewBaseTaskParam() BaseTaskParam

NewBaseTaskParam :

func (*BaseTaskParam) CleanParams

func (t *BaseTaskParam) CleanParams() error

CleanParams CompositableParam接口,用于批量清洗

func (*BaseTaskParam) GetAvailableDuration

func (t *BaseTaskParam) GetAvailableDuration() time.Duration

GetAvailableDuration 获取可用区间

func (*BaseTaskParam) GetBizID

func (t *BaseTaskParam) GetBizID() int32

GetBizID 获取业务ID

func (*BaseTaskParam) GetDataID

func (t *BaseTaskParam) GetDataID() int32

GetDataID 获取用于上报数据的dataid

func (*BaseTaskParam) GetIdent

func (t *BaseTaskParam) GetIdent() string

GetIdent 获取任务实体标识

func (*BaseTaskParam) GetLabels

func (t *BaseTaskParam) GetLabels() []map[string]string

GetLabels 获取注入的标签

func (*BaseTaskParam) GetPeriod

func (t *BaseTaskParam) GetPeriod() time.Duration

GetPeriod 获取任务执行周期

func (*BaseTaskParam) GetTaskID

func (t *BaseTaskParam) GetTaskID() int32

GetTaskID 获取任务ID

func (*BaseTaskParam) GetTimeout

func (t *BaseTaskParam) GetTimeout() time.Duration

GetTimeout 获取任务超时时间

func (*BaseTaskParam) SetIdent

func (t *BaseTaskParam) SetIdent(ident string)

SetIdent :

type BasereportConfig

type BasereportConfig struct {
	BaseTaskParam `config:"_,inline"`
	TimeTolerate  int64 `config:"time_tolerate"`

	// module detail configs
	Cpu  CpuConfig  `config:"cpu"`
	Disk DiskConfig `config:"disk"`
	Mem  MemConfig  `config:"mem"`
	Net  NetConfig  `config:"net"`

	// 环境信息的上报开关
	ReportCrontab bool `config:"report_crontab"`
	ReportHosts   bool `config:"report_hosts"`
	ReportRoute   bool `config:"report_route"`
}

BasereportConfig

func NewBasereportConfig

func NewBasereportConfig(root *Config) *BasereportConfig

func (*BasereportConfig) Clean

func (c *BasereportConfig) Clean() error

func (*BasereportConfig) GetIdent

func (c *BasereportConfig) GetIdent() string

func (*BasereportConfig) GetTaskConfigList

func (c *BasereportConfig) GetTaskConfigList() []define.TaskConfig

func (*BasereportConfig) GetType

func (c *BasereportConfig) GetType() string

func (*BasereportConfig) InitIdent

func (c *BasereportConfig) InitIdent() error

type CheckMode

type CheckMode string

CheckMode 域名检测模式

const (
	// CheckModeAll 检测域名所有IP
	CheckModeAll CheckMode = "all"
	// CheckModeSingle 检测域名单个IP
	CheckModeSingle CheckMode = "single"
	// DefaultDNSCheckMode 默认域名检测模式
	DefaultDNSCheckMode = CheckModeSingle
)

func (*CheckMode) Unpack

func (c *CheckMode) Unpack(s string) error

Unpack 必须实现该接口方法,否则现有配置解析库解析该类型字段会panic

type ChildTaskConfig

type ChildTaskConfig struct {
	PreIdent string
	Version  string
	Name     string
	Type     string
}

ChildTaskConfig 额外封装一层子配置参数,用于计算ident,不实际应用到任务列表

type ChildTaskMetaConfig

type ChildTaskMetaConfig struct {
	define.TaskMetaConfig `config:"_,inline"`
	Version               string `config:"version"`
	Name                  string `config:"name"`
	Type                  string `config:"type"`
	Path                  string
}

ChildTaskMetaConfig 子任务config,在基础任务模板上添加子任务记录信息

func (*ChildTaskMetaConfig) Clean

func (c *ChildTaskMetaConfig) Clean() error

Clean :

type ConcurrencyLimitConfig

type ConcurrencyLimitConfig struct {
	Task map[string]*TaskConcurrencyLimitConfig `config:"task"`
}

ConcurrencyLimitConfig 并发限制配置

func (*ConcurrencyLimitConfig) Clean

func (cc *ConcurrencyLimitConfig) Clean()

Clean 初始化参数

type Config

type Config struct {
	TaskTypeMapping map[string]define.TaskMetaConfig `config:"_"`

	CheckInterval    time.Duration `config:"check_interval" validate:"positive"`
	CleanUpTimeout   time.Duration `config:"clean_up_timeout" validate:"min=1s"`
	EventBufferSize  int           `config:"event_buffer_size" validate:"positive"`
	Mode             string        `config:"mode" validate:"regexp=(daemon|check|cron)"`
	KeepOneDimension bool          `config:"keep_one_dimension"`
	MetricsBatchSize int           `config:"metrics_batch_size"`
	// 最大批次数,单个任务最大只能上报该批次*batch_size量级的数据
	MaxMetricBatches int    `config:"max_metric_batches"`
	AdminAddr        string `config:"admin_addr"`
	// 并发限制配置
	ConcurrencyLimit ConcurrencyLimitConfig `config:"concurrency_limit"`

	MetricbeatWorkers        int  `config:"metricbeat_workers"`
	MetricbeatSpreadWorkload bool `config:"metricbeat_spread_workload"`
	MetricbeatAlignTs        bool `config:"metricbeat_align_ts"`

	NodeID             string `config:"node_id" validate:"required"`
	IP                 string `config:"ip" validate:"nonzero"`
	BizID              int32  `config:"bk_biz_id" validate:"required"`
	CloudID            int32  `config:"bk_cloud_id" validate:"required"`
	HostIDPath         string `config:"host_id_path"`
	CmdbLevelMaxLength int    `config:"cmdb_level_max_length"`
	IgnoreCmdbLevel    bool   `config:"ignore_cmdb_level"`
	MustHostIDExist    bool   `config:"must_host_id_exist"`
	DisableNetLink     bool   `config:"disable_netlink"`

	TCPTask            *TCPTaskMetaConfig     `config:"tcp_task"`
	HeartBeat          *HeartBeatConfig       `config:"heart_beat"`
	GatherUpBeat       *GatherUpBeatConfig    `config:"gather_up_beat"`
	UDPTask            *UDPTaskMetaConfig     `config:"udp_task"`
	HTTPTask           *HTTPTaskMetaConfig    `config:"http_task"`
	ScriptTask         *ScriptTaskMetaConfig  `config:"script_task"`
	PingTask           *PingTaskMetaConfig    `config:"ping_task"`
	MetricTask         *MetricBeatMetaConfig  `config:"metricbeat_task"`
	KeywordTask        *KeywordTaskMetaConfig `config:"keyword_task"`
	TrapTask           *TrapMetaConfig        `config:"trap_task"`
	StaticTask         *StaticTaskMetaConfig  `config:"static_task"`
	BaseReportTask     *BasereportConfig      `config:"basereport_task"`
	ExceptionBeatTask  *ExceptionBeatConfig   `config:"exceptionbeat_task"`
	KubeeventTask      *KubeEventConfig       `config:"kubeevent_task"`
	ProcessBeatTask    *ProcessbeatConfig     `config:"processbeat_task"`
	ProcConfTask       *ProcConfig            `config:"procconf_task"`
	ProcCustomTask     *ProcCustomConfig      `config:"proccustom_task"`
	ProcSyncTask       *ProcSyncConfig        `config:"procsync_task"`
	ProcStatusTask     *ProcStatusConfig      `config:"procstatus_task"`
	LoginLogTask       *LoginLogConfig        `config:"loginlog_task"`
	ProcSnapshotTask   *ProcSnapshotConfig    `config:"procsnapshot_task"`
	ProcBinTask        *ProcBinConfig         `config:"procbin_task"`
	SocketSnapshotTask *SocketSnapshotConfig  `config:"socketsnapshot_task"`
	ShellHistoryTask   *ShellHistoryConfig    `config:"shellhistory_task"`
	RpmPackageTask     *RpmPackageConfig      `config:"rpmpackage_task"`
}

Config : global config

func NewConfig

func NewConfig() *Config

NewConfig : new config struct

func (*Config) Clean

func (c *Config) Clean() error

Clean :

func (*Config) GetGatherUpDataID

func (c *Config) GetGatherUpDataID() int32

func (*Config) GetTaskConfigList

func (c *Config) GetTaskConfigList() []define.TaskConfig

GetTaskConfigList :

func (*Config) GetTaskConfigListByType

func (c *Config) GetTaskConfigListByType(configType string) []define.TaskConfig

GetTaskConfigListByType :

func (*Config) GetTaskTypeMapping

func (c *Config) GetTaskTypeMapping() map[string]define.TaskMetaConfig

GetTaskTypeMapping :

type CpuConfig

type CpuConfig struct {
	// collector times in one period
	StatTimes   int           `config:"stat_times"`
	StatPeriod  time.Duration `config:",ignore"`
	InfoPeriod  time.Duration `config:"info_period"`
	InfoTimeout time.Duration `config:"info_timeout"`

	ReportCpuFlag bool `config:"report_flag"`
}

type DiskConfig

type DiskConfig struct {
	// collector times in one period
	StatTimes           int           `config:"stat_times"`
	StatPeriod          time.Duration `config:",ignore"`
	CollectAllDev       bool          `config:"collect_all_device"`
	DropDuplicateDevice bool          `config:"drop_duplicate_device"`
	IOSkipPartition     bool          `config:"io_skip_partition"`

	DiskWhiteListPattern       []string         `config:"disk_white_list"`
	DiskWhiteList              []*regexp.Regexp `config:",ignore"`
	DiskBlackListPattern       []string         `config:"disk_black_list"`
	DiskBlackList              []*regexp.Regexp `config:",ignore"`
	PartitionWhiteListPattern  []string         `config:"partition_white_list"`
	PartitionWhiteList         []*regexp.Regexp `config:",ignore"`
	PartitionBlackListPattern  []string         `config:"partition_black_list"`
	PartitionBlackList         []*regexp.Regexp `config:",ignore"`
	MountpointWhiteListPattern []string         `config:"mountpoint_white_list"`
	MountpointWhiteList        []*regexp.Regexp `config:",ignore"`
	MountpointBlackListPattern []string         `config:"mountpoint_black_list"`
	MountpointBlackList        []*regexp.Regexp `config:",ignore"`
	FSTypeBlackListPattern     []string         `config:"fs_type_black_list"`
	FSTypeBlackList            []*regexp.Regexp `config:",ignore"`
	FSTypeWhiteListPattern     []string         `config:"fs_type_white_list"`
	FSTypeWhiteList            []*regexp.Regexp `config:",ignore"`
}

type ExceptionBeatConfig

type ExceptionBeatConfig struct {
	BaseTaskParam `config:"_,inline"`

	CheckBit               int           `config:",ignore"`
	CheckMethod            string        `config:"check_bit"`
	CheckDisRoInterval     time.Duration `config:"check_disk_ro_interval"`
	CheckDiskSpaceInterval time.Duration `config:"check_disk_space_interval"`
	CheckOutOfMemInterval  time.Duration `config:"check_oom_interval"`
	OutOfMemReportGap      time.Duration `config:"oom_report_gap"`
	DiskUsagePercent       int           `config:"used_max_disk_space_percent"`
	DiskMinFreeSpace       int           `config:"free_min_disk_space"`
	DiskRoWhiteList        []string      `config:"disk_ro_white_list"`
	DiskRoBlackList        []string      `config:"disk_ro_black_list"`
	CoreFileReportGap      time.Duration `config:"corefile_report_gap"`
	CoreFilePattern        string        `config:"corefile_pattern"`
	CoreFileMatchRegex     string        `config:"corefile_match_regex"`
}

func NewExceptionBeatConfig

func NewExceptionBeatConfig(root *Config) *ExceptionBeatConfig

func (*ExceptionBeatConfig) Clean

func (c *ExceptionBeatConfig) Clean() error

func (*ExceptionBeatConfig) GetIdent

func (c *ExceptionBeatConfig) GetIdent() string

func (*ExceptionBeatConfig) GetTaskConfigList

func (c *ExceptionBeatConfig) GetTaskConfigList() []define.TaskConfig

func (*ExceptionBeatConfig) GetType

func (c *ExceptionBeatConfig) GetType() string

func (*ExceptionBeatConfig) InitIdent

func (c *ExceptionBeatConfig) InitIdent() error

type GatherUpBeatConfig

type GatherUpBeatConfig struct {
	DataID int32 `config:"dataid"`
}

func NewGatherUpBeatConfig

func NewGatherUpBeatConfig() *GatherUpBeatConfig

type HTTPTaskConfig

type HTTPTaskConfig struct {
	NetTaskParam       `config:"_,inline"`
	Proxy              string                `config:"proxy"`
	InsecureSkipVerify bool                  `config:"insecure_skip_verify"`
	Steps              []*HTTPTaskStepConfig `config:"steps"`
}

HTTPTaskConfig :

func NewHTTPTaskConfig

func NewHTTPTaskConfig() *HTTPTaskConfig

NewHTTPTaskConfig :

func (*HTTPTaskConfig) Clean

func (c *HTTPTaskConfig) Clean() error

Clean :

func (*HTTPTaskConfig) GetType

func (c *HTTPTaskConfig) GetType() string

GetType :

func (*HTTPTaskConfig) InitIdent

func (c *HTTPTaskConfig) InitIdent() error

InitIdent :

type HTTPTaskMetaConfig

type HTTPTaskMetaConfig struct {
	NetTaskMetaParam `config:"_,inline"`

	Tasks []*HTTPTaskConfig `config:"tasks"`
}

HTTPTaskMetaConfig :

func NewHTTPTaskMetaConfig

func NewHTTPTaskMetaConfig(root *Config) *HTTPTaskMetaConfig

NewHTTPTaskMetaConfig :

func (*HTTPTaskMetaConfig) Clean

func (c *HTTPTaskMetaConfig) Clean() error

Clean :

func (*HTTPTaskMetaConfig) GetTaskConfigList

func (c *HTTPTaskMetaConfig) GetTaskConfigList() []define.TaskConfig

GetTaskConfigList :

type HTTPTaskStepConfig

type HTTPTaskStepConfig struct {
	SimpleMatchParam `config:"_,inline"`

	URL              string            `config:"url"`
	URLList          []string          `config:"url_list"`
	Method           string            `config:"method"`
	Headers          map[string]string `config:"headers"`
	ResponseCode     string            `config:"response_code"`
	ResponseCodeList []int             `config:"response_code_list"`
}

HTTPTaskStepConfig :

func (*HTTPTaskStepConfig) Clean

func (c *HTTPTaskStepConfig) Clean() error

Clean :

func (*HTTPTaskStepConfig) URLs

func (c *HTTPTaskStepConfig) URLs() []string

type HeartBeatConfig

type HeartBeatConfig struct {
	// bkmonitorbeeat下的心跳data id配置
	GlobalDataID int32 `config:"global_dataid" `
	ChildDataID  int32 `config:"child_dataid"`
	// uptimecheckbeat下的心跳data id配置,缺少子任务的data_id
	DataID             int32         `config:"dataid"`
	Period             time.Duration `config:"period" validate:"min=1s"`
	PublishImmediately bool          `config:"publish_immediately"`
}

HeartBeatConfig : 心跳配置,该配置是供bkmonitorbeat及uptimecheckbeat共同使用

func NewHeartBeatConfig

func NewHeartBeatConfig() *HeartBeatConfig

NewHeartBeatConfig :

type IPType

type IPType int32
const (
	IPAuto IPType = 0
	IPv4   IPType = 4
	IPv6   IPType = 6
)

type KeywordConfig

type KeywordConfig struct {
	Name    string `config:"name"`    // 匹配规则名
	Pattern string `config:"pattern"` // 正则匹配规则
}

日志关键字匹配规则配置

type KeywordTaskConfig

type KeywordTaskConfig struct {
	BaseTaskParam `config:"_,inline"`
	DataID        int `config:"dataid"` // 上报数据ID
	// Type           string          `config:"type"`           // 任务类型
	Paths         []string      `config:"paths"`          // 采集的文件路径
	ExcludeFiles  []string      `config:"exclude_files"`  // 需要过滤的文件列表,正则表示
	Encoding      string        `config:"encoding"`       // 文件编码类型
	ScanSleep     time.Duration `config:"scan_sleep"`     // 文件扫描休眠时间,用于减少CPU负载,默认1us
	CloseInactive time.Duration `config:"close_inactive"` // 文件未更新需要关闭的超时等待
	// Delimiter      string          `config:"delimiter"`      // 行文件的分隔符
	ReportPeriod    time.Duration   `config:"report_period"`   // 上报周期
	FilterPatterns  []string        `config:"filter_patterns"` // 过滤规则
	KeywordConfigs  []KeywordConfig `config:"keywords"`        // 日志关键字匹配规则
	OutputFormat    string          `config:"output_format"`   // 结果输出格式
	Target          string          `config:"target"`          // 采集目标
	TimeUnit        string          `config:"time_unit"`       // 上报时间单位,默认是ms
	Label           []Label         `config:"labels"`
	RetainFileBytes int64           `config:"retain_file_bytes"` // 保留前置文件的尾部数据
}

func (*KeywordTaskConfig) Clean

func (c *KeywordTaskConfig) Clean() error

func (*KeywordTaskConfig) GetType

func (c *KeywordTaskConfig) GetType() string

func (*KeywordTaskConfig) InitIdent

func (c *KeywordTaskConfig) InitIdent() error

type KeywordTaskMetaConfig

type KeywordTaskMetaConfig struct {
	BaseTaskMetaParam `config:"_,inline"`

	Tasks []*KeywordTaskConfig `config:"tasks"`
}

KeywordTaskMetaConfig

func NewKeywordTaskMetaConfig

func NewKeywordTaskMetaConfig(root *Config) *KeywordTaskMetaConfig

NewKeywordTaskMetaConfig :

func (*KeywordTaskMetaConfig) Clean

func (c *KeywordTaskMetaConfig) Clean() error

func (*KeywordTaskMetaConfig) GetTaskConfigList

func (c *KeywordTaskMetaConfig) GetTaskConfigList() []define.TaskConfig

type KubeEventConfig

type KubeEventConfig struct {
	BaseTaskParam `config:"_,inline"`

	EventSpan       time.Duration `config:"event_span"`
	Interval        time.Duration `config:"interval"`
	TailFiles       []string      `config:"tail_files"`
	UpMetricsDataID int32         `config:"upmetrics_dataid"` // 自监控 dataid
}

func NewKubeEventConfig

func NewKubeEventConfig(root *Config) *KubeEventConfig

func (*KubeEventConfig) Clean

func (c *KubeEventConfig) Clean() error

func (*KubeEventConfig) GetTaskConfigList

func (c *KubeEventConfig) GetTaskConfigList() []define.TaskConfig

func (*KubeEventConfig) GetType

func (c *KubeEventConfig) GetType() string

func (*KubeEventConfig) InitIdent

func (c *KubeEventConfig) InitIdent() error

type Label

type Label struct {
	BkCollectConfigID         string `config:"bk_collect_config_id"`
	BkTargetCloudID           string `config:"bk_target_cloud_id"`
	BkTargetIP                string `config:"bk_target_ip"`
	BKTargetServiceCategoryID string `config:"bk_target_service_category_id"`
	BKTargetServiceInstanceID string `config:"bk_target_service_instance_id"`
	BkTargetTopoID            string `config:"bk_target_topo_id"`
	BkTargetTopoLevel         string `config:"bk_target_topo_level"`
}

采集下发来源配置说明

func (*Label) AsMapStr

func (l *Label) AsMapStr() common.MapStr

func (*Label) Id

func (l *Label) Id() string

func (*Label) IsHostDynamicTopoNode

func (l *Label) IsHostDynamicTopoNode() bool

是否为按主机,动态节点下发的Label

func (*Label) IsHostStaticIp

func (l *Label) IsHostStaticIp() bool

是否按静态主机下发的Label

func (*Label) IsServiceInstance

func (l *Label) IsServiceInstance() bool

是否为按服务实例下发的Label

type LoginLogConfig

type LoginLogConfig struct {
	BaseTaskParam `config:"_,inline"`
}

func NewLoginLogConfig

func NewLoginLogConfig(root *Config) *LoginLogConfig

func (*LoginLogConfig) Clean

func (c *LoginLogConfig) Clean() error

func (*LoginLogConfig) GetIdent

func (c *LoginLogConfig) GetIdent() string

func (*LoginLogConfig) GetTaskConfigList

func (c *LoginLogConfig) GetTaskConfigList() []define.TaskConfig

func (*LoginLogConfig) GetType

func (c *LoginLogConfig) GetType() string

func (*LoginLogConfig) InitIdent

func (c *LoginLogConfig) InitIdent() error

type MemConfig

type MemConfig struct {
	// collector times in one period
	InfoTimes     int           `config:"info_times"`
	InfoPeriod    time.Duration `config:",ignore"`
	SpecialSource bool          `config:"special_source"`
}

type MetricBeatConfig

type MetricBeatConfig struct {
	BaseTaskParam `config:"_,inline"`

	Module *common.Config `config:"module"`
	// 是否使用自定义指标格式上报
	CustomReport bool `config:"custom_report"`

	Workers        int
	SpreadWorkload bool
	EnableAlignTs  bool
}

MetricBeatConfig :

func NewMetricBeatConfig

func NewMetricBeatConfig() *MetricBeatConfig

NewMetricBeatConfig :

func (*MetricBeatConfig) Clean

func (c *MetricBeatConfig) Clean() error

Clean :

func (*MetricBeatConfig) GetType

func (c *MetricBeatConfig) GetType() string

GetType :

func (*MetricBeatConfig) InitIdent

func (c *MetricBeatConfig) InitIdent() error

InitIdent 覆盖BaseTaskParam的同名方法,因为metricbeat直接调用原方法会panic

type MetricBeatMetaConfig

type MetricBeatMetaConfig struct {
	BaseTaskMetaParam `config:"_,inline"`

	Tasks []*MetricBeatConfig `config:"tasks"`
}

MetricBeatMetaConfig : associate task config

func NewMetricBeatMetaConfig

func NewMetricBeatMetaConfig(root *Config) *MetricBeatMetaConfig

NewMetricBeatMetaConfig :

func (*MetricBeatMetaConfig) Clean

func (c *MetricBeatMetaConfig) Clean() error

Clean :

func (*MetricBeatMetaConfig) GetTaskConfigList

func (c *MetricBeatMetaConfig) GetTaskConfigList() []define.TaskConfig

GetTaskConfigList :

type ModulesConfig

type ModulesConfig struct {
	Task   BaseTaskParam
	Module string // 将modules序列化成json后存储
}

ModulesConfig modules结构体,只用于获取ident过程

type NetConfig

type NetConfig struct {
	// collector times in one period
	StatTimes            int           `config:"stat_times"`
	StatPeriod           time.Duration `config:",ignore"`
	SkipVirtualInterface bool          `config:"skip_virtual_interface"`
	RevertProtectNumber  uint64        `config:"revert_protect_number"`

	ForceReportList           []*regexp.Regexp `config:",ignore"`
	ForceReportListPattern    []string         `config:"force_report_list"`
	InterfaceWhiteListPattern []string         `config:"interface_white_list"`
	InterfaceWhiteList        []*regexp.Regexp `config:",ignore"`
	InterfaceBlackListPattern []string         `config:"interface_black_list"`
	InterfaceBlackList        []*regexp.Regexp `config:",ignore"`
}

type NetTaskMetaParam

type NetTaskMetaParam struct {
	BaseTaskMetaParam `config:"_,inline"`
	MaxBufferSize     int    `config:"max_buffer_size" validate:"positive"`
	TaskConfigPath    string `config:"config_path"`
}

NetTaskMetaParam : task parameter

func NewNetTaskMetaParam

func NewNetTaskMetaParam() NetTaskMetaParam

NewNetTaskMetaParam :

func (*NetTaskMetaParam) CleanParams

func (c *NetTaskMetaParam) CleanParams() error

CleanParams :

func (*NetTaskMetaParam) CleanTask

func (c *NetTaskMetaParam) CleanTask(task define.TaskConfig) error

CleanTask 覆盖了BaseTaskMetaParam的CleanTask逻辑,因为增加了buffersize

func (*NetTaskMetaParam) GetDataID

func (c *NetTaskMetaParam) GetDataID() int32

GetDataID :

type NetTaskParam

type NetTaskParam struct {
	BaseTaskParam `config:"_,inline"`
	BufferSize    int    `config:"buffer_size" validate:"positive"`
	TargetIPType  IPType `config:"target_ip_type"`
	// 域名检测模式
	DNSCheckMode CheckMode `config:"dns_check_mode"`
}

NetTaskParam : tcp task parameter

func (*NetTaskParam) CleanParams

func (t *NetTaskParam) CleanParams() error

CleanParams :

func (*NetTaskParam) GetAvailableDuration

func (t *NetTaskParam) GetAvailableDuration() time.Duration

GetAvailableDuration :

func (*NetTaskParam) GetBizID

func (t *NetTaskParam) GetBizID() int32

GetBizID :

func (*NetTaskParam) GetDataID

func (t *NetTaskParam) GetDataID() int32

GetDataID :

func (*NetTaskParam) GetIdent

func (t *NetTaskParam) GetIdent() string

GetIdent :

func (*NetTaskParam) GetLabels

func (t *NetTaskParam) GetLabels() []map[string]string

GetLabels :

func (*NetTaskParam) GetPeriod

func (t *NetTaskParam) GetPeriod() time.Duration

GetPeriod :

func (*NetTaskParam) GetTaskID

func (t *NetTaskParam) GetTaskID() int32

GetTaskID :

func (*NetTaskParam) GetTimeout

func (t *NetTaskParam) GetTimeout() time.Duration

GetTimeout :

type PingTaskConfig

type PingTaskConfig struct {
	BaseTaskParam `config:"_,inline"`
	TargetIPType  IPType `config:"target_ip_type"`
	// 域名检测模式
	DNSCheckMode CheckMode `config:"dns_check_mode"`
	Targets      []*Target `config:"targets"`
	MaxRTT       string    `config:"max_rtt"`
	BatchSize    int       `config:"batch_size"`
	TotalNum     int       `config:"total_num"`
	PingSize     int       `config:"ping_size"`
}

PingTaskConfig :

func NewPingTaskConfig

func NewPingTaskConfig() *PingTaskConfig

NewPingTaskConfig :

func (*PingTaskConfig) Clean

func (c *PingTaskConfig) Clean() error

Clean :

func (*PingTaskConfig) GetType

func (c *PingTaskConfig) GetType() string

GetType :

func (*PingTaskConfig) InitIdent

func (c *PingTaskConfig) InitIdent() error

InitIdent :

type PingTaskMetaConfig

type PingTaskMetaConfig struct {
	BaseTaskMetaParam `config:"_,inline"`

	Tasks []*PingTaskConfig `config:"tasks"`
}

PingTaskMetaConfig : associate task config

func NewPingTaskMetaConfig

func NewPingTaskMetaConfig(root *Config) *PingTaskMetaConfig

NewPingTaskMetaConfig :

func (*PingTaskMetaConfig) Clean

func (c *PingTaskMetaConfig) Clean() error

Clean :

func (*PingTaskMetaConfig) GetTaskConfigList

func (c *PingTaskMetaConfig) GetTaskConfigList() []define.TaskConfig

GetTaskConfigList :

type ProcBinConfig

type ProcBinConfig struct {
	BaseTaskParam `config:"_,inline"`
	MaxBytes      int64 `config:"max_bytes"`
}

func NewProcBinConfig

func NewProcBinConfig(root *Config) *ProcBinConfig

func (*ProcBinConfig) Clean

func (c *ProcBinConfig) Clean() error

func (*ProcBinConfig) GetIdent

func (c *ProcBinConfig) GetIdent() string

func (*ProcBinConfig) GetTaskConfigList

func (c *ProcBinConfig) GetTaskConfigList() []define.TaskConfig

func (*ProcBinConfig) GetType

func (c *ProcBinConfig) GetType() string

func (*ProcBinConfig) InitIdent

func (c *ProcBinConfig) InitIdent() error

type ProcConfig

type ProcConfig struct {
	BaseTaskParam `config:"_,inline" yaml:"-"`
	TaskID        int32         `config:"task_id" yaml:"task_id"`
	Period        time.Duration `config:"period" yaml:"period"`
	PortDataId    int32         `config:"portdataid" yaml:"portdataid"`
	TopDataId     int32         `config:"topdataid" yaml:"topdataid"`
	PerfDataId    int32         `config:"perfdataid" yaml:"perfdataid"`
	ConvergePID   bool          `config:"converge_pid" yaml:"converge_pid"`
	HostFilePath  string        `config:"hostfilepath" yaml:"hostfilepath"`
	DstDir        string        `config:"dst_dir" yaml:"dst_dir"`
}

func NewProcConf

func NewProcConf(root *Config) *ProcConfig

func (*ProcConfig) Clean

func (c *ProcConfig) Clean() error

func (*ProcConfig) GetIdent

func (c *ProcConfig) GetIdent() string

func (*ProcConfig) GetPeriod

func (c *ProcConfig) GetPeriod() time.Duration

func (*ProcConfig) GetTaskConfigList

func (c *ProcConfig) GetTaskConfigList() []define.TaskConfig

func (*ProcConfig) GetType

func (c *ProcConfig) GetType() string

func (*ProcConfig) InitIdent

func (c *ProcConfig) InitIdent() error

type ProcCustomConfig

type ProcCustomConfig struct {
	BaseTaskParam        `config:"_,inline"`
	PortDataID           int      `config:"port_dataid"`
	MatchPattern         string   `config:"match_pattern"`   // 匹配正则,只做匹配工作,不提取维度
	ProcessName          string   `config:"process_name"`    // 进程名匹配规则,作为多进程时的区分维度
	DimPattern           string   `config:"extract_pattern"` // 额外维度提取正则,只提取维度,不做匹配工作
	ExcludePattern       string   `config:"exclude_pattern"` // 除外正则,匹配该正则的进程被除外不上报
	PIDPath              string   `config:"pid_path"`
	ProcMetric           []string `config:"proc_metric"`
	PortDetect           bool     `config:"port_detect"`
	Ports                []string `config:"ports"`
	ListenPortOnly       bool     `config:"listen_port_only"`       // 只采集监听端口
	ReportUnexpectedPort bool     `config:"report_unexpected_port"` // 如果配置了指定端口,是否对额外端口信息进行上报
	DisableMapping       bool     `config:"disable_mapping"`        // 不进行 pid 映射
	// contains filtered or unexported fields
}

func NewProcCustomConfig

func NewProcCustomConfig(root *Config) *ProcCustomConfig

func (*ProcCustomConfig) Clean

func (c *ProcCustomConfig) Clean() error

func (*ProcCustomConfig) EnablePerfCollected

func (c *ProcCustomConfig) EnablePerfCollected() bool

func (*ProcCustomConfig) EnablePortCollected

func (c *ProcCustomConfig) EnablePortCollected() bool

func (*ProcCustomConfig) ExtractDimensions

func (c *ProcCustomConfig) ExtractDimensions(name string) map[string]string

func (*ProcCustomConfig) ExtractProcessName

func (c *ProcCustomConfig) ExtractProcessName(name string) string

func (*ProcCustomConfig) GetPeriod

func (c *ProcCustomConfig) GetPeriod() time.Duration

func (*ProcCustomConfig) GetTaskConfigList

func (c *ProcCustomConfig) GetTaskConfigList() []define.TaskConfig

func (*ProcCustomConfig) GetType

func (c *ProcCustomConfig) GetType() string

func (*ProcCustomConfig) InitIdent

func (c *ProcCustomConfig) InitIdent() error

func (*ProcCustomConfig) Match

func (c *ProcCustomConfig) Match(procs []define.ProcStat) []define.ProcStat

func (*ProcCustomConfig) Setup

func (c *ProcCustomConfig) Setup()

type ProcSnapshotConfig

type ProcSnapshotConfig struct {
	BaseTaskParam `config:"_,inline"`
}

func NewProcSnapshotConfig

func NewProcSnapshotConfig(root *Config) *ProcSnapshotConfig

func (*ProcSnapshotConfig) Clean

func (c *ProcSnapshotConfig) Clean() error

func (*ProcSnapshotConfig) GetIdent

func (c *ProcSnapshotConfig) GetIdent() string

func (*ProcSnapshotConfig) GetTaskConfigList

func (c *ProcSnapshotConfig) GetTaskConfigList() []define.TaskConfig

func (*ProcSnapshotConfig) GetType

func (c *ProcSnapshotConfig) GetType() string

func (*ProcSnapshotConfig) InitIdent

func (c *ProcSnapshotConfig) InitIdent() error

type ProcStatusConfig

type ProcStatusConfig struct {
	BaseTaskParam `config:"_,inline"`
	ReportPeriod  time.Duration `config:"report_period" validate:"min=1s"` // 上报周期
}

func NewProcStatusConfig

func NewProcStatusConfig(root *Config) *ProcStatusConfig

func (*ProcStatusConfig) Clean

func (p *ProcStatusConfig) Clean() error

func (*ProcStatusConfig) GetTaskConfigList

func (p *ProcStatusConfig) GetTaskConfigList() []define.TaskConfig

func (*ProcStatusConfig) GetType

func (p *ProcStatusConfig) GetType() string

func (*ProcStatusConfig) InitIdent

func (p *ProcStatusConfig) InitIdent() error

type ProcSyncConfig

type ProcSyncConfig struct {
	BaseTaskParam `config:"_,inline"`
	TaskID        int32  `config:"task_id"`
	DstDir        string `config:"dst_dir"`
}

func NewProcSyncConfig

func NewProcSyncConfig(root *Config) *ProcSyncConfig

func (*ProcSyncConfig) Clean

func (c *ProcSyncConfig) Clean() error

func (*ProcSyncConfig) GetIdent

func (c *ProcSyncConfig) GetIdent() string

func (*ProcSyncConfig) GetPeriod

func (c *ProcSyncConfig) GetPeriod() time.Duration

func (*ProcSyncConfig) GetTaskConfigList

func (c *ProcSyncConfig) GetTaskConfigList() []define.TaskConfig

func (*ProcSyncConfig) GetType

func (c *ProcSyncConfig) GetType() string

func (*ProcSyncConfig) InitIdent

func (c *ProcSyncConfig) InitIdent() error

type ProcessbeatBindInfo

type ProcessbeatBindInfo struct {
	IP       string   `config:"ip" yaml:"ip"`
	Ports    []uint16 `config:"ports" yaml:"ports"`
	Protocol string   `config:"protocol" yaml:"protocol"`
}

type ProcessbeatConfig

type ProcessbeatConfig struct {
	BaseTaskParam        `config:"_,inline" yaml:"-"`
	Type                 string                  `config:"type" yaml:"type"`
	Name                 string                  `config:"name" yaml:"name"`
	TaskId               int32                   `config:"task_id" yaml:"task_id"`
	Version              string                  `config:"version" yaml:"version"`
	PortDataId           int32                   `config:"portdataid" yaml:"portdataid"`
	TopDataId            int32                   `config:"topdataid" yaml:"topdataid"`
	PerfDataId           int32                   `config:"perfdataid" yaml:"perfdataid"`
	Period               time.Duration           `config:"period" yaml:"period"`
	HostFilePath         string                  `config:"hostfilepath" yaml:"hostfilepath"`
	Processes            []ProcessbeatPortConfig `config:"processes" yaml:"processes"`
	CmdbLevelMaxLength   int                     `config:"cmdb_level_max_length" yaml:"cmdb_level_max_length"`
	IgnoreCmdbLevel      bool                    `config:"ignore_cmdb_level" yaml:"ignore_cmdb_level"`
	MustHostIDExist      bool                    `config:"must_host_id_exist" yaml:"must_host_id_exist"`
	MonitorCollectorPath string                  `config:"monitor_collector_path" yaml:"monitor_collector_path"`
	ConvergePID          bool                    `config:"converge_pid" yaml:"converge_pid"`
	MaxNoListenPorts     int                     `config:"max_nolisten_ports" yaml:"max_nolisten_ports"`
	// contains filtered or unexported fields
}

func NewProcessbeatConfig

func NewProcessbeatConfig(root *Config) *ProcessbeatConfig

func (*ProcessbeatConfig) Clean

func (c *ProcessbeatConfig) Clean() error

func (*ProcessbeatConfig) EnablePerfCollected

func (c *ProcessbeatConfig) EnablePerfCollected() bool

func (*ProcessbeatConfig) EnablePortCollected

func (c *ProcessbeatConfig) EnablePortCollected() bool

func (*ProcessbeatConfig) EnableTopCollected

func (c *ProcessbeatConfig) EnableTopCollected() bool

func (*ProcessbeatConfig) GetConfigByID

func (c *ProcessbeatConfig) GetConfigByID(id string) ProcessbeatPortConfig

func (*ProcessbeatConfig) GetPeriod

func (c *ProcessbeatConfig) GetPeriod() time.Duration

func (*ProcessbeatConfig) GetTaskConfigList

func (c *ProcessbeatConfig) GetTaskConfigList() []define.TaskConfig

func (*ProcessbeatConfig) GetType

func (c *ProcessbeatConfig) GetType() string

func (*ProcessbeatConfig) InitIdent

func (c *ProcessbeatConfig) InitIdent() error

func (*ProcessbeatConfig) MatchNames

func (c *ProcessbeatConfig) MatchNames(proc common.MapStr) map[string]struct{}

MatchNames 分析进程的信息,将进程的启动 exe 名等提取为 map,方便后面判断使用

func (*ProcessbeatConfig) MatchNotExists

func (c *ProcessbeatConfig) MatchNotExists(exists map[string]struct{}) []ProcessbeatPortConfig

func (*ProcessbeatConfig) MatchRegex

func (c *ProcessbeatConfig) MatchRegex(names map[string]struct{}, param string) []ProcessbeatPortConfig

MatchRegex 匹配进程的信息和参数是否一致 names: key 为进程的不同信息,包括: exe/exe 的 base name/cmdline 的 base name 等,具体参考 MatchNames 函数 param: 具体匹配进程的参数信息

func (*ProcessbeatConfig) Setup

func (c *ProcessbeatConfig) Setup()

type ProcessbeatPortConfig

type ProcessbeatPortConfig struct {
	Name         string                `config:"name" yaml:"name"`
	DisplayName  string                `config:"displayname" yaml:"displayname"`
	Protocol     string                `config:"protocol" yaml:"protocol"`
	Ports        []uint16              `config:"ports" yaml:"ports"`
	ParamRegex   string                `config:"paramregex" yaml:"paramregex"`
	BindIP       string                `config:"bindip" yaml:"bindip"`
	BindInfoList []ProcessbeatBindInfo `config:"bind_info" yaml:"bind_info"`
}

func (ProcessbeatPortConfig) GetBindDetailed

func (c ProcessbeatPortConfig) GetBindDetailed() []ProcessbeatBindInfo

func (ProcessbeatPortConfig) ID

type ProtocolType

type ProtocolType int32
const (
	Http ProtocolType = 0
	Tcp  ProtocolType = 1
	Udp  ProtocolType = 2
	Icmp ProtocolType = 2
)

type RpmPackageConfig

type RpmPackageConfig struct {
	BaseTaskParam   `config:"_,inline"`
	BlockWriteBytes int `config:"block_write_bytes"`
	BlockReadBytes  int `config:"block_read_bytes"`
	BlockWriteIOps  int `config:"block_write_iops"`
	BlockReadIOps   int `config:"block_read_iops"`
}

func NewRpmPackageConfig

func NewRpmPackageConfig(root *Config) *RpmPackageConfig

func (*RpmPackageConfig) Clean

func (c *RpmPackageConfig) Clean() error

func (*RpmPackageConfig) GetIdent

func (c *RpmPackageConfig) GetIdent() string

func (*RpmPackageConfig) GetTaskConfigList

func (c *RpmPackageConfig) GetTaskConfigList() []define.TaskConfig

func (*RpmPackageConfig) GetType

func (c *RpmPackageConfig) GetType() string

func (*RpmPackageConfig) InitIdent

func (c *RpmPackageConfig) InitIdent() error

type ScriptTaskConfig

type ScriptTaskConfig struct {
	BaseTaskParam `config:"_,inline"`
	Command       string            `config:"command"`
	TimestampUnit string            `config:"timestamp_unit"`
	UserEnvs      map[string]string `config:"user_env"`
	TimeOffset    time.Duration     `config:"time_offset"`
}

ScriptTaskConfig :

func NewScriptTaskConfig

func NewScriptTaskConfig() *ScriptTaskConfig

NewScriptTaskConfig :

func (*ScriptTaskConfig) Clean

func (c *ScriptTaskConfig) Clean() error

Clean :

func (*ScriptTaskConfig) GetType

func (c *ScriptTaskConfig) GetType() string

GetType :

func (*ScriptTaskConfig) InitIdent

func (c *ScriptTaskConfig) InitIdent() error

InitIdent :

type ScriptTaskMetaConfig

type ScriptTaskMetaConfig struct {
	BaseTaskMetaParam `config:"_,inline"`
	TaskConfigPath    string              `config:"config_path"`
	Tasks             []*ScriptTaskConfig `config:"tasks"`
}

ScriptTaskMetaConfig : tcp task config

func NewScriptTaskMetaConfig

func NewScriptTaskMetaConfig(root *Config) *ScriptTaskMetaConfig

NewScriptTaskMetaConfig :

func (*ScriptTaskMetaConfig) Clean

func (c *ScriptTaskMetaConfig) Clean() error

Clean :

func (*ScriptTaskMetaConfig) GetTaskConfigList

func (c *ScriptTaskMetaConfig) GetTaskConfigList() []define.TaskConfig

GetTaskConfigList :

type ShellHistoryConfig

type ShellHistoryConfig struct {
	BaseTaskParam `config:"_,inline"`
	LastBytes     int64    `config:"last_bytes"`
	HistoryFiles  []string `config:"history_files"`
}

func NewShellHistoryConfig

func NewShellHistoryConfig(root *Config) *ShellHistoryConfig

func (*ShellHistoryConfig) Clean

func (c *ShellHistoryConfig) Clean() error

func (*ShellHistoryConfig) GetIdent

func (c *ShellHistoryConfig) GetIdent() string

func (*ShellHistoryConfig) GetTaskConfigList

func (c *ShellHistoryConfig) GetTaskConfigList() []define.TaskConfig

func (*ShellHistoryConfig) GetType

func (c *ShellHistoryConfig) GetType() string

func (*ShellHistoryConfig) InitIdent

func (c *ShellHistoryConfig) InitIdent() error

type SimpleMatchParam

type SimpleMatchParam struct {
	Request       string `config:"request"`
	RequestFormat string `config:"request_format" validate:"regexp=^(raw|hex)?$"`
	Response      string `config:"response"`
	// 支持匹配函数:reg, eq, nq, startswith, nstartswith, endswith, nendswith, in, nin, wildcard
	// 支持数据格式:raw, hex
	// ResponseFormat: $format|$function 比如 raw|ng / raw|in / hex|nin
	ResponseFormat string `config:"response_format"`
}

SimpleMatchParam :

func (*SimpleMatchParam) CleanParams

func (c *SimpleMatchParam) CleanParams() error

CleanParams :

type SimpleTaskParam

type SimpleTaskParam struct {
	TargetHost string `config:"target_host"`
	// 支持多个目标,当配置多个目标时忽略单个目标配置
	TargetHostList []string `config:"target_host_list"`
	TargetPort     int      `config:"target_port" validate:"required,min=1"`
}

SimpleTaskParam :

func (*SimpleTaskParam) CleanParams

func (c *SimpleTaskParam) CleanParams() error

CleanParams :

func (*SimpleTaskParam) Hosts

func (c *SimpleTaskParam) Hosts() []string

type SocketSnapshotConfig

type SocketSnapshotConfig struct {
	BaseTaskParam `config:"_,inline"`
	Detector      string `config:"detector"`
}

func NewSocketSnapshotConfig

func NewSocketSnapshotConfig(root *Config) *SocketSnapshotConfig

func (*SocketSnapshotConfig) Clean

func (c *SocketSnapshotConfig) Clean() error

func (*SocketSnapshotConfig) GetIdent

func (c *SocketSnapshotConfig) GetIdent() string

func (*SocketSnapshotConfig) GetTaskConfigList

func (c *SocketSnapshotConfig) GetTaskConfigList() []define.TaskConfig

func (*SocketSnapshotConfig) GetType

func (c *SocketSnapshotConfig) GetType() string

func (*SocketSnapshotConfig) InitIdent

func (c *SocketSnapshotConfig) InitIdent() error

type StaticTaskConfig

type StaticTaskConfig struct {
	BaseTaskParam         `config:"_,inline"`
	CheckPeriod           time.Duration `config:"check_period"`
	ReportPeriod          time.Duration `config:"report_period"`
	VirtualIfaceWhitelist []string      `config:"virtual_iface_whitelist"`
}

StaticTaskConfig :

func NewStaticTaskConfig

func NewStaticTaskConfig() *StaticTaskConfig

NewStaticTaskConfig :

func (*StaticTaskConfig) Clean

func (c *StaticTaskConfig) Clean() error

Clean :

func (*StaticTaskConfig) GetType

func (c *StaticTaskConfig) GetType() string

GetType :

func (*StaticTaskConfig) InitIdent

func (c *StaticTaskConfig) InitIdent() error

InitIdent :

type StaticTaskMetaConfig

type StaticTaskMetaConfig struct {
	BaseTaskMetaParam `config:"_,inline"`

	Tasks []*StaticTaskConfig `config:"tasks"`
}

StaticTaskMetaConfig : associate task config

func NewStaticTaskMetaConfig

func NewStaticTaskMetaConfig(root *Config) *StaticTaskMetaConfig

NewStaticTaskMetaConfig :

func (*StaticTaskMetaConfig) Clean

func (c *StaticTaskMetaConfig) Clean() error

Clean :

func (*StaticTaskMetaConfig) GetTaskConfigList

func (c *StaticTaskMetaConfig) GetTaskConfigList() []define.TaskConfig

GetTaskConfigList :

type TCPTaskConfig

type TCPTaskConfig struct {
	NetTaskParam     `config:"_,inline"`
	SimpleMatchParam `config:"_,inline"`
	SimpleTaskParam  `config:"_,inline"`
}

TCPTaskConfig :

func NewTCPTaskConfig

func NewTCPTaskConfig() *TCPTaskConfig

NewTCPTaskConfig :

func (*TCPTaskConfig) Clean

func (c *TCPTaskConfig) Clean() error

Clean :

func (*TCPTaskConfig) GetType

func (c *TCPTaskConfig) GetType() string

GetType :

func (*TCPTaskConfig) InitIdent

func (c *TCPTaskConfig) InitIdent() error

InitIdent :

type TCPTaskMetaConfig

type TCPTaskMetaConfig struct {
	NetTaskMetaParam `config:"_,inline"`

	Tasks []*TCPTaskConfig `config:"tasks"`
}

TCPTaskMetaConfig : tcp task config

func NewTCPTaskMetaConfig

func NewTCPTaskMetaConfig(root *Config) *TCPTaskMetaConfig

NewTCPTaskMetaConfig :

func (*TCPTaskMetaConfig) Clean

func (c *TCPTaskMetaConfig) Clean() error

Clean :

func (*TCPTaskMetaConfig) GetTaskConfigList

func (c *TCPTaskMetaConfig) GetTaskConfigList() []define.TaskConfig

GetTaskConfigList :

type Target

type Target struct {
	Target     string `config:"target"`
	TargetType string `config:"target_type"`
}

Target ping目标信息

func (*Target) GetTarget

func (t *Target) GetTarget() string

GetTarget :

func (*Target) GetTargetType

func (t *Target) GetTargetType() string

GetTargetType :

type TaskConcurrencyLimitConfig

type TaskConcurrencyLimitConfig struct {
	PerInstanceLimit int64 `config:"per_instance"` // 全局限制
	PerTaskLimit     int64 `config:"per_task"`     // 单任务限制
}

TaskConcurrencyLimitConfig 任务并发限制配置

func (*TaskConcurrencyLimitConfig) Clean

func (tcc *TaskConcurrencyLimitConfig) Clean()

Clean 初始化参数

type TrapConfig

type TrapConfig struct {
	BaseTaskParam   `config:"_,inline"`
	IP              string        `config:"listen_ip"`
	Port            int           `config:"listen_port"`
	Version         string        `config:"snmp_version"`
	Community       string        `config:"community"`
	IsAggregate     bool          `config:"aggregate"`
	Concurrency     int           `config:"concurrency"`
	AggregatePeriod time.Duration `config:"aggregate_period"`

	// oid翻译字典
	OIDS map[string]string `config:"oids"`

	// 用户指定的需要作为维度上报的oid
	ReportOIDDimensions []string `config:"report_oid_dimensions"`
	// 用户指定的value不需要解析为字符的oid
	RawByteOIDs []string `config:"raw_byte_oids"`
	Target      string   `config:"target"`
	Label       []Label  `config:"labels"`
	// v3参数
	UsmInfos []UsmInfo `config:"usm_info"`
	// oids排序拼成string 用于hash
	Tags define.Tags

	// 翻译oid value时若是中文,则可能需要该配置
	Encode string `config:"encode"`
	// 是否将oid维度转换为翻译后的英文名再上报
	UseDisplayNameOID bool `config:"use_display_name_oid"`
	// 是否关闭agent_port维度上报,该维度可以看作是一个无意义随机值
	HideAgentPort bool `config:"hide_agent_port"`
}

TrapConfig :

func NewTrapConfig

func NewTrapConfig() *TrapConfig

NewTrapConfig :

func (*TrapConfig) Clean

func (c *TrapConfig) Clean() error

Clean :

func (*TrapConfig) GetType

func (c *TrapConfig) GetType() string

GetType :

func (*TrapConfig) InitIdent

func (c *TrapConfig) InitIdent() error

InitIdent :

type TrapMetaConfig

type TrapMetaConfig struct {
	BaseTaskMetaParam `config:"_,inline"`

	Tasks []*TrapConfig `config:"tasks"`
}

TrapMetaConfig : associate task config

func NewTrapMetaConfig

func NewTrapMetaConfig(root *Config) *TrapMetaConfig

NewTrapMetaConfig :

func (*TrapMetaConfig) Clean

func (c *TrapMetaConfig) Clean() error

Clean :

func (*TrapMetaConfig) GetTaskConfigList

func (c *TrapMetaConfig) GetTaskConfigList() []define.TaskConfig

GetTaskConfigList :

type UDPTaskConfig

type UDPTaskConfig struct {
	NetTaskParam      `config:"_,inline"`
	SimpleMatchParam  `config:"_,inline"`
	SimpleTaskParam   `config:"_,inline"`
	Times             int  `config:"times" validate:"min=1"`
	WaitEmptyResponse bool `config:"wait_empty_response"`
}

UDPTaskConfig :

func NewUDPTaskConfig

func NewUDPTaskConfig() *UDPTaskConfig

NewUDPTaskConfig :

func (*UDPTaskConfig) Clean

func (c *UDPTaskConfig) Clean() error

Clean :

func (*UDPTaskConfig) GetType

func (c *UDPTaskConfig) GetType() string

GetType :

func (*UDPTaskConfig) InitIdent

func (c *UDPTaskConfig) InitIdent() error

InitIdent :

type UDPTaskMetaConfig

type UDPTaskMetaConfig struct {
	NetTaskMetaParam `config:"_,inline"`
	MaxTimes         int `config:"max_times" validate:"min=1"`

	Tasks []*UDPTaskConfig `config:"tasks"`
}

UDPTaskMetaConfig : udp task config

func NewUDPTaskMetaConfig

func NewUDPTaskMetaConfig(root *Config) *UDPTaskMetaConfig

NewUDPTaskMetaConfig :

func (*UDPTaskMetaConfig) Clean

func (c *UDPTaskMetaConfig) Clean() error

Clean :

func (*UDPTaskMetaConfig) GetTaskConfigList

func (c *UDPTaskMetaConfig) GetTaskConfigList() []define.TaskConfig

GetTaskConfigList :

type USMConfig

type USMConfig struct {
	UserName                 string `config:"username"`
	AuthenticationProtocol   string `config:"authentication_protocol"`
	AuthenticationPassphrase string `config:"authentication_passphrase"`
	PrivacyProtocol          string `config:"privacy_protocol"`
	PrivacyPassphrase        string `config:"privacy_passphrase"`
	AuthoritativeEngineBoots uint32 `config:"authoritative_engineboots"`
	AuthoritativeEngineTime  uint32 `config:"authoritative_enginetime"`
	AuthoritativeEngineID    string `config:"authoritative_engineID"`
}

USMConfig snmp usm参数

type UsmInfo

type UsmInfo struct {
	MsgFlags    string    `config:"msg_flags"`
	ContextName string    `config:"context_name"`
	USMConfig   USMConfig `config:"usm_config"`
}

usmInfo 多用户参数

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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