Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var PostMetricsInterval = 1 * time.Minute
PostMetricsInterval XXX
Functions ¶
This section is empty.
Types ¶
type CheckPlugin ¶ added in v0.39.4
type CheckPlugin struct { Command Command NotificationInterval *int32 CheckInterval *int32 MaxCheckAttempts *int32 PreventAlertAutoClose bool Action *Command Memo *string }
CheckPlugin represents the configuration of a check plugin The User option is ignored on Windows
type CloudPlatform ¶ added in v0.48.0
type CloudPlatform int
CloudPlatform is an enum to represent which cloud platform the host is running on.
const ( CloudPlatformAuto CloudPlatform = iota CloudPlatformNone CloudPlatformEC2 CloudPlatformGCE CloudPlatformAzureVM )
CloudPlatform enum values
func (CloudPlatform) String ¶ added in v0.48.0
func (c CloudPlatform) String() string
func (*CloudPlatform) UnmarshalText ¶ added in v0.48.0
func (c *CloudPlatform) UnmarshalText(text []byte) error
UnmarshalText is used by toml unmarshaller
type Command ¶ added in v0.47.0
type Command struct { cmdutil.CommandOption Cmd string Args []string }
Command represents an executable command.
func (*Command) CommandString ¶ added in v0.47.0
CommandString returns the command string for log messages
type CommandConfig ¶ added in v0.47.0
type CommandConfig struct { Raw interface{} `toml:"command"` User string `toml:"user"` Env Env `toml:"env"` TimeoutSeconds int64 `toml:"timeout_seconds"` }
CommandConfig represents an executable command configuration.
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"` CloudPlatform CloudPlatform `toml:"cloud_platform"` // 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.
var DefaultConfig *Config
DefaultConfig stores standard settings for each environment
func LoadConfig ¶
LoadConfig loads a Config from a file.
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 // delay for dequeuing from buffer queue PostMetricsRetryDelaySeconds int // delay for retrying a request that caused errors PostMetricsRetryMax int // max numbers of retries for a request that causes errors PostMetricsBufferSize int // max numbers of requests stored in buffer queue. ReportCheckDelaySeconds int // delay for request reports ReportCheckDelaySecondsMax int // max delay for request reports ReportCheckRetryDelaySeconds int // delay for retrying a request that caused errors ReportCheckBufferSize int // max numbers of requests stored in buffer queue. }
ConnectionConfig XXX
type Env ¶ added in v0.48.0
Env represents environments.
func (Env) ConvertToStrings ¶ added in v0.48.0
ConvertToStrings converts to a slice of the form "key=value".
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
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 Command CustomIdentifier *string IncludePattern *regexp.Regexp ExcludePattern *regexp.Regexp }
MetricPlugin represents the configuration of a metric plugin The User option is ignored on Windows
type PluginConfig ¶
type PluginConfig struct { CommandConfig 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"` PreventAlertAutoClose bool `toml:"prevent_alert_auto_close"` IncludePattern *string `toml:"include_pattern"` ExcludePattern *string `toml:"exclude_pattern"` Action CommandConfig `toml:"action"` Memo *string `toml:"memo"` }
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