promConf

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfReload

func ConfReload(promURL string) error

ConfReload 使prometheus配置生效

Types

type ConfigYaml

type ConfigYaml struct {
	Data []byte // yaml文件内容
}

ConfigYaml 切分后只有一个deployment资源定义yaml文件

func NewConfigYaml

func NewConfigYaml(data []byte) *ConfigYaml

NewConfigYaml 实例化

func (*ConfigYaml) AddJob

func (c *ConfigYaml) AddJob(jobData []byte) error

AddJob 添加job静态配置,支持yaml、json数据格式

func (*ConfigYaml) AddJobLabels

func (c *ConfigYaml) AddJobLabels(jobName string, addLabels map[string]string) error

AddJobLabels 添加新的job label

func (*ConfigYaml) AddJobTargets

func (c *ConfigYaml) AddJobTargets(jobName string, addTargets []string) error

AddJobTargets 添加新的job target

func (*ConfigYaml) DelJob

func (c *ConfigYaml) DelJob(jobName string) error

DelJob 删除job静态配置

func (*ConfigYaml) DelJobLabels

func (c *ConfigYaml) DelJobLabels(jobName string, delLabelKeys []string) error

DelJobLabels 删除已存在的label

func (*ConfigYaml) DelJobTargets

func (c *ConfigYaml) DelJobTargets(jobName string, delTargets []string) error

DelJobTargets 删除已存在的job target

func (*ConfigYaml) GetJob

func (c *ConfigYaml) GetJob(jobName string) ([]byte, error)

GetJob 获取job静态配置

func (*ConfigYaml) GetJobLabels

func (c *ConfigYaml) GetJobLabels(jobName string) (map[string]string, error)

GetJobLabels 获取job标签

func (*ConfigYaml) GetJobTargets

func (c *ConfigYaml) GetJobTargets(jobName string) ([]string, error)

GetJobTargets 获取job target

func (*ConfigYaml) Persistent

func (c *ConfigYaml) Persistent(file string) error

Persistent 持久化

func (*ConfigYaml) ReplaceJobLabels

func (c *ConfigYaml) ReplaceJobLabels(jobName string, newLabels map[string]string) error

ReplaceJobLabels 修改label,注:直接替换所有旧值

func (*ConfigYaml) ReplaceJobTargets

func (c *ConfigYaml) ReplaceJobTargets(jobName string, newTargets []string) error

ReplaceJobTargets 修改job target,注:直接替换所有旧值

type JobConfig

type JobConfig struct {
	JobName        string          `json:"job_name"`
	ScrapeInterval string          `json:"scrape_interval,omitempty"`
	ScrapeTimeout  string          `json:"scrape_timeout,omitempty"`
	MetricsPath    string          `json:"metrics_path,omitempty"`
	Scheme         string          `json:"scheme,omitempty"`
	StaticConfigs  []StaticConfigs `json:"static_configs"`
}

JobConfig job配置

func (*JobConfig) CheckValid

func (j *JobConfig) CheckValid() error

CheckValid 检查服务器是否可以连接

type StaticConfigs

type StaticConfigs struct {
	Targets []string    `json:"targets"`
	Labels  interface{} `json:"labels,omitempty"`
}

StaticConfigs 静态配置

Jump to

Keyboard shortcuts

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