config

package
Version: v0.30.4 Latest Latest
Warning

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

Go to latest
Published: May 10, 2016 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = &Config{
	Apibase:    getApibase(),
	Root:       "/var/lib/mackerel-agent",
	Pidfile:    "/var/run/mackerel-agent.pid",
	Conffile:   fmt.Sprintf("/etc/%s/%s.conf", getAgentName(), getAgentName()),
	Roles:      []string{},
	Verbose:    false,
	Diagnostic: false,
	Connection: ConnectionConfig{
		PostMetricsDequeueDelaySeconds: 30,
		PostMetricsRetryDelaySeconds:   60,
		PostMetricsRetryMax:            60,
		PostMetricsBufferSize:          6 * 60,
	},
}

DefaultConfig The default configuration for linux

View Source
var PostMetricsInterval = 1 * time.Minute

PostMetricsInterval XXX

Functions

This section is empty.

Types

type Config

type Config struct {
	Apibase     string
	Apikey      string
	Root        string
	Pidfile     string
	Conffile    string
	Roles       []string
	Verbose     bool
	Diagnostic  bool `toml:"diagnostic"`
	Connection  ConnectionConfig
	DisplayName string      `toml:"display_name"`
	HostStatus  HostStatus  `toml:"host_status"`
	Filesystems Filesystems `toml:"filesystems"`

	// Corresponds to the set of [plugin.<kind>.<name>] sections
	// the key of the map is <kind>, which should be one of "metrics" or "checks".
	Plugin map[string]PluginConfigs

	Include string

	// Cannot exist in configuration files
	HostIDStorage HostIDStorage
}

Config represents mackerel-agent's configuration file.

func LoadConfig

func LoadConfig(conffile string) (*Config, error)

LoadConfig XXX

func (*Config) CheckNames added in v0.16.0

func (conf *Config) CheckNames() []string

CheckNames return list of plugin.checks._name_

func (*Config) DeleteSavedHostID added in v0.26.0

func (conf *Config) DeleteSavedHostID() error

DeleteSavedHostID deletes the host id saved by SaveHostID.

func (*Config) LoadHostID added in v0.26.0

func (conf *Config) LoadHostID() (string, error)

LoadHostID loads the previously saved host id.

func (*Config) SaveHostID added in v0.26.0

func (conf *Config) SaveHostID(id string) error

SaveHostID saves the host id, which may be restored by LoadHostID.

type ConnectionConfig added in v0.9.0

type ConnectionConfig struct {
	PostMetricsDequeueDelaySeconds int `toml:"post_metrics_dequeue_delay_seconds"` // delay for dequeuing from buffer queue
	PostMetricsRetryDelaySeconds   int `toml:"post_metrics_retry_delay_seconds"`   // delay for retrying a request that caused errors
	PostMetricsRetryMax            int `toml:"post_metrics_retry_max"`             // max numbers of retries for a request that causes errors
	PostMetricsBufferSize          int `toml:"post_metrics_buffer_size"`           // max numbers of requests stored in buffer queue.
}

ConnectionConfig XXX

type FileSystemHostIDStorage added in v0.26.0

type FileSystemHostIDStorage struct {
	Root string
}

FileSystemHostIDStorage is the default HostIDStorage which saves/loads the host id using an id file on the local filesystem. The file will be located at /var/lib/mackerel-agent/id by default on linux.

func (FileSystemHostIDStorage) DeleteSavedHostID added in v0.26.0

func (s FileSystemHostIDStorage) DeleteSavedHostID() error

DeleteSavedHostID deletes the mackerel-agent's id file.

func (FileSystemHostIDStorage) HostIDFile added in v0.26.0

func (s FileSystemHostIDStorage) HostIDFile() string

HostIDFile is the location of the host id file.

func (FileSystemHostIDStorage) LoadHostID added in v0.26.0

func (s FileSystemHostIDStorage) LoadHostID() (string, error)

LoadHostID loads the current host ID from the mackerel-agent's id file.

func (FileSystemHostIDStorage) SaveHostID added in v0.26.0

func (s FileSystemHostIDStorage) SaveHostID(id string) error

SaveHostID saves the host ID to the mackerel-agent's id file.

type Filesystems added in v0.28.0

type Filesystems struct {
	Ignore Regexpwrapper `toml:"ignore"`
}

Filesystems configure filesystem related settings

type HostIDStorage added in v0.26.0

type HostIDStorage interface {
	LoadHostID() (string, error)
	SaveHostID(id string) error
	DeleteSavedHostID() error
}

HostIDStorage is an interface which maintains persistency of the "Host ID" for the current host where the agent is running on. The ID is always generated and given by Mackerel (mackerel.io).

type HostStatus added in v0.17.0

type HostStatus struct {
	OnStart string `toml:"on_start"`
	OnStop  string `toml:"on_stop"`
}

HostStatus configure host status on agent start/stop

type PluginConfig

type PluginConfig struct {
	Command              string
	NotificationInterval *int32 `toml:"notification_interval"`
	MaxCheckAttempts     *int32 `toml:"max_check_attempts"`
}

PluginConfig represents a section of [plugin.*]. `MaxCheckAttempts` option is used with check monitoring plugins. Custom metrics plugins ignore this option.

type PluginConfigs

type PluginConfigs map[string]PluginConfig

PluginConfigs represents a set of [plugin.<kind>.<name>] sections in the configuration file under a specific <kind>. The key of the map is <name>, for example "mysql" of "plugin.metrics.mysql".

type Regexpwrapper added in v0.28.0

type Regexpwrapper struct {
	*regexp.Regexp
}

Regexpwrapper is a wrapper type for marshalling string

func (*Regexpwrapper) UnmarshalText added in v0.28.0

func (r *Regexpwrapper) UnmarshalText(text []byte) error

UnmarshalText for compiling regexp string while loading toml

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL