Documentation ¶
Overview ¶
Package target implements the ways Revere can alert people to problems.
Index ¶
Constants ¶
View Source
const (
TargetsDir = "targets"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct { MonitorID db.MonitorID MonitorName string SubprobeID db.SubprobeID SubprobeName string Description string Response string OldState state.State NewState state.State Recorded time.Time EnteredState time.Time LastNormal time.Time Details probe.Details Host string }
Alert contains all the information targets can use to construct their alerts.
type Email ¶
type Email struct {
// contains filtered or unexported fields
}
Email implements a target that alerts people by sending email.
type EmailAddress ¶
type EmailDBModel ¶
EmailDBModel defines the JSON serialization format for saving email targets' settings in the database.
type EmailTarget ¶
type EmailTarget struct { EmailType Addresses []*EmailAddress }
func (EmailTarget) Serialize ¶
func (et EmailTarget) Serialize() (string, error)
func (EmailTarget) Type ¶
func (EmailTarget) Type() VMType
func (EmailTarget) Validate ¶
func (et EmailTarget) Validate() (errs []string)
type ErrorAndTriggerIDs ¶
type SlackDBModel ¶
type SlackDBModel struct {
Channel string
}
SlackDBModel defines the JSON serialization format for saving slack targets' settings in the database.
type SlackTarget ¶
func (SlackTarget) Serialize ¶
func (st SlackTarget) Serialize() (string, error)
func (SlackTarget) Type ¶
func (SlackTarget) Type() VMType
func (SlackTarget) Validate ¶
func (et SlackTarget) Validate() (errs []string)
type Target ¶
type Target interface {
Type() Type
}
Target defines a common abstraction for individual targets.
type Type ¶
type Type interface { ID() db.TargetType // New returns a new instance of a target of this type. New(config types.JSONText) (Target, error) // Alert sends alert a to the targets in toAlert. // // Targets of this type that are also applicable to the alerting // subprobe but which shouldn't be alerted (e.g., because they've been // alerted too recently or they shouldn't be triggered until a higher // level) are included in inactive. // // Alert returns errors encountered during the sending of alerts, // associated with the trigger IDs of the targets that failed with those // errors. Alert(Db *db.DB, a *Alert, toAlert map[db.TriggerID]Target, inactive []Target) []ErrorAndTriggerIDs }
Type defines a common abstraction for types of targets.
type VM ¶
func LoadFromDb ¶
func LoadFromDb(id db.TargetType, targetJson string) (VM, error)
func LoadFromParams ¶
func LoadFromParams(id db.TargetType, targetParams string) (VM, error)
type VMType ¶
type VMType interface { Id() db.TargetType Name() string Templates() map[string]string Scripts() map[string][]string // contains filtered or unexported methods }
TargetVMType and TargetVM define a common display abstraction for all targets.
func AllTargets ¶
func AllTargets() (tts []VMType)
Click to show internal directories.
Click to hide internal directories.