Documentation ¶
Index ¶
- Constants
- Variables
- func ConfigPath(path string) string
- func DecodeConfig(contents []byte) error
- func ExpandVars(in []byte) ([]byte, error)
- func GetLastPromPort(pollerName string, validatePortInUse bool) (int, error)
- func GetUniqueExporters(exporterNames []string) []string
- func LoadHarvestConfig(configPath string) (string, error)
- func Path(aPath string) string
- func ReadCredentialFile(credPath string, p *Poller) error
- func TestLoadHarvestConfig(configPath string)
- type Admin
- type CertificateScript
- type Collector
- type CredentialsScript
- type Exporter
- type ExporterDef
- type HarvestConfig
- type Httpsd
- type IntRange
- type OrderedConfig
- type Poller
- type Pollers
- type PortMap
- type Recorder
- type Remote
- type TLS
- type Tools
Constants ¶
const ( DefaultAPIVersion = "1.3" DefaultTimeout = "30s" DefaultConfPath = "conf" HarvestYML = "harvest.yml" BasicAuth = "basic_auth" CertificateAuth = "certificate_auth" HomeEnvVar = "HARVEST_CONF" )
Variables ¶
var (
Config = HarvestConfig{}
)
Functions ¶
func ConfigPath ¶
func DecodeConfig ¶
func ExpandVars ¶
func GetLastPromPort ¶
GetLastPromPort returns the Prometheus port for the given poller If a poller has multiple Prometheus exporters in its `exporters` section, the port for the last exporter in the list is used.
func GetUniqueExporters ¶
GetUniqueExporters returns the unique set of exporter types from the list of export names. For example, if two Prometheus exporters are configured for a poller, the last one is returned. Multiple InfluxDB exporters are allowed.
func LoadHarvestConfig ¶
func Path ¶
Path returns a path based on aPath and the HARVEST_CONF environment variable. If aPath is absolute, it is returned unchanged. When the HARVEST_CONF environment variable is set, a new path is returned relative to HARVEST_CONF. Otherwise, a new path is returned relative to the current working directory.
func ReadCredentialFile ¶
func TestLoadHarvestConfig ¶
func TestLoadHarvestConfig(configPath string)
TestLoadHarvestConfig loads a new config - used by testing code
Types ¶
type CertificateScript ¶
type CredentialsScript ¶
type Exporter ¶
type Exporter struct { Port *int `yaml:"port,omitempty"` PortRange *IntRange `yaml:"port_range,omitempty"` Type string `yaml:"exporter,omitempty"` Addr *string `yaml:"addr,omitempty"` URL *string `yaml:"url,omitempty"` LocalHTTPAddr string `yaml:"local_http_addr,omitempty"` GlobalPrefix *string `yaml:"global_prefix,omitempty"` AllowedAddrs *[]string `yaml:"allow_addrs,omitempty"` AllowedAddrsRegex *[]string `yaml:"allow_addrs_regex,omitempty"` CacheMaxKeep *string `yaml:"cache_max_keep,omitempty"` ShouldAddMetaTags *bool `yaml:"add_meta_tags,omitempty"` // Prometheus specific HeartBeatURL string `yaml:"heart_beat_url,omitempty"` SortLabels bool `yaml:"sort_labels,omitempty"` TLS TLS `yaml:"tls,omitempty"` // InfluxDB specific Bucket *string `yaml:"bucket,omitempty"` Org *string `yaml:"org,omitempty"` Token *string `yaml:"token,omitempty"` Precision *string `yaml:"precision,omitempty"` ClientTimeout *string `yaml:"client_timeout,omitempty"` Version *string `yaml:"version,omitempty"` IsTest bool // true when run from unit tests IsEmbedded bool // true when the exporter is embedded in a poller }
type ExporterDef ¶
func (*ExporterDef) UnmarshalYAML ¶
func (e *ExporterDef) UnmarshalYAML(n *yaml.Node) error
type HarvestConfig ¶
type HarvestConfig struct { Tools *Tools `yaml:"Tools,omitempty"` Exporters map[string]Exporter `yaml:"Exporters,omitempty"` Pollers map[string]*Poller `yaml:"Pollers,omitempty"` PollerFiles []string `yaml:"Poller_files,omitempty"` Defaults *Poller `yaml:"Defaults,omitempty"` Admin Admin `yaml:"Admin,omitempty"` PollersOrdered []string // poller names in same order as yaml config }
type Httpsd ¶
type Httpsd struct { Listen string `yaml:"listen,omitempty"` AuthBasic struct { Username string `yaml:"username,omitempty"` Password string `yaml:"password,omitempty"` } `yaml:"auth_basic,omitempty"` TLS TLS `yaml:"tls,omitempty"` HeartBeat string `yaml:"heart_beat,omitempty"` ExpireAfter string `yaml:"expire_after,omitempty"` }
type IntRange ¶
func (*IntRange) UnmarshalYAML ¶
type OrderedConfig ¶
type OrderedConfig struct {
Pollers Pollers `yaml:"Pollers,omitempty"`
}
type Poller ¶
type Poller struct { APIVersion string `yaml:"api_version,omitempty"` APIVfiler string `yaml:"api_vfiler,omitempty"` Addr string `yaml:"addr,omitempty"` AuthStyle string `yaml:"auth_style,omitempty"` CaCertPath string `yaml:"ca_cert,omitempty"` CertificateScript CertificateScript `yaml:"certificate_script,omitempty"` ClientTimeout string `yaml:"client_timeout,omitempty"` Collectors []Collector `yaml:"collectors,omitempty"` ConfPath string `yaml:"conf_path,omitempty"` CredentialsFile string `yaml:"credentials_file,omitempty"` CredentialsScript CredentialsScript `yaml:"credentials_script,omitempty"` Datacenter string `yaml:"datacenter,omitempty"` IsDisabled bool `yaml:"disabled,omitempty"` ExporterDefs []ExporterDef `yaml:"exporters,omitempty"` Exporters []string `yaml:"-"` IsKfs bool `yaml:"is_kfs,omitempty"` Labels *[]map[string]string `yaml:"labels,omitempty"` LogMaxBytes int64 `yaml:"log_max_bytes,omitempty"` LogMaxFiles int `yaml:"log_max_files,omitempty"` LogSet *[]string `yaml:"log,omitempty"` Password string `yaml:"password,omitempty"` PollerLogSchedule string `yaml:"poller_log_schedule,omitempty"` PollerSchedule string `yaml:"poller_schedule,omitempty"` PreferZAPI bool `yaml:"prefer_zapi,omitempty"` PromPort int `yaml:"prom_port,omitempty"` Recorder Recorder `yaml:"recorder,omitempty"` SslCert string `yaml:"ssl_cert,omitempty"` SslKey string `yaml:"ssl_key,omitempty"` TLSMinVersion string `yaml:"tls_min_version,omitempty"` UseInsecureTLS *bool `yaml:"use_insecure_tls,omitempty"` Username string `yaml:"username,omitempty"` Name string // contains filtered or unexported fields }
func PollerNamed ¶
func ZapiPoller ¶
ZapiPoller creates a poller out of a node, this is a bridge between the node and struct-based code Used by ZAPI based code
func (*Poller) IsRecording ¶
type Pollers ¶
type Pollers struct {
// contains filtered or unexported fields
}