alarm

package
v0.0.0-...-57b808a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2019 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Disable

func Disable(alarm *Alarm) error

Disable disables an alarm

func Enable

func Enable(alarm *Alarm) error

Enable enables an alarm

func NewAlarm

func NewAlarm(a *Alarm) error

NewAlarm creates a new alarm

func RemoveAlarm

func RemoveAlarm(a *Alarm) error

RemoveAlarm removes an alarm.

func StartAutoScale

func StartAutoScale()

StartAutoScale start the auto scale

func UpdateAlarm

func UpdateAlarm(a *Alarm) error

UpdateAlarm updates an alarm

Types

type Alarm

type Alarm struct {
	Name        string            `json:"name"`
	Actions     []string          `json:"actions"`
	Expression  string            `json:"expression"`
	Enabled     bool              `json:"enabled"`
	Wait        time.Duration     `json:"wait"`
	DataSources []string          `json:"datasources"`
	Instance    string            `json:"instance"`
	Envs        map[string]string `json:"envs"`
}

Alarm represents the configuration for the auto scale.

func FindAlarmBy

func FindAlarmBy(q bson.M) ([]Alarm, error)

FindAlarmBy finds alarm by query "q".

func FindAlarmByName

func FindAlarmByName(name string) (*Alarm, error)

FindAlarmByName find alarm by name.

func ListAlarmsByInstance

func ListAlarmsByInstance(instanceName string) ([]Alarm, error)

ListAlarmsByInstance lists alarms by instance.

func ListAlarmsByToken

func ListAlarmsByToken(token string) ([]Alarm, error)

ListAlarmsByToken lists alarms by token.

func (*Alarm) Check

func (a *Alarm) Check() (bool, error)

Check executes the alarm expression

type Event

type Event struct {
	ID         bson.ObjectId `bson:"_id"`
	StartTime  time.Time
	EndTime    time.Time `bson:",omitempty"`
	Alarm      *Alarm
	Successful bool
	Error      string `bson:",omitempty"`
	Action     *action.Action
}

Event represents an auto scale event with the scale metadata.

func EventsByAlarmName

func EventsByAlarmName(alarm string) ([]Event, error)

EventsByAlarmName returns a list of events by alarm name

func FindEventsBy

func FindEventsBy(q bson.M, limit int) ([]Event, error)

FindEventsBy is an extensible way to find events by query

func NewEvent

func NewEvent(alarm *Alarm, action *action.Action) (*Event, error)

NewEvent creates a new alarm event

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL