googlecloud

package
v0.0.0-...-5655933 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 15 Imported by: 0

README

GCP 指标获取插件

需要权限

https://www.googleapis.com/auth/monitoring.read

配置

#采集周期,建议 >= 1分钟
interval=60
[[instances]]
#配置 project_id
project_id="your-project-id"
#配置认证的key文件
credentials_file="/path/to/your/key.json"
#或者配置认证的JSON
credentials_json="xxx"

# 指标的end time = now - delay
#delay="2m"
# 指标的start time = now - deley - period
#period="1m"
# 过滤器
#filter="metric.type=\"compute.googleapis.com/instance/cpu/utilization\" AND resource.labels.zone=\"asia-northeast1-a\""
# 请求超时时间
#timeout="5s"
# 指标列表的缓存时长 ,filter为空时 启用
#cache_ttl="1h"

# 给gce的instance_name 取个别名,放到label中
#gce_host_tag="xxx"
# 每次最多有多少请求同时发起
#request_inflight=30

# request_inflight 取值(0,100]
# 想配置更大的值 ,前提是你知道你在做什么
force_request_inflight= 200

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoogleCloud

type GoogleCloud struct {
	config.PluginConfig
	Instances []*Instance `toml:"instances"`
}

func (*GoogleCloud) Clone

func (g *GoogleCloud) Clone() inputs.Input

func (*GoogleCloud) Drop

func (c *GoogleCloud) Drop()

func (*GoogleCloud) GetInstances

func (c *GoogleCloud) GetInstances() []inputs.Instance

func (*GoogleCloud) Name

func (c *GoogleCloud) Name() string

type GoogleCloudConfig

type GoogleCloudConfig struct {
	Version   string `toml:"version"`
	ProjectID string `toml:"project_id"`

	CredentialsFile string `toml:"credentials_file"`
	CredentialsJSON string `toml:"credentials_json"`
}

type Instance

type Instance struct {
	config.InstanceConfig

	GoogleCloudConfig

	// metric instance_name type
	// resource: type instance_id project_id zone
	Filter string `toml:"filter"`

	Period  config.Duration `toml:"period"`
	Delay   config.Duration `toml:"delay"`
	Timeout config.Duration `toml:"timeout"`

	CacheTTL config.Duration `toml:"cache_ttl"`

	UnmaskProjectID bool `toml:"-"`

	GceHostTag string `toml:"gce_host_tag"`

	RequestInflight      int `toml:"request_inflight"`
	ForceRequestInflight int `toml:"force_request_inflight"`
	// contains filtered or unexported fields
}

func (*Instance) Drop

func (ins *Instance) Drop()

func (*Instance) Gather

func (ins *Instance) Gather(slist *types.SampleList)

func (*Instance) Init

func (ins *Instance) Init() error

func (*Instance) ListMetrics

func (ins *Instance) ListMetrics() ([]string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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