Documentation ¶
Index ¶
- Variables
- func CheckFactoryIds() []string
- func GenCheckDocs(tpl string) string
- func GenCheckDocsMarkdown() string
- func GenCheckDocsText() string
- func RegisterCheck(id string, factory CheckFactory, resourceTypes []string) error
- type BaseCheck
- type Check
- func NewCheck(config CheckConfig, resourceType string) (Check, error)
- func NewDaemonSetStatus(config CheckConfig) (Check, error)
- func NewDeploymentStatus(config CheckConfig) (Check, error)
- func NewHsHealthCheck(config CheckConfig) (Check, error)
- func NewHsHealthCheckV2(config CheckConfig) (Check, error)
- func NewHttp(config CheckConfig) (Check, error)
- func ParseCheckConfigs(jsonData string, checkSource string, resourceType string) ([]Check, []error)
- type CheckConfig
- type CheckDocs
- type CheckFactory
- type CheckResponse
- type CheckResult
- type CheckStatus
- type CheckUsage
- type DaemonSetStatus
- type DeploymentStatus
- type HsHealthCheck
- type HsHealthCheckV2
- type Http
Constants ¶
This section is empty.
Variables ¶
var CheckDocsMarkdownTpl = `
Checks Command Documentation
============================
Get latest docs via: ` + "`" + `./sens8 -check-docs` + "`" + `
{{ range $doc := .Docs }}
### ` + "`" + `{{ $doc.Id }}` + "`" + `
**Resources**: {{ StringsJoin $doc.Resources ", " }}
{{ $doc.Description }}
` + "```" + `
{{ $doc.Flags }}
` + "```" + `
{{ end }}
`
var CheckDocsTextTpl = `` /* 199-byte string literal not displayed */
var (
Defaults = make(map[string]interface{})
)
Functions ¶
func CheckFactoryIds ¶
func CheckFactoryIds() []string
CheckFactoryIds gets the list of registered check ids
func GenCheckDocs ¶ added in v0.2.0
GenCheckDocs generates the usage docs for checks with the given template
func GenCheckDocsMarkdown ¶ added in v0.2.0
func GenCheckDocsMarkdown() string
GenCheckDocsMarkdown generates the usage docs for checks in markdown meant for external (github) docs
func GenCheckDocsText ¶ added in v0.2.0
func GenCheckDocsText() string
GenCheckDocsText generates the usage docs for checks in a format suitable for CLI
func RegisterCheck ¶
func RegisterCheck(id string, factory CheckFactory, resourceTypes []string) error
RegisterCheck registers checks in the check factory. Call this in init()
Types ¶
type BaseCheck ¶
type BaseCheck struct {
Config CheckConfig
}
func (*BaseCheck) GetConfig ¶
func (c *BaseCheck) GetConfig() *CheckConfig
type Check ¶
type Check interface { // GetHash returns the computed hash of the check config GetHash() uint64 // GetConfig return its CheckConfig GetConfig() *CheckConfig // Update updates the check with the resource that the controller received Update(resource interface{}) // Execute run the check Execute() (CheckResult, error) // Usage returns the help docs for the check Usage() CheckUsage }
func NewCheck ¶
func NewCheck(config CheckConfig, resourceType string) (Check, error)
NewCheck factory for checks. instantiates checks based on the config Id (first chunk of `command`)
func NewDaemonSetStatus ¶ added in v0.2.0
func NewDaemonSetStatus(config CheckConfig) (Check, error)
NewDaemonSetStatus creates a new daemonSet health check
func NewDeploymentStatus ¶
func NewDeploymentStatus(config CheckConfig) (Check, error)
NewDeploymentStatus creates a new deployment health check
func NewHsHealthCheck ¶
func NewHsHealthCheck(config CheckConfig) (Check, error)
NewHsHealthCheck creates a new deployment health check
func NewHsHealthCheckV2 ¶ added in v0.2.2
func NewHsHealthCheckV2(config CheckConfig) (Check, error)
NewHsHealthCheckV2 creates a new deployment health check
func NewHttp ¶ added in v0.2.0
func NewHttp(config CheckConfig) (Check, error)
NewDeploymentStatus creates a new deployment health check
func ParseCheckConfigs ¶
ParseCheckConfigs unmarshals config data (an array of checks) and initializes each configs as a check. It collects errors and returns any valid checks as we don't want a bad config in the config array invalidate the whole array.
type CheckConfig ¶
type CheckConfig struct { Name string `json:"name"` Command string `json:"command"` Interval int `json:"interval"` Handler *string `json:"handler,omitempty"` Handlers *[]string `json:"handlers,omitempty"` Source *string `json:"source,omitempty"` Deregister *bool `json:"deregister,omitempty"` Id string `json:"-"` Hash uint64 `json:"-"` Argv []string `json:"-"` ExtraFields map[string]interface{} `json:"-"` }
type CheckDocs ¶ added in v0.2.0
type CheckDocs struct { CheckUsage Id string Resources []string }
type CheckFactory ¶
type CheckFactory func(config CheckConfig) (Check, error)
type CheckResponse ¶
type CheckResponse struct { Client string `json:"client"` Check interface{} `json:"check"` // we have arbitrary fields, so can't type this }
type CheckResult ¶
type CheckResult struct { CheckConfig Status CheckStatus `json:"status"` Output string `json:"output"` Duration float64 `json:"duration,omitempty"` Issued int64 `json:"issued,omitempty"` Executed int64 `json:"executed,omitempty"` }
func NewCheckResultFromConfig ¶
func NewCheckResultFromConfig(conf CheckConfig) CheckResult
NewCheckResultFromConfig creates a new check result from config data and populates timestamps
func (*CheckResult) JsonResponse ¶
func (c *CheckResult) JsonResponse(client string) ([]byte, error)
JsonResponse wraps the result in a response and marshals it into json including all extra check config fields
type CheckUsage ¶
type DaemonSetStatus ¶ added in v0.2.0
type DaemonSetStatus struct { BaseCheck // contains filtered or unexported fields }
func (*DaemonSetStatus) Execute ¶ added in v0.2.0
func (dh *DaemonSetStatus) Execute() (CheckResult, error)
func (*DaemonSetStatus) Update ¶ added in v0.2.0
func (dh *DaemonSetStatus) Update(resource interface{})
func (*DaemonSetStatus) Usage ¶ added in v0.2.0
func (dh *DaemonSetStatus) Usage() CheckUsage
type DeploymentStatus ¶
type DeploymentStatus struct { BaseCheck // contains filtered or unexported fields }
func (*DeploymentStatus) Execute ¶
func (dh *DeploymentStatus) Execute() (CheckResult, error)
func (*DeploymentStatus) Update ¶
func (dh *DeploymentStatus) Update(resource interface{})
func (*DeploymentStatus) Usage ¶
func (dh *DeploymentStatus) Usage() CheckUsage
type HsHealthCheck ¶
type HsHealthCheck struct { BaseCheck // contains filtered or unexported fields }
func (*HsHealthCheck) Execute ¶
func (h *HsHealthCheck) Execute() (CheckResult, error)
func (*HsHealthCheck) Update ¶
func (h *HsHealthCheck) Update(resource interface{})
func (*HsHealthCheck) Usage ¶
func (dh *HsHealthCheck) Usage() CheckUsage
type HsHealthCheckV2 ¶ added in v0.2.2
type HsHealthCheckV2 struct { BaseCheck // contains filtered or unexported fields }
func (*HsHealthCheckV2) Execute ¶ added in v0.2.2
func (h *HsHealthCheckV2) Execute() (CheckResult, error)
func (*HsHealthCheckV2) Update ¶ added in v0.2.2
func (h *HsHealthCheckV2) Update(resource interface{})
func (*HsHealthCheckV2) Usage ¶ added in v0.2.2
func (dh *HsHealthCheckV2) Usage() CheckUsage