check

package
v2.0.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnmarshalJSON

func UnmarshalJSON(b []byte) (influxdb.Check, error)

UnmarshalJSON will convert

Types

type Base

type Base struct {
	ID          influxdb.ID             `json:"id,omitempty"`
	Name        string                  `json:"name"`
	Description string                  `json:"description,omitempty"`
	OwnerID     influxdb.ID             `json:"ownerID,omitempty"`
	OrgID       influxdb.ID             `json:"orgID,omitempty"`
	Query       influxdb.DashboardQuery `json:"query"`

	// Care should be taken to prevent TaskID from being exposed publicly.
	TaskID influxdb.ID `json:"taskID,omitempty"`
	// } todo: separate these
	// NonCustomCheckBase will embed inside non-custom checks.
	// type NonCustomCheckBase struct {
	StatusMessageTemplate string                 `json:"statusMessageTemplate"`
	Cron                  string                 `json:"cron,omitempty"`
	Every                 *notification.Duration `json:"every,omitempty"`
	// Offset represents a delay before execution.
	// It gets marshalled from a string duration, i.e.: "10s" is 10 seconds
	Offset *notification.Duration `json:"offset,omitempty"`

	Tags []influxdb.Tag `json:"tags"`
	influxdb.CRUDLog
}

Base will embed inside a check.

func (*Base) ClearPrivateData

func (b *Base) ClearPrivateData()

ClearPrivateData remove any data that we don't want to be exposed publicly.

func (Base) GetCRUDLog

func (b Base) GetCRUDLog() influxdb.CRUDLog

GetCRUDLog implements influxdb.Getter interface.

func (*Base) GetDescription

func (b *Base) GetDescription() string

GetDescription implements influxdb.Getter interface.

func (Base) GetID

func (b Base) GetID() influxdb.ID

GetID implements influxdb.Getter interface.

func (*Base) GetName

func (b *Base) GetName() string

GetName implements influxdb.Getter interface.

func (Base) GetOrgID

func (b Base) GetOrgID() influxdb.ID

GetOrgID implements influxdb.Getter interface.

func (Base) GetOwnerID

func (b Base) GetOwnerID() influxdb.ID

GetOwnerID gets the ownerID associated with a Base.

func (Base) GetTaskID

func (b Base) GetTaskID() influxdb.ID

GetTaskID retrieves the task ID for a check.

func (*Base) SetDescription

func (b *Base) SetDescription(description string)

SetDescription implements influxdb.Updator interface.

func (*Base) SetID

func (b *Base) SetID(id influxdb.ID)

SetID will set the primary key.

func (*Base) SetName

func (b *Base) SetName(name string)

SetName implements influxdb.Updator interface.

func (*Base) SetOrgID

func (b *Base) SetOrgID(id influxdb.ID)

SetOrgID will set the org key.

func (*Base) SetOwnerID

func (b *Base) SetOwnerID(id influxdb.ID)

SetOwnerID sets the taskID for a check.

func (*Base) SetTaskID

func (b *Base) SetTaskID(id influxdb.ID)

SetTaskID sets the taskID for a check.

func (Base) Valid

func (b Base) Valid() error

Valid returns err if the check is invalid.

type Custom

type Custom struct {
	ID          influxdb.ID             `json:"id,omitempty"`
	Name        string                  `json:"name"`
	Description string                  `json:"description,omitempty"`
	OwnerID     influxdb.ID             `json:"ownerID,omitempty"`
	OrgID       influxdb.ID             `json:"orgID,omitempty"`
	Query       influxdb.DashboardQuery `json:"query"`
	TaskID      influxdb.ID             `json:"taskID,omitempty"`
	CreatedAt   time.Time               `json:"createdAt"`
	UpdatedAt   time.Time               `json:"updatedAt"`
}

Custom is the custom check.

func (*Custom) ClearPrivateData

func (c *Custom) ClearPrivateData()

ClearPrivateData remove any data that we don't want to be exposed publicly.

func (Custom) GenerateFlux

func (c Custom) GenerateFlux() (string, error)

GenerateFlux returns the check query text directly

func (*Custom) GetCRUDLog

func (c *Custom) GetCRUDLog() influxdb.CRUDLog

GetCRUDLog gets crudLog

func (*Custom) GetDescription

func (c *Custom) GetDescription() string

GetDescription is GetDescription

func (*Custom) GetID

func (c *Custom) GetID() influxdb.ID

GetID is GetID

func (*Custom) GetName

func (c *Custom) GetName() string

GetName implements influxdb.Getter interface.

func (*Custom) GetOrgID

func (c *Custom) GetOrgID() influxdb.ID

GetOrgID gets the orgID associated with the Check

func (*Custom) GetOwnerID

func (c *Custom) GetOwnerID() influxdb.ID

GetOwnerID gets the ownerID associated with a Check.

func (*Custom) GetTaskID

func (c *Custom) GetTaskID() influxdb.ID

GetTaskID retrieves the task ID for a check.

func (Custom) MarshalJSON

func (c Custom) MarshalJSON() ([]byte, error)

MarshalJSON implement json.Marshaler interface.

func (*Custom) SetCreatedAt

func (c *Custom) SetCreatedAt(now time.Time)

SetCreatedAt sets the creation time for a check

func (*Custom) SetDescription

func (c *Custom) SetDescription(description string)

SetDescription is SetDescription

func (*Custom) SetID

func (c *Custom) SetID(id influxdb.ID)

SetID sets the primary key for a check

func (*Custom) SetName

func (c *Custom) SetName(name string)

SetName implements influxdb.Updator interface

func (*Custom) SetOrgID

func (c *Custom) SetOrgID(id influxdb.ID)

SetOrgID is SetOrgID

func (*Custom) SetOwnerID

func (c *Custom) SetOwnerID(id influxdb.ID)

SetOwnerID sets the taskID for a check.

func (*Custom) SetTaskID

func (c *Custom) SetTaskID(id influxdb.ID)

SetTaskID sets the taskID for a check.

func (*Custom) SetUpdatedAt

func (c *Custom) SetUpdatedAt(now time.Time)

SetUpdatedAt sets the update time for a check

func (Custom) Type

func (c Custom) Type() string

Type returns the type of the check.

func (*Custom) Valid

func (c *Custom) Valid() error

Valid checks whether check flux is valid, returns error if invalid

type Deadman

type Deadman struct {
	Base
	TimeSince *notification.Duration `json:"timeSince,omitempty"`
	StaleTime *notification.Duration `json:"staleTime,omitempty"`
	// If only zero values reported since time, trigger alert.
	// TODO(desa): Is this implemented in Flux?
	ReportZero bool                    `json:"reportZero"`
	Level      notification.CheckLevel `json:"level"`
}

Deadman is the deadman check.

func (Deadman) GenerateFlux

func (c Deadman) GenerateFlux() (string, error)

GenerateFlux returns a flux script for the Deadman provided.

func (Deadman) GenerateFluxAST

func (c Deadman) GenerateFluxAST() (*ast.Package, error)

GenerateFluxAST returns a flux AST for the deadman provided. If there are any errors in the flux that the user provided the function will return an error for each error found when the script is parsed.

func (Deadman) MarshalJSON

func (c Deadman) MarshalJSON() ([]byte, error)

MarshalJSON implement json.Marshaler interface.

func (Deadman) Type

func (c Deadman) Type() string

Type returns the type of the check.

type Greater

type Greater struct {
	ThresholdConfigBase
	Value float64 `json:"value,omitempty"`
}

Greater threshold type.

func (Greater) MarshalJSON

func (td Greater) MarshalJSON() ([]byte, error)

MarshalJSON implement json.Marshaler interface.

func (Greater) Type

func (td Greater) Type() string

Type of the threshold config.

type Lesser

type Lesser struct {
	ThresholdConfigBase
	Value float64 `json:"value,omitempty"`
}

Lesser threshold type.

func (Lesser) MarshalJSON

func (td Lesser) MarshalJSON() ([]byte, error)

MarshalJSON implement json.Marshaler interface.

func (Lesser) Type

func (td Lesser) Type() string

Type of the threshold config.

type Range

type Range struct {
	ThresholdConfigBase
	Min    float64 `json:"min,omitempty"`
	Max    float64 `json:"max,omitempty"`
	Within bool    `json:"within"`
}

Range threshold type.

func (Range) MarshalJSON

func (td Range) MarshalJSON() ([]byte, error)

MarshalJSON implement json.Marshaler interface.

func (Range) Type

func (td Range) Type() string

Type of the threshold config.

func (Range) Valid

func (td Range) Valid() error

Valid overwrite the base threshold.

type Threshold

type Threshold struct {
	Base
	Thresholds []ThresholdConfig `json:"thresholds"`
}

Threshold is the threshold check.

func (Threshold) GenerateFlux

func (t Threshold) GenerateFlux() (string, error)

GenerateFlux returns a flux script for the threshold provided. If there are any errors in the flux that the user provided the function will return an error for each error found when the script is parsed.

func (Threshold) GenerateFluxAST

func (t Threshold) GenerateFluxAST() (*ast.Package, error)

GenerateFluxAST returns a flux AST for the threshold provided. If there are any errors in the flux that the user provided the function will return an error for each error found when the script is parsed.

func (Threshold) MarshalJSON

func (t Threshold) MarshalJSON() ([]byte, error)

MarshalJSON implement json.Marshaler interface.

func (Threshold) Type

func (t Threshold) Type() string

Type returns the type of the check.

func (*Threshold) UnmarshalJSON

func (t *Threshold) UnmarshalJSON(b []byte) error

UnmarshalJSON implement json.Unmarshaler interface.

func (Threshold) Valid

func (t Threshold) Valid() error

Valid returns error if something is invalid.

type ThresholdConfig

type ThresholdConfig interface {
	MarshalJSON() ([]byte, error)
	Valid() error
	Type() string

	GetLevel() notification.CheckLevel
	// contains filtered or unexported methods
}

ThresholdConfig is the base of all threshold config.

type ThresholdConfigBase

type ThresholdConfigBase struct {
	// If true, only alert if all values meet threshold.
	AllValues bool                    `json:"allValues"`
	Level     notification.CheckLevel `json:"level"`
}

ThresholdConfigBase is the base of all threshold config.

func (ThresholdConfigBase) GetLevel

GetLevel return the check level.

func (ThresholdConfigBase) Valid

func (b ThresholdConfigBase) Valid() error

Valid returns error if something is invalid.

Jump to

Keyboard shortcuts

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