Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultHeartBeatLoggingInterval uint = 15 * 60 // 15 minutes DefaultSystemMetricsLoggingInterval uint = 30 * 60 // 30 minutes MinimumHeartBeatLoggingInterval uint = 10 // 10 seconds MinimumSystemMetricsLoggingInterval uint = 10 // 10 seconds )
ExampleConfig:
"stat": { "verbose": false, "logging_interval":{ "heartbeat":60, "system_metrics":20 }, "trigger":[{ "measurement":"LoadAverage", "field":"LoadAvg1", "value":0.2, "sign":">=" }, { "measurement":"MemoryUsage", "field":"UsedPercent", "value":20, "sign":">=" } ] }
- Stat service does not run if "stat" key-value pair is not mentioned in config
- Stat service runs with default config if "stat" key is present but value is empty i.e. "stat":{}
- If fields Verbose, LoggingInterval, Trigger is not specified in config, then default value for those configs are used
- For fields: heartbeat and system_metrics of logging_interval, following holds true for each If unspecified, use default config value If specified and set to 0, disable logging If specified and >0 && < minimum, enable logging and set interval to minimum Else , enable logging and set interval to that provided in config
CHECK ensureConfig() for detail
Functions ¶
This section is empty.
Types ¶
type DiskUsage ¶
type DiskUsage struct {
DiskUsagePerMount []*DiskUsagePerMount `json:"DiskUsagePerMount"`
}
type DiskUsagePerMount ¶
type LoadAverage ¶
type LoggingInterval ¶
type MeasurementType ¶
type MeasurementType string
const ( LOADAVERAGE MeasurementType = "LoadAverage" MEMORYUSAGE MeasurementType = "MemoryUsage" DISKUSAGE MeasurementType = "DiskUsage" )
type MemoryUsage ¶
type StatCollector ¶
func NewService ¶
func NewService(cfg *StatConfig, l log.Logger) (StatCollector, error)
type StatConfig ¶
type StatConfig struct { Verbose bool `json:"verbose,omitempy"` // whether to display all fields or just the one used in trigger criteria LoggingInterval *LoggingInterval `json:"logging_interval,omitempty"` // check every X seconds Trigger []*Trigger `json:"trigger,omitempty"` // defines threshold for alert to trigger }
type SystemMetrics ¶
type SystemMetrics struct { LoadAverage *LoadAverage `json:"LoadAverage"` MemoryUsage *MemoryUsage `json:"MemoryUsage"` DiskUsage *DiskUsage `json:"DiskUsage"` }
Click to show internal directories.
Click to hide internal directories.