config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ConfigFromFlagParser ...
	ConfigFromFlagParser *PrometheusAzureExporterConfig
	// CurrentConfig ...
	CurrentConfig *PrometheusAzureExporterConfig
	// AutoDiscoveryModeAll ...
	AutoDiscoveryModeAll = regexp.MustCompile(`^([Aa]ll)$`)
	// AutoDiscoveryModeTagged ...
	AutoDiscoveryModeTagged = regexp.MustCompile(`^([Tt]agged|[Nn]one)$`)
	// AutoDiscoveryTagTrue ...
	AutoDiscoveryTagTrue = regexp.MustCompile(`^([Tt]rue|[Yy]es)$`)
	// AutoDiscoveryTagFalse ...
	AutoDiscoveryTagFalse = regexp.MustCompile(`^([Ff]alse|[Nn]o)$`)
)

Functions

func MustDiscoverBasedOnTags

func MustDiscoverBasedOnTags(tags map[string]*string) bool

MustDiscoverBasedOnTags tags an map of tags returns True if the object must be discovered based on autodiscovery mode.

func ParseOptions

func ParseOptions()

ParseOptions loads config from cli arguments

func ValidateConfig

func ValidateConfig(conf *PrometheusAzureExporterConfig) []error

ValidateConfig returns a []error if config file contains configuration which does not make sens or cannot be applied

Types

type PrometheusAzureExporterConfig

type PrometheusAzureExporterConfig struct {
	ConfigFile        string        `                          short:"f"   long:"config"               description:"Yaml config"`
	Verbose           []bool        `yaml:"verbose"            short:"v"   long:"verbose"              description:"Show verbose debug information"`
	JSONOutput        bool          `yaml:"json_output"        short:"j"   long:"json"                 description:"Use json format for output"`
	Version           bool          `                                      long:"version"              description:"Show version"`
	ListeningAddress  string        `` /* 139-byte string literal not displayed */
	ListeningPort     uint          `` /* 130-byte string literal not displayed */
	UpdateInterval    time.Duration `` /* 136-byte string literal not displayed */
	NoCache           bool          `yaml:"no-cache"                       long:"no-cache"             description:"Disable internal caching"`
	AutoDiscoveryMode string        `` /* 145-byte string literal not displayed */
	AutoDiscoveryTag  string        `` /* 298-byte string literal not displayed */

	// Env vars used for Azure Authent, see
	// https://github.com/Azure/go-autorest/blob/v13.3.0/autorest/azure/auth/auth.go#L41-L51
	AzureTenantID            string `env:"AZURE_TENANT_ID"              description:"Azure tenant id"`
	AzureSubscriptionID      string `env:"AZURE_SUBSCRIPTION_ID"        description:"Azure subscription id"`
	AzureClientID            string `env:"AZURE_CLIENT_ID"              description:"Azure client id"`
	AzureClientSecret        string `env:"AZURE_CLIENT_SECRET"          description:"Azure client secret"`
	AzureCertificatePath     string `env:"AZURE_CERTIFICATE_PATH"       description:"Azure certificate path"`
	AzureCertificatePassword string `env:"AZURE_CERTIFICATE_PASSWORD"   description:"Azure certificate password"`
	AzureUsername            string `env:"AZURE_USERNAME"               description:"Azure username"`
	AzurePassword            string `env:"AZURE_PASSWORD"               description:"Azure password"`
	AzureEnvironment         string `env:"AZURE_ENVIRONMENT"            description:"Azure environment"`
	AzureADResource          string `env:"AZURE_AD_RESOURCE"            description:"Azure AD resource"`

	UpdateMetricsFunctions []UpdateMetricsFunctionConfig `yaml:"update_metrics_functions,omitempty"`
}

PrometheusAzureExporterConfig ...

func LoadFile

func LoadFile(filename string) (*PrometheusAzureExporterConfig, error)

LoadFile parses the given YAML file into a Config.

func ParseConfigFile

func ParseConfigFile() (*PrometheusAzureExporterConfig, error)

ParseConfigFile parses the config file defined by -f/--config

type UpdateMetricsFunctionConfig

type UpdateMetricsFunctionConfig struct {
	Name     string        `yaml:"name,omitempty"`
	Interval time.Duration `yaml:"interval,omitempty"`
}

UpdateMetricsFunctionConfig ...

Jump to

Keyboard shortcuts

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