config

package
v0.0.0-...-af621d7 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

*

  • Copyright 2017 ~ 2025 the original author or authors. *
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.

*

  • Copyright 2017 ~ 2025 the original author or authors[983708408@qq.com]. *
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.

*

  • Copyright 2017 ~ 2025 the original author or authors[983708408@qq.com]. *
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.

*

  • Copyright 2017 ~ 2025 the original author or authors[983708408@qq.com]. *
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.

*

  • Copyright 2017 ~ 2025 the original author or authors. *
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.

*

  • Copyright 2017 ~ 2025 the original author or authors[983708408@qq.com]. *
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.

Index

Constants

View Source
const (
	// Used for metric filtering checks.
	// See: ./pkg/indicators/metric_builder.go#NewMetric()
	IndicatorFiledName = "Indicator"
)
View Source
const (
	// Used for metric filtering checks.
	// See: ./pkg/indicators/metric_builder.go#NewMetric()
	MetricExcludeFieldName = "MetricExclude"
)

Variables

This section is empty.

Functions

func Fill

func Fill(v interface{}) error

func GetConfig

func GetConfig(path ...interface{}) jsoniter.Any

Get config value.

func IgnorePrefix

func IgnorePrefix()

func InitGlobalConfig

func InitGlobalConfig(path string)

Init global config properties.

func RefreshConfig

func RefreshConfig(config *GlobalProperties)

Refresh global config.

Types

type CassandraIndicatorProperties

type CassandraIndicatorProperties struct {
	Enabled       bool          `yaml:"enabled"`
	Delay         time.Duration `yaml:"delay"`
	MetricExclude string        `yaml:"metric-exclude"`
}

Indicator Cassandra properties.

type Config

type Config struct {
	App     string
	Port    int      `default:"8000"`
	IsDebug bool     `env:"DEBUG"`
	Hosts   []string `slice_sep:","`

	Redis struct {
		Version string `sep:""` // no sep between `CONFIG` and `REDIS`
		Host    string
		Port    int
	}

	MySQL struct {
		Version string `default:"5.7"`
		Host    string
		Port    int
	}
}

type ConsulIndicatorProperties

type ConsulIndicatorProperties struct {
	Enabled       bool          `yaml:"enabled"`
	Delay         time.Duration `yaml:"delay"`
	MetricExclude string        `yaml:"metric-exclude"`
}

Indicator consul properties.

type DockerIndicatorProperties

type DockerIndicatorProperties struct {
	Enabled       bool          `yaml:"enabled"`
	Delay         time.Duration `yaml:"delay"`
	MetricExclude string        `yaml:"metric-exclude"`
}

Indicator docker properties.

type ElasticSearchIndicatorProperties

type ElasticSearchIndicatorProperties struct {
	Enabled       bool          `yaml:"enabled"`
	Delay         time.Duration `yaml:"delay"`
	MetricExclude string        `yaml:"metric-exclude"`
}

Indicator elastic-search properties.

type EmqIndicatorProperties

type EmqIndicatorProperties struct {
	Enabled       bool          `yaml:"enabled"`
	Delay         time.Duration `yaml:"delay"`
	MetricExclude string        `yaml:"metric-exclude"`
}

Indicator emq properties.

type Env

type Env struct {
	// contains filtered or unexported fields
}

func (*Env) Fill

func (e *Env) Fill(v interface{}) error

type EtcdIndicatorProperties

type EtcdIndicatorProperties struct {
	Enabled       bool          `yaml:"enabled"`
	Delay         time.Duration `yaml:"delay"`
	MetricExclude string        `yaml:"metric-exclude"`
}

Indicator etcd properties.

type GlobalProperties

type GlobalProperties struct {
	Logging   LoggingProperties   `yaml:"logging"`
	Transport TransportProperties `yaml:"transport"`
	Indicator IndicatorProperties `yaml:"indicator"`
}

--------------------- Global properties ---------------------

var (
	// Global config.
	GlobalConfig GlobalProperties

	// Local hardware addr ID.
	LocalHardwareAddrId = ""
)

type HttpTransportProperties

type HttpTransportProperties struct {
	ServerGateway string `yaml:"server-gateway"`
}

type IndicatorProperties

type IndicatorProperties struct {
	Namespace     string                           `yaml:"namespace"`
	Netcard       string                           `yaml:"netcard"`
	Physical      PhysicalIndicatorProperties      `yaml:"host"`
	Docker        DockerIndicatorProperties        `yaml:"docker"`
	Mesos         MesosIndicatorProperties         `yaml:"mesos"`
	Zookeeper     ZookeeperIndicatorProperties     `yaml:"zookeeper"`
	Etcd          EtcdIndicatorProperties          `yaml:"etcd"`
	Consul        ConsulIndicatorProperties        `yaml:"consul"`
	Kafka         KafkaIndicatorProperties         `yaml:"kafka"`
	Emq           EmqIndicatorProperties           `yaml:"emq"`
	RabbitMQ      RabbitMQIndicatorProperties      `yaml:"rabbitmq"`
	RocketMQ      RocketMQIndicatorProperties      `yaml:"rocketmq"`
	Redis         RedisIndicatorProperties         `yaml:"redis"`
	Memcached     MemcachedIndicatorProperties     `yaml:"memcached"`
	ElasticSearch ElasticSearchIndicatorProperties `yaml:"elasticsearch"`
	Mongodb       MongodbIndicatorProperties       `yaml:"mongodb"`
	MySQL         MySQLIndicatorProperties         `yaml:"mysql"`
	PostgreSQL    PostgreSQLIndicatorProperties    `yaml:"postgresql"`
	OpenTSDB      OpenTSDBIndicatorProperties      `yaml:"opentsdb"`
	Cassandra     CassandraIndicatorProperties     `yaml:"cassandra"`
}

type KafkaIndicatorProperties

type KafkaIndicatorProperties struct {
	Enabled                  bool          `yaml:"enabled"`
	Delay                    time.Duration `yaml:"delay"`
	Servers                  string        `yaml:"servers"`
	UseSASL                  bool          `yaml:"useSASL"`
	UseSASLHandshake         bool          `yaml:"useSASLHandshake"`
	SaslUsername             string        `yaml:"saslUsername"`
	SaslPassword             string        `yaml:"saslPassword"`
	UseTLS                   bool          `yaml:"useTLS"`
	TlsCAFile                string        `yaml:"tlsCAFile"`
	TlsCertFile              string        `yaml:"tlsCertFile"`
	TlsKeyFile               string        `yaml:"tlsKeyFile"`
	TlsInsecureSkipTLSVerify bool          `yaml:"tlsInsecureSkipTLSVerify"`
	KafkaVersion             string        `yaml:"kafkaVersion"`
	UseZooKeeperLag          bool          `yaml:"useZooKeeperLag"`
	UriZookeeper             []string      `yaml:"uriZookeeper"`
	Labels                   string        `yaml:"labels"`
	MetadataRefreshInterval  string        `yaml:"metadataRefreshInterval"`
	MetricExclude            string        `yaml:"metric-exclude"`
}

Indicator kafka properties.

type KafkaTransportProperties

type KafkaTransportProperties struct {
	Enabled      bool          `yaml:"enabled"`
	Servers      string        `yaml:"servers"`
	Ack          int16         `yaml:"ack"`
	Timeout      time.Duration `yaml:"timeout"`
	MetricTopic  string        `yaml:"metric-topic"`
	ReceiveTopic string        `yaml:"receive-topic"`
}

type LogItemProperties

type LogItemProperties struct {
	FileName string           `yaml:"file"`
	Level    string           `yaml:"level"`
	Policy   PolicyProperties `yaml:"policy"`
}

LogItem properties.

type LoggingProperties

type LoggingProperties struct {
	LogItems map[string]LogItemProperties `yaml:"log-items"`
}

Multi log properties.

type MemcachedIndicatorProperties

type MemcachedIndicatorProperties struct {
	Enabled       bool          `yaml:"enabled"`
	Delay         time.Duration `yaml:"delay"`
	MetricExclude string        `yaml:"metric-exclude"`
}

Indicator memcached properties.

type MesosIndicatorProperties

type MesosIndicatorProperties struct {
	Enabled       bool          `yaml:"enabled"`
	Delay         time.Duration `yaml:"delay"`
	MetricExclude string        `yaml:"metric-exclude"`
}

Indicator mesos properties.

type MongodbIndicatorProperties

type MongodbIndicatorProperties struct {
	Enabled       bool          `yaml:"enabled"`
	Delay         time.Duration `yaml:"delay"`
	MetricExclude string        `yaml:"metric-exclude"`
}

Indicator Mongodb properties.

type MySQLIndicatorProperties

type MySQLIndicatorProperties struct {
	Enabled       bool          `yaml:"enabled"`
	Delay         time.Duration `yaml:"delay"`
	MetricExclude string        `yaml:"metric-exclude"`
}

Indicator MySQL properties.

type OpenTSDBIndicatorProperties

type OpenTSDBIndicatorProperties struct {
	Enabled       bool          `yaml:"enabled"`
	Delay         time.Duration `yaml:"delay"`
	MetricExclude string        `yaml:"metric-exclude"`
}

Indicator OpenTSDB properties.

type PhysicalIndicatorProperties

type PhysicalIndicatorProperties struct {
	Enabled       bool          `yaml:"enabled"`
	Delay         time.Duration `yaml:"delay"`
	NetPorts      string        `yaml:"range-port"`
	MetricExclude string        `yaml:"metric-exclude"`
}

Indicator host properties.

type PolicyProperties

type PolicyProperties struct {
	RetentionDays int `yaml:"retention-days"`
	MaxBackups    int `yaml:"max-backups"`
	MaxSize       int `yaml:"max-size"`
}

Logging archive policy.

type PostgreSQLIndicatorProperties

type PostgreSQLIndicatorProperties struct {
	Enabled       bool          `yaml:"enabled"`
	Delay         time.Duration `yaml:"delay"`
	MetricExclude string        `yaml:"metric-exclude"`
}

Indicator PostgreSQL properties.

type RabbitMQIndicatorProperties

type RabbitMQIndicatorProperties struct {
	Enabled       bool          `yaml:"enabled"`
	Delay         time.Duration `yaml:"delay"`
	MetricExclude string        `yaml:"metric-exclude"`
}

Indicator rabbitMQ properties.

type RedisIndicatorProperties

type RedisIndicatorProperties struct {
	Enabled       bool          `yaml:"enabled"`
	Delay         time.Duration `yaml:"delay"`
	Servers       string        `yaml:"servers"`
	Password      string        `yaml:"password"`
	MetricExclude string        `yaml:"metric-exclude"`
}

Indicator redis properties.

type RocketMQIndicatorProperties

type RocketMQIndicatorProperties struct {
	Enabled       bool          `yaml:"enabled"`
	Delay         time.Duration `yaml:"delay"`
	MetricExclude string        `yaml:"metric-exclude"`
}

Indicator rocketMQ properties.

type TransportProperties

type TransportProperties struct {
	Http  HttpTransportProperties  `yaml:"http"`
	Kafka KafkaTransportProperties `yaml:"kafka"`
}

type ZookeeperIndicatorProperties

type ZookeeperIndicatorProperties struct {
	Enabled       bool          `yaml:"enabled"`
	Delay         time.Duration `yaml:"delay"`
	Servers       string        `yaml:"servers"`
	Command       string        `yaml:"command"`
	MetricExclude string        `yaml:"metric-exclude"`
}

Indicator zookeeper properties.

Jump to

Keyboard shortcuts

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