config

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

Package config defines the configuration and configuration helper methods for agent

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfigFile

func LoadConfigFile(base string, target interface{}) error

LoadConfigFile will attempt to load json|toml|yaml configuration files. `base` is the full path and base name of the configuration file to load. `target` is an interface in to which the data will be loaded. Checks for '<base>.json', '<base>.toml', and '<base>.yaml'.

func ShowConfig

func ShowConfig(w io.Writer) error

ShowConfig prints the running configuration

func StatConfig

func StatConfig() error

StatConfig adds the running config to the app stats

func Validate

func Validate() error

Validate verifies the required portions of the configuration

Types

type API

type API struct {
	App    string `json:"app" toml:"app" yaml:"app"`
	CAFile string `mapstructure:"ca_file" json:"ca_file" toml:"ca_file" yaml:"ca_file"`
	Debug  bool   `json:"debug" toml:"debug" yaml:"debug"`
	Key    string `json:"key" toml:"key" yaml:"key"`
	URL    string `json:"url" toml:"url" yaml:"url"`
}

API defines the circonus api configuration options

type Check

type Check struct {
	BrokerCID     string `mapstructure:"broker_cid" json:"broker_cid" toml:"broker_cid" yaml:"broker_cid"`
	BrokerCAFile  string `mapstructure:"broker_ca_file" json:"broker_ca_file" toml:"broker_ca_file" yaml:"broker_ca_file"`
	BundleCID     string `mapstructure:"bundle_cid" json:"bundle_cid" toml:"bundle_cid" yaml:"bundle_cid"`
	Create        bool   `mapstructure:"create" json:"create" toml:"create" yaml:"create" `
	MetricFilters string `mapstructure:"metric_filters" json:"metric_filters" toml:"metric_filters" yaml:"metric_filters"` // needs to be json embedded in a string because rules are positional
	Tags          string `json:"tags" toml:"tags" yaml:"tags"`
	Target        string `mapstructure:"target" json:"target" toml:"target" yaml:"target"`
	Title         string `json:"title" toml:"title" yaml:"title"`
}

Check defines the circonus check configuration options

type Circonus

type Circonus struct {
	API               API    `json:"api" toml:"api" yaml:"api"`
	Check             Check  `json:"check" toml:"check" yaml:"check"`
	TraceSubmits      string `mapstructure:"trace_submits" json:"trace_submits" toml:"trace_submits" yaml:"trace_submits"` // trace metrics being sent to circonus
	DefaultStreamtags string `mapstructure:"default_streamtags" json:"default_streamtags" toml:"default_streamtags" yaml:"default_streamtags"`
	MetricFiltersFile string `mapstructure:"metric_filters_file" json:"metric_filters_file" toml:"metric_filters_file" yaml:"metric_filters_file"`
	DefaultAlertsFile string `mapstructure:"default_alerts_file" json:"default_alerts_file" toml:"default_alerts_file" yaml:"default_alerts_file"`
	CustomRulesFile   string `mapstructure:"custom_rules_file" json:"custom_rules_file" toml:"custom_rules_file" yaml:"custom_rules_file"`
	// hidden circonus settings for development and debugging
	Base64Tags       bool `json:"-" toml:"-" yaml:"-"` //`mapstructure:"base64_tags" json:"base64_tags" toml:"base64_tags" yaml:"base64_tags"`
	DryRun           bool `json:"-" toml:"-" yaml:"-"` //`mapstructure:"dry_run" json:"dry_run" toml:"dry_run" yaml:"dry_run"`                             // simulate sending metrics, print them to stdout
	UseGZIP          bool `json:"-" toml:"-" yaml:"-"` //`mapstructure:"use_gzip" json:"use_gzip" toml:"use_gzip" yaml:"use_gzip"`                         // compress metrics using gzip when submitting (broker may not support)
	DebugSubmissions bool `json:"-" toml:"-" yaml:"-"`
	NodeCC           bool `json:"-" toml:"-" yaml:"-"`
}

Circonus defines the circonus specific configuration options

type Cluster

type Cluster struct {
	BearerToken            string `mapstructure:"bearer_token" json:"bearer_token" toml:"bearer_token" yaml:"bearer_token"`
	BearerTokenFile        string `mapstructure:"bearer_token_file" json:"bearer_token_file" toml:"bearer_token_file" yaml:"bearer_token_file"`
	EnableEvents           bool   `mapstructure:"enable_events" json:"enable_events" toml:"enable_events" yaml:"enable_events"`
	EnableKubeStateMetrics bool   `` /* 139-byte string literal not displayed */
	KSMRequestMode         string `mapstructure:"ksm_request_mode" json:"ksm_request_mode" toml:"ksm_request_mode" yaml:"ksm_request_mode"`
	KSMMetricsPortName     string `mapstructure:"ksm_metrics_port_name" json:"ksm_metrics_port_name" toml:"ksm_metrics_port_name" yaml:"ksm_metrics_port_name"`
	KSMTelemetryPortName   string `` /* 131-byte string literal not displayed */
	KSMFieldSelectorQuery  string `` /* 135-byte string literal not displayed */
	EnableAPIServer        bool   `mapstructure:"enable_api_server" json:"enable_api_server" toml:"enable_api_server" yaml:"enable_metrics_server"`
	EnableNodes            bool   `mapstructure:"enable_nodes" json:"enable_nodes" toml:"enable_nodes" yaml:"enable_nodes"`
	NodeSelector           string `mapstructure:"node_selector" json:"node_selector" toml:"node_selector" yaml:"node_selector"`
	EnableNodeStats        bool   `mapstructure:"enable_node_stats" json:"enable_node_stats" toml:"enable_node_stats" yaml:"enable_node_stats"`
	EnableNodeMetrics      bool   `mapstructure:"enable_node_metrics" json:"enable_node_metrics" toml:"enable_node_metrics" yaml:"enable_node_metrics"`
	EnableCadvisorMetrics  bool   `` /* 131-byte string literal not displayed */
	EnableKubeDNSMetrics   bool   `` /* 131-byte string literal not displayed */
	IncludeContainers      bool   `` /* 139-byte string literal not displayed */
	IncludePods            bool   `mapstructure:"include_pod_metrics" json:"include_pod_metrics" toml:"include_pod_metrics" yaml:"include_pod_metrics"`
	PodLabelKey            string `mapstructure:"pod_label_key" json:"pod_label_key" toml:"pod_label" yaml:"pod_label_key"`
	PodLabelVal            string `mapstructure:"pod_label_val" json:"pod_label_val" toml:"pod_label" yaml:"pod_label_val"`
	Name                   string `json:"name" toml:"name" yaml:"name"`
	Interval               string `json:"interval" toml:"interval" yaml:"interval"`
	NodePoolSize           uint   `mapstructure:"node_pool_size" json:"node_pool_size" toml:"node_pool_size" yaml:"node_pool_size"`
	URL                    string `mapstructure:"api_url" json:"api_url" toml:"api_url" yaml:"api_url"`
	CAFile                 string `mapstructure:"api_ca_file" json:"api_ca_file" toml:"api_ca_file" yaml:"api_ca_file"`
	APITimelimit           string `mapstructure:"api_timelimit" json:"api_timelimit" toml:"api_timelimit" yaml:"api_timelimit"`
}

Cluster defines the kubernetes cluster configuration options

type Config

type Config struct {
	Circonus   Circonus  `json:"circonus" toml:"circonus" yaml:"circonus"`       // circonus configuration options
	Kubernetes Cluster   `json:"kubernetes" toml:"kubernetes" yaml:"kubernetes"` // single cluster (use kubernetes OR clusters, not both)
	Clusters   []Cluster `json:"clusters" toml:"clusters" yaml:"clusters"`       // multiple clusters (use kubernetes OR clusters, not both)
	Debug      bool      `json:"debug" toml:"debug" yaml:"debug"`                // global debugging
	Log        Log       `json:"log" toml:"log" yaml:"log"`                      // logging options
}

Config defines the running configuration options

type LabelFilters

type LabelFilters struct {
	Exclude map[string]string `json:"exclude" toml:"exclude" yaml:"exclude"`
	Include map[string]string `json:"include" toml:"include" yaml:"include"`
}

LabelFilters defines labels to include and exclude

type Log

type Log struct {
	Level  string `json:"level" yaml:"level" toml:"level"`
	Pretty bool   `json:"pretty" yaml:"pretty" toml:"pretty"`
}

Log defines the logging configuration options

Directories

Path Synopsis
Package defaults contains the default values for configuration options
Package defaults contains the default values for configuration options
Package keys defines the configuration keys used to access viper
Package keys defines the configuration keys used to access viper

Jump to

Keyboard shortcuts

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