Documentation
¶
Index ¶
- Constants
- Variables
- type Check
- func (self *Check) Execute() (Observation, error)
- func (self *Check) ID() string
- func (self *Check) IsFallen() bool
- func (self *Check) IsFlapping() bool
- func (self *Check) IsOK() bool
- func (self *Check) IsRisen() bool
- func (self *Check) Monitor(eventStream chan CheckEvent) error
- func (self *Check) StateString() string
- type CheckEvent
- type Config
- type Consumer
- type EventRouter
- func (self *EventRouter) AddHandler(handler *Handler) error
- func (self *EventRouter) LoadConfig(path string) error
- func (self *EventRouter) RegenerateCache()
- func (self *EventRouter) ReloadConfig() error
- func (self *EventRouter) Run(input io.Reader) error
- func (self *EventRouter) RunQueryCacher(interval time.Duration) error
- type Handler
- type HandlerConfig
- type Measurement
- type MeasurementUnit
- type Observation
- type ObservationState
- type Observations
- type Reacter
Constants ¶
View Source
const ( DEFAULT_CHECK_INTERVAL = 60 DEFAULT_CHECK_TIMEOUT = 10000 )
View Source
const ( DEFAULT_AMQP_PORT = 5672 DEFAULT_QUEUE_NAME = `reacter` )
View Source
const ( Unknown MeasurementUnit = 0 Numeric = 1 Time = 2 Percent = 3 Bytes = 4 Counter = 5 )
View Source
const ( DEFAULT_MAX_OBSERVATIONS = 21 DEFAULT_FLAP_HIGH_THRESH = 0.5 DEFAULT_FLAP_LOW_THRESH = 0.25 FLAP_BASE_COEFFICIENT = 0.8 FLAP_WEIGHT_MULTIPLIER = 0.02 )
View Source
const ( SuccessState ObservationState = 0 WarningState = 1 CriticalState = 2 UnknownState = 3 )
Variables ¶
View Source
var DefaultCacheDir = executil.RootOrString(
`/dev/shm/reacter/handler-queries`,
`~/.cache/reacter`,
)
View Source
var DefaultConfigDir = executil.RootOrString(`/etc/reacter/conf.d`, `~/.config/reacter.d`)
View Source
var DefaultConfigFile = executil.RootOrString(`/etc/reacter.yml`, `~/.config/reacter.yml`)
View Source
var DefaultHandleExecTimeout = 6 * time.Second
View Source
var DefaultHandleQueryExecTimeout = 3 * time.Second
Functions ¶
This section is empty.
Types ¶
type Check ¶
type Check struct {
NodeName string `json:"node_name"`
Name string `json:"name"`
Command interface{} `json:"command"`
Timeout interface{} `json:"timeout"`
Enabled bool `json:"enabled"`
State ObservationState `json:"state"`
HardState bool `json:"hard"`
StateChanged bool `json:"changed"`
Parameters map[string]interface{} `json:"parameters,omitempty"`
Environment map[string]string `json:"environment,omitempty"`
Directory string `json:"directory,omitempty"`
Interval interface{} `json:"interval"`
FlapThresholdHigh float32 `json:"flap_threshold_high,omitempty"`
FlapThresholdLow float32 `json:"flap_threshold_low,omitempty"`
Rise int `json:"rise,omitempty"`
Fall int `json:"fall,omitempty"`
Observations *Observations `json:"observations"`
EventStream chan CheckEvent `json:"-"`
StopMonitorC chan bool `json:"-"`
}
func (*Check) Execute ¶
func (self *Check) Execute() (Observation, error)
func (*Check) IsFlapping ¶
func (*Check) Monitor ¶
func (self *Check) Monitor(eventStream chan CheckEvent) error
func (*Check) StateString ¶
type CheckEvent ¶
type Consumer ¶
type Consumer struct {
ID string
Host string
Port int
Username string
Password string
Vhost string
QueueName string
Durable bool
Autodelete bool
Exclusive bool
// contains filtered or unexported fields
}
func NewConsumer ¶
type EventRouter ¶
type EventRouter struct {
NodeName string
Handlers []*Handler
ConfigFile string
ConfigDir string
CacheDir string
}
func NewEventRouter ¶
func NewEventRouter() *EventRouter
func (*EventRouter) AddHandler ¶
func (self *EventRouter) AddHandler(handler *Handler) error
func (*EventRouter) LoadConfig ¶
func (self *EventRouter) LoadConfig(path string) error
func (*EventRouter) RegenerateCache ¶
func (self *EventRouter) RegenerateCache()
func (*EventRouter) ReloadConfig ¶
func (self *EventRouter) ReloadConfig() error
Loads the ConfigFile (if present), and recursively scans and load all *.yml files in ConfigDir.
func (*EventRouter) RunQueryCacher ¶
func (self *EventRouter) RunQueryCacher(interval time.Duration) error
type Handler ¶
type Handler struct {
Name string `json:"name"`
QueryCommand []string `json:"query,omitempty"`
NodeFile string `json:"nodefile,omitempty"`
NodeFileAutoreload bool `json:"nodefile_autoreload,omitempty"`
NodeNames []string `json:"node_names,omitempty"`
SkipOK bool `json:"skip_ok"`
CheckNames []string `json:"checks,omitempty"`
States []int `json:"states,omitempty"`
SkipFlapping bool `json:"skip_flapping"`
OnlyChanges bool `json:"only_changes"`
Command []string `json:"command,omitempty"`
Environment map[string]string `json:"environment,omitempty"`
Parameters map[string]string `json:"parameters,omitempty"`
Directory string `json:"directory,omitempty"`
Disable bool `json:"disable,omitempty"`
Timeout interface{} `json:"timeout,omitempty"`
Cooldown interface{} `json:"cooldown,omitempty"`
QueryTimeout interface{} `json:"query_timeout,omitempty"`
CacheDir string `json:"-"`
// contains filtered or unexported fields
}
func (*Handler) Execute ¶
func (self *Handler) Execute(event CheckEvent) error
func (*Handler) ExecuteNodeQuery ¶
func (*Handler) GetCacheFilename ¶
func (*Handler) LoadNodeFile ¶
func (self *Handler) LoadNodeFile()
func (*Handler) ShouldExec ¶
type HandlerConfig ¶
type HandlerConfig struct {
HandlerDefinitions []Handler `json:"handlers"`
}
type Measurement ¶
type MeasurementUnit ¶
type MeasurementUnit int32
type Observation ¶
type Observation struct {
Timestamp time.Time `json:"-"`
State ObservationState `json:"-"`
Output []string `json:"-"`
Errors []string `json:"-"`
PerformanceData map[string]Measurement `json:"measurements,omitempty"`
}
func (*Observation) SetState ¶
func (self *Observation) SetState(state int)
type ObservationState ¶
type ObservationState int32
type Observations ¶
type Observations struct {
Values []Observation `json:"-"`
Size int `json:"size"`
Flapping bool `json:"flapping"`
FlapDetect bool `json:"flap_detection"`
FlapThresholdLow float32 `json:"flap_threshold_low"`
FlapThresholdHigh float32 `json:"flap_threshold_high"`
StateChangeFactor float32 `json:"flap_factor"`
}
func NewObservations ¶
func NewObservations() *Observations
func (*Observations) Push ¶
func (self *Observations) Push(observation Observation) error
type Reacter ¶
type Reacter struct {
NodeName string
Checks []*Check
Events chan CheckEvent
ConfigFile string
ConfigDir string
PrintJson bool
WriteJson io.Writer
OnlyPrintChanges bool
SuppressFlapping bool
}
func NewReacter ¶
func NewReacter() *Reacter
func (*Reacter) LoadConfig ¶
Load the configuration file the given path and append any checks to this instance.
func (*Reacter) ReloadConfig ¶
Loads the ConfigFile (if present), and recursively scans and load all *.yml files in ConfigDir.
func (*Reacter) StartEventProcessing ¶
func (self *Reacter) StartEventProcessing()
Source Files
¶
Click to show internal directories.
Click to hide internal directories.