Documentation
¶
Index ¶
- Variables
- type AddEndpointCommand
- type AddMonitorCommand
- type AlertSchedulerValue
- type AlertingJob
- type AppError
- type Check
- type CheckDNSUsage
- type CheckDef
- type CheckEvalResult
- type CheckForAlertDTO
- type CheckHTTPSUsage
- type CheckHTTPUsage
- type CheckHealthSettings
- type CheckNotificationSetting
- type CheckPINGUsage
- type CheckRoute
- type CheckState
- type CheckType
- type CheckUsage
- type DeleteMonitorCommand
- type DiscoverEndpointCmd
- type Endpoint
- type EndpointDTO
- type EndpointTag
- type EndpointUsage
- type GetEndpointsQuery
- type GetMonitorsQuery
- type GetProbesQuery
- type GlobalQuotaDTO
- type Monitor
- type MonitorDTO
- type MonitorForAlertDTO
- type MonitorSettingDTO
- type MonitorSettingsDTO
- type MonitorType
- type MonitorTypeDTO
- type MonitorTypeSetting
- type MonitorTypeSettingDTO
- type NotFoundError
- type OrgQuotaDTO
- type Probe
- type ProbeDTO
- type ProbeLocationDTO
- type ProbeSession
- type ProbeTag
- type ProbeUsage
- type Quota
- type QuotaScope
- type RouteByIdIndex
- type RouteByTagIndex
- type RouteType
- type SendEmailCommand
- type SuggestedMonitor
- type UpdateEndpointCommand
- type UpdateMonitorCommand
- type UpdateMonitorStateCommand
- type Usage
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEndpointNotFound = errors.New("Endpoint not found") ErrWithMonitorsDelete = errors.New("Endpoint can't be deleted as it still has monitors") )
Typed errors
View Source
var ( InvalidRouteConfig = errors.New("Invlid route config") UnknownRouteType = errors.New("unknown route type") )
View Source
var ( ErrMonitorNotFound = errors.New("Monitor not found") ErrMonitorCollectorsInvalid = errors.New("Invalid Collector specified for Monitor") ErrMonitorSettingsInvalid = errors.New("Invald variables used in Monitor Settings") ErrorEndpointCantBeChanged = errors.New("A monitor's endpoint_id can not be changed.") )
Typed errors
View Source
var ( MonitorTypeToCheckTypeMap = []CheckType{ HTTP_CHECK, HTTPS_CHECK, PING_CHECK, DNS_CHECK, } CheckTypeToMonitorTypeMap = map[CheckType]int64{ HTTP_CHECK: 1, HTTPS_CHECK: 2, PING_CHECK: 3, DNS_CHECK: 4, } )
View Source
var ( ErrProbeNotFound = errors.New("Probe not found") ErrProbeWithSameCodeExists = errors.New("A Probe with the same code already exists") )
Typed errors
View Source
var ErrInvalidEmailCode = errors.New("Invalid or expired email code")
View Source
var ErrInvalidQuotaTarget = errors.New("Invalid quota target")
View Source
var MonitorTypes = []MonitorTypeDTO{ { Id: 1, Name: "HTTP", Settings: []MonitorTypeSettingDTO{ { Variable: "host", Description: "Hostname", Required: true, DataType: "String", Conditions: map[string]interface{}{}, DefaultValue: "", }, { Variable: "path", Description: "Path", Required: true, DataType: "String", Conditions: map[string]interface{}{}, DefaultValue: "/", }, { Variable: "port", Description: "Port", Required: false, DataType: "Number", Conditions: map[string]interface{}{}, DefaultValue: "80", }, { Variable: "method", Description: "Method", Required: false, DataType: "Enum", Conditions: map[string]interface{}{ "values": []string{"GET", "POST", "PUT", "DELETE", "HEAD"}, }, DefaultValue: "GET", }, { Variable: "headers", Description: "Headers", Required: false, DataType: "Text", Conditions: map[string]interface{}{}, DefaultValue: "Accept-Encoding: gzip\nUser-Agent: raintank collector\n", }, { Variable: "expectRegex", Description: "Content Match", Required: false, DataType: "String", Conditions: map[string]interface{}{}, DefaultValue: "", }, { Variable: "timeout", Description: "Timeout", Required: true, DataType: "Number", Conditions: map[string]interface{}{}, DefaultValue: "5", }, }, }, { Id: 2, Name: "HTTPS", Settings: []MonitorTypeSettingDTO{ { Variable: "host", Description: "Hostname", Required: true, DataType: "String", Conditions: map[string]interface{}{}, DefaultValue: "", }, { Variable: "path", Description: "Path", Required: true, DataType: "String", Conditions: map[string]interface{}{}, DefaultValue: "/", }, { Variable: "port", Description: "Port", Required: false, DataType: "Number", Conditions: map[string]interface{}{}, DefaultValue: "443", }, { Variable: "method", Description: "Method", Required: false, DataType: "Enum", Conditions: map[string]interface{}{ "values": []string{"GET", "POST", "PUT", "DELETE", "HEAD"}, }, DefaultValue: "GET", }, { Variable: "headers", Description: "Headers", Required: false, DataType: "Text", Conditions: map[string]interface{}{}, DefaultValue: "Accept-Encoding: gzip\nUser-Agent: raintank collector\n", }, { Variable: "expectRegex", Description: "Content Match", Required: false, DataType: "String", Conditions: map[string]interface{}{}, DefaultValue: "", }, { Variable: "validateCert", Description: "Validate SSL Certificate", Required: false, DataType: "Boolean", Conditions: map[string]interface{}{}, DefaultValue: "true", }, { Variable: "timeout", Description: "Timeout", Required: true, DataType: "Number", Conditions: map[string]interface{}{}, DefaultValue: "5", }, }, }, { Id: 3, Name: "Ping", Settings: []MonitorTypeSettingDTO{ { Variable: "hostname", Description: "Hostname", Required: true, DataType: "String", Conditions: map[string]interface{}{}, DefaultValue: "", }, { Variable: "timeout", Description: "Timeout", Required: true, DataType: "Number", Conditions: map[string]interface{}{}, DefaultValue: "5", }, }, }, { Id: 4, Name: "DNS", Settings: []MonitorTypeSettingDTO{ { Variable: "name", Description: "Record Name", Required: true, DataType: "String", Conditions: map[string]interface{}{}, DefaultValue: "", }, { Variable: "type", Description: "Record Type", Required: true, DataType: "Enum", Conditions: map[string]interface{}{ "values": []string{"A", "AAAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", "TXT"}, }, DefaultValue: "A", }, { Variable: "server", Description: "Server", Required: true, DataType: "String", Conditions: map[string]interface{}{}, DefaultValue: "", }, { Variable: "port", Description: "Port", Required: false, DataType: "Number", Conditions: map[string]interface{}{}, DefaultValue: "53", }, { Variable: "protocol", Description: "Protocol", Required: false, DataType: "Enum", Conditions: map[string]interface{}{ "values": []string{"tcp", "udp"}, }, DefaultValue: "udp", }, { Variable: "timeout", Description: "Timeout", Required: true, DataType: "Number", Conditions: map[string]interface{}{}, DefaultValue: "5", }, }, }, }
Functions ¶
This section is empty.
Types ¶
type AddEndpointCommand ¶
type AddEndpointCommand struct {
OrgId int64 `json:"-"`
Name string `json:"name" binding:"Required"`
Tags []string `json:"tags"`
Monitors []*AddMonitorCommand `json:"monitors"`
Result *EndpointDTO `json:"-"`
}
type AddMonitorCommand ¶
type AddMonitorCommand struct {
OrgId int64 `json:"-"`
EndpointId int64 `json:"endpoint_id" binding:"Required"`
MonitorTypeId int64 `json:"monitor_type_id" binding:"Required"`
CollectorIds []int64 `json:"collector_ids"`
CollectorTags []string `json:"collector_tags"`
Settings []MonitorSettingDTO `json:"settings"`
HealthSettings *CheckHealthSettings `json:"health_settings"`
Frequency int64 `json:"frequency" binding:"Required;Range(10,600)"`
Enabled bool `json:"enabled"`
Offset int64 `json:"-"`
Result *MonitorDTO `json:"-"`
}
type AlertSchedulerValue ¶
type AlertingJob ¶
type AlertingJob struct {
OrgId int64
CheckId int64
EndpointId int64
EndpointName string
EndpointSlug string
Settings map[string]interface{}
CheckType string
Notifications CheckNotificationSetting
Freq int64
Offset int64 // offset on top of "even" minute/10s/.. intervalst
State CheckEvalResult
StateCheck time.Time
StateChange time.Time
Definition CheckDef
GeneratedAt time.Time
LastPointTs time.Time
AssertMinSeries int // to verify during execution at least this many series are returned (would be nice at some point to include actual number of collectors)
AssertStart time.Time // to verify timestamps in response
AssertStep int // to verify step duration
AssertSteps int // to verify during execution this many points are included
NewState CheckEvalResult
TimeExec time.Time
}
Job is a job for an alert execution note that LastPointTs is a time denoting the timestamp of the last point to run against this way the check runs always on the right data, irrespective of execution delays that said, for convenience, we track the generatedAt timestamp
func (*AlertingJob) SetAssertStart ¶
func (job *AlertingJob) SetAssertStart()
func (AlertingJob) String ¶
func (job AlertingJob) String() string
type Check ¶
type Check struct {
Id int64 `json:"id"`
OrgId int64 `json:"orgId"`
EndpointId int64 `json:"endpointId"`
Route *CheckRoute `xorm:"JSON" json:"route"`
Type CheckType `json:"type" binding:"Required,In(http,https,dns,ping)"`
Frequency int64 `json:"frequency" binding:"Required,Range(10,300)"`
Offset int64 `json:"offset"`
Enabled bool `json:"enabled"`
State CheckEvalResult `json:"state"`
StateChange time.Time `json:"stateChange"`
StateCheck time.Time `json:"stateCheck"`
Settings map[string]interface{} `json:"settings" binding:"Required"`
HealthSettings *CheckHealthSettings `xorm:"JSON" json:"healthSettings"`
Created time.Time `json:"created"`
Updated time.Time `json:"updated"`
}
type CheckDNSUsage ¶
type CheckEvalResult ¶
type CheckEvalResult int
const ( EvalResultOK CheckEvalResult = iota EvalResultWarn EvalResultCrit EvalResultUnknown = -1 )
func (CheckEvalResult) String ¶
func (c CheckEvalResult) String() string
type CheckForAlertDTO ¶
type CheckForAlertDTO struct {
Id int64
OrgId int64
EndpointId int64
Slug string
Name string
Type string
Offset int64
Frequency int64
Enabled bool
State CheckEvalResult
StateChange time.Time
StateCheck time.Time
Settings map[string]interface{} `xorm:"JSON"`
HealthSettings *CheckHealthSettings `xorm:"JSON"`
Created time.Time
Updated time.Time
}
type CheckHTTPSUsage ¶
type CheckHTTPUsage ¶
type CheckHealthSettings ¶
type CheckHealthSettings struct {
NumProbes int `json:"num_collectors" binding:"Required"`
Steps int `json:"steps" binding:"Required"`
Notifications CheckNotificationSetting `json:"notifications"`
}
type CheckPINGUsage ¶
type CheckRoute ¶
type CheckRoute struct {
Type RouteType `json:"type" binding:"Required"`
Config map[string]interface{} `json:"config"`
}
func (*CheckRoute) UnmarshalJSON ¶
func (t *CheckRoute) UnmarshalJSON(body []byte) error
func (*CheckRoute) Validate ¶
func (r *CheckRoute) Validate() (bool, error)
type CheckState ¶
type CheckUsage ¶
type CheckUsage struct {
Total int64
HTTP CheckHTTPUsage
HTTPS CheckHTTPSUsage
PING CheckPINGUsage
DNS CheckDNSUsage
}
type DeleteMonitorCommand ¶
type DiscoverEndpointCmd ¶
type DiscoverEndpointCmd struct {
Name string `form:"name"`
}
---------------------- COMMANDS
type Endpoint ¶
type Endpoint struct {
Id int64
OrgId int64
Name string
Slug string
Created time.Time
Updated time.Time
}
func (*Endpoint) UpdateSlug ¶
func (endpoint *Endpoint) UpdateSlug()
type EndpointDTO ¶
type EndpointTag ¶
type EndpointUsage ¶
type GetEndpointsQuery ¶
type GetEndpointsQuery struct {
OrgId int64 `form:"-"`
Name string `form:"name"`
Tag string `form:"tag"`
OrderBy string `form:"orderBy" binding:"In(name,slug,created,updated,)"`
}
--------------------- QUERIES
type GetMonitorsQuery ¶
type GetMonitorsQuery struct {
EndpointId int64 `form:"endpoint_id"`
}
type GetProbesQuery ¶
type GlobalQuotaDTO ¶
type MonitorDTO ¶
type MonitorDTO struct {
Id int64 `json:"id"`
OrgId int64 `json:"org_id"`
EndpointId int64 `json:"endpoint_id" `
EndpointSlug string `json:"endpoint_slug"`
MonitorTypeId int64 `json:"monitor_type_id"`
MonitorTypeName string `json:"monitor_type_name"`
CollectorIds []int64 `json:"collector_ids"`
CollectorTags []string `json:"collector_tags"`
Collectors []int64 `json:"collectors"`
State CheckEvalResult `json:"state"`
StateChange time.Time `json:"state_change"`
StateCheck time.Time `json:"state_check"`
Settings []MonitorSettingDTO `json:"settings"`
HealthSettings *CheckHealthSettings `json:"health_settings"`
Frequency int64 `json:"frequency"`
Enabled bool `json:"enabled"`
Offset int64 `json:"offset"`
Updated time.Time `json:"updated"`
}
func MonitorDTOFromCheck ¶
func MonitorDTOFromCheck(c Check, endpointSlug string) MonitorDTO
type MonitorForAlertDTO ¶
type MonitorForAlertDTO struct {
Id int64
OrgId int64
EndpointId int64
EndpointSlug string
EndpointName string
MonitorTypeId int64
MonitorTypeName string
Offset int64
Frequency int64
Enabled bool
StateChange time.Time
StateCheck time.Time
Settings []MonitorSettingDTO
HealthSettings *CheckHealthSettings
Created time.Time
Updated time.Time
}
func (*MonitorForAlertDTO) SettingsMap ¶
func (m *MonitorForAlertDTO) SettingsMap() map[string]string
type MonitorSettingDTO ¶
type MonitorSettingsDTO ¶
type MonitorSettingsDTO []MonitorSettingDTO
func (MonitorSettingsDTO) ToV2Setting ¶
func (s MonitorSettingsDTO) ToV2Setting(t CheckType) map[string]interface{}
type MonitorType ¶
type MonitorTypeDTO ¶
type MonitorTypeDTO struct {
Id int64 `json:"id"`
Name string `json:"name"`
Settings []MonitorTypeSettingDTO `json:"settings"`
}
type MonitorTypeSetting ¶
type MonitorTypeSettingDTO ¶
type NotFoundError ¶
type NotFoundError struct {
Msg string
}
func NewNotFoundError ¶
func NewNotFoundError(msg string) NotFoundError
func (NotFoundError) Code ¶
func (e NotFoundError) Code() int
func (NotFoundError) Error ¶
func (e NotFoundError) Error() string
func (NotFoundError) Message ¶
func (e NotFoundError) Message() string
type OrgQuotaDTO ¶
type Probe ¶
type Probe struct {
Id int64
OrgId int64
Slug string
Name string
Public bool
Latitude float64
Longitude float64
Created time.Time
Updated time.Time
Online bool
OnlineChange time.Time
Enabled bool
EnabledChange time.Time
}
func (*Probe) UpdateSlug ¶
func (collector *Probe) UpdateSlug()
type ProbeDTO ¶
type ProbeDTO struct {
Id int64 `json:"id"`
OrgId int64 `json:"org_id"`
Slug string `json:"slug"`
Name string `json:"name"`
Tags []string `json:"tags"`
Public bool `json:"public"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
Online bool `json:"online"`
OnlineChange time.Time `json:"online_change"`
Enabled bool `json:"enabled"`
EnabledChange time.Time `json:"enabled_change"`
Created time.Time `json:"created"`
Updated time.Time `json:"updated"`
}
---------------------- DTO
type ProbeLocationDTO ¶
type ProbeSession ¶
type ProbeUsage ¶
type QuotaScope ¶
func GetQuotaScopes ¶
func GetQuotaScopes(target string) ([]QuotaScope, error)
type RouteByIdIndex ¶
type RouteByTagIndex ¶
type SendEmailCommand ¶
type SuggestedMonitor ¶
type SuggestedMonitor struct {
MonitorTypeId int64 `json:"monitor_type_id"`
Settings []MonitorSettingDTO `json:"settings"`
}
type UpdateEndpointCommand ¶
type UpdateEndpointCommand struct {
Id int64 `json:"id" binding:"Required"`
OrgId int64 `json:"-"`
Name string `json:"name" binding:"Required"`
Tags []string `json:"tags"`
Result *EndpointDTO
}
type UpdateMonitorCommand ¶
type UpdateMonitorCommand struct {
Id int64 `json:"id" binding:"Required"`
EndpointId int64 `json:"endpoint_id" binding:"Required"`
OrgId int64 `json:"-"`
MonitorTypeId int64 `json:"monitor_type_id" binding:"Required"`
CollectorIds []int64 `json:"collector_ids"`
CollectorTags []string `json:"collector_tags"`
Settings []MonitorSettingDTO `json:"settings"`
HealthSettings *CheckHealthSettings `json:"health_settings"`
Frequency int64 `json:"frequency" binding:"Required;Range(10,600)"`
Enabled bool `json:"enabled"`
Offset int64 `json:"-"`
}
type Usage ¶
type Usage struct {
Endpoints EndpointUsage
Probes ProbeUsage
Checks CheckUsage
}
type ValidationError ¶
type ValidationError struct {
Msg string
}
func NewValidationError ¶
func NewValidationError(msg string) ValidationError
func (ValidationError) Code ¶
func (e ValidationError) Code() int
func (ValidationError) Error ¶
func (e ValidationError) Error() string
func (ValidationError) Message ¶
func (e ValidationError) Message() string
Click to show internal directories.
Click to hide internal directories.