Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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
var PostMetricsInterval = 1 * time.Minute
PostMetricsInterval XXX
Functions ¶
This section is empty.
Types ¶
type CheckPlugin ¶ added in v0.39.4
type CheckPlugin struct { Command string CommandArgs []string User string NotificationInterval *int32 CheckInterval *int32 MaxCheckAttempts *int32 }
CheckPlugin represents the configuration of a check plugin The User option is ignored on Windows
type Config ¶
type Config struct { Apibase string Apikey string Root string Pidfile string Conffile string Roles []string Verbose bool Silent bool Diagnostic bool `toml:"diagnostic"` Connection ConnectionConfig DisplayName string `toml:"display_name"` HostStatus HostStatus `toml:"host_status"` Filesystems Filesystems `toml:"filesystems"` HTTPProxy string `toml:"http_proxy"` // This Plugin field is used to decode the toml file. After reading the // configuration from file, this field is set to nil. // Please consider using MetricPlugins and CheckPlugins. Plugin map[string]map[string]*PluginConfig Include string // Cannot exist in configuration files HostIDStorage HostIDStorage MetricPlugins map[string]*MetricPlugin CheckPlugins map[string]*CheckPlugin MetadataPlugins map[string]*MetadataPlugin }
Config represents mackerel-agent's configuration file.
func LoadConfig ¶
LoadConfig loads a Config from a file.
func (*Config) CheckNames ¶ added in v0.16.0
CheckNames returns a list of name of the check plugins
func (*Config) DeleteSavedHostID ¶ added in v0.26.0
DeleteSavedHostID deletes the host id saved by SaveHostID.
func (*Config) ListCustomIdentifiers ¶ added in v0.39.4
ListCustomIdentifiers returns a list of customIdentifiers.
func (*Config) LoadHostID ¶ added in v0.26.0
LoadHostID loads the previously saved host id.
func (*Config) SaveHostID ¶ added in v0.26.0
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"` UseMountpoint bool `toml:"use_mountpoint"` }
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
HostStatus configure host status on agent start/stop
type MetadataPlugin ¶ added in v0.40.0
type MetadataPlugin struct { Command string CommandArgs []string User string ExecutionInterval *int32 }
MetadataPlugin represents the configuration of a metadata plugin The User option is ignored on Windows
type MetricPlugin ¶ added in v0.39.4
type MetricPlugin struct { Command string CommandArgs []string User string CustomIdentifier *string }
MetricPlugin represents the configuration of a metric plugin The User option is ignored on Windows
func (*MetricPlugin) CommandString ¶ added in v0.39.4
func (pconf *MetricPlugin) CommandString() string
CommandString returns the command string for log messages
type PluginConfig ¶
type PluginConfig struct { CommandRaw interface{} `toml:"command"` Command string CommandArgs []string User string NotificationInterval *int32 `toml:"notification_interval"` CheckInterval *int32 `toml:"check_interval"` ExecutionInterval *int32 `toml:"execution_interval"` MaxCheckAttempts *int32 `toml:"max_check_attempts"` CustomIdentifier *string `toml:"custom_identifier"` }
PluginConfig represents a plugin configuration.
type Regexpwrapper ¶ added in v0.28.0
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