Documentation ¶
Index ¶
- Constants
- func DefaultAggregate(c *Check, b CheckBuilder)
- func RegisterCheck(c Check)
- func RegisterFileType(f FileType)
- type Aggregate
- type Bundle
- type Check
- type CheckBuilder
- type CheckHost
- type ContentType
- type DirType
- type File
- type FileType
- type Host
- type Result
- type SearchCheckBuilder
- type Status
Constants ¶
const ( // SUndefined means that the check wasn't performed successfully. SUndefined Status = "UNDEFINED" // SOK means that the bundle passed the check. SOK = "OK" // SProblem means that the bundle failed to pass the check. SProblem = "PROBLEM" )
const ( // DTRoot is a bundle root directory DTRoot DirType = "root" // DTMaster directory DTMaster = "master" // DTAgent direrctory DTAgent = "agent" // DTPublicAgent directory DTPublicAgent = "public agent" )
const ( // CTJson represents CTJson files. CTJson ContentType = "JSON" // CTJournal represents CTJournal files. CTJournal = "journal" // CTDmesg represents dmesg files. CTDmesg = "dmesg" // CTOutput is a output of a command. CTOutput = "output" //CTOther file types CTOther = "other" )
const MsgErr = "Error(s) occurred while performing the check."
MsgErr is a standard message used in the check summary when errors occures during the check.
Variables ¶
This section is empty.
Functions ¶
func DefaultAggregate ¶ added in v1.8.0
func DefaultAggregate(c *Check, b CheckBuilder)
Default implementation of the Aggregate function. It assumes that the implementations of the CheckHost function return Result Details as a string or nil.
func RegisterCheck ¶
func RegisterCheck(c Check)
RegisterCheck registers a new check to make it discoverable for consumers.
func RegisterFileType ¶
func RegisterFileType(f FileType)
RegisterFileType adds the file type to the filetype registry. It panics if the file type with the same name is already registered.
Types ¶
type Bundle ¶
type Bundle struct { Hosts map[string]Host // IP to Host map Masters map[string]Host Agents map[string]Host PublicAgents map[string]Host // contains filtered or unexported fields }
Bundle describes DC/OS diagnostics bundle.
func (Bundle) FindLine ¶ added in v1.8.0
FindLine returns a number and a content of the first line in a file of a type t which contains a substring s. If the line is not found, n == 0.
type Check ¶
type Check struct { Name string // Required Description string // Optional CheckFunc func(*Check, Bundle) // Required Status Status // Do not set Summary string // Do not set Problems []string // Do not set Errors []string // Do not set OKs []string // Do not set }
Check cheks some aspect of the DC/OS cluster analyzing its diagnostics bundle. Checks can be registered in the check registry with the egisterCheck function. Check is not supposed to be run more than one time.
type CheckBuilder ¶ added in v1.6.0
type CheckBuilder struct { Name string // Required Description string // Optional CollectFromMasters CheckHost // At least one of CollectFromAgents CheckHost // the Collect... functions CollectFromPublicAgents CheckHost // are required ProblemSummary string // Optional OKSummary string // Optional Aggregate Aggregate // Implement if the default is not sufficient Problems []Result // Do not set OKs []Result // Do not set }
CheckBuilder helps to create checks.
func (*CheckBuilder) Build ¶ added in v1.6.0
func (b *CheckBuilder) Build() Check
Build returns a Check
type CheckHost ¶ added in v1.6.0
CheckHost checks an individual host. It returns status, details, and error if the function cannot perform a check. If the returned error is not nil, then the status is ignored.
type ContentType ¶
type ContentType string
ContentType defines type of the content in the bundle file.
type File ¶ added in v1.2.0
type File interface { io.ReadCloser Name() string }
File is a safe way to access bundle files.
type FileType ¶
type FileType struct { Name string `yaml:"name"` ContentType ContentType `yaml:"contentType"` Paths []string `yaml:"paths"` Description string `yaml:"description"` // DirTypes defines on which host types this file can be found. // For example, dcos-marathon.service file can be found only on the masters. DirTypes []DirType `yaml:"dirTypes"` }
FileType Describes a kind of files in the bundle (e.g. dcos-marathon.service).
func GetFileType ¶
GetFileType returns a file type by its name. It panics if the file type is not in the registry.
type Host ¶
type Host struct { IP string // contains filtered or unexported fields }
Host represents a host in a DC/OS cluster.
func (Host) FindLine ¶ added in v1.8.0
FindLine returns a number and a content of the first line in a file of a type t which contains a substring s. If the line is not found, n == 0.
type SearchCheckBuilder ¶ added in v1.8.0
type SearchCheckBuilder struct { Name string `yaml:"name"` // Required Description string `yaml:"description"` // Optional FileTypeName string `yaml:"fileTypeName"` // Required SearchString string `yaml:"searchString"` // Required }
SearchCheckBuilder builds a check which searches for the specified string in the the specified files. If the pattern is found, the check is considered problematic. The number of the found line and its content appear in the Check.Problems of the check. The check searches only for the first appearance of the line.
func (SearchCheckBuilder) Build ¶ added in v1.8.0
func (b SearchCheckBuilder) Build() Check
Build creates a bun.Check.