Documentation
¶
Overview ¶
result tries to
Index ¶
- func WorstState(states ...int) int
- type Overall
- func (o *Overall) Add(state int, output string)
- func (o *Overall) AddCritical(output string)
- func (o *Overall) AddOK(output string)
- func (o *Overall) AddUnknown(output string)
- func (o *Overall) AddWarning(output string)
- func (o *Overall) GetOutput() string
- func (o *Overall) GetStatus() int
- func (o *Overall) GetSummary() string
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WorstState ¶
Determines the worst state from a list of states
Helps combining an overall states, only based on a few numbers for various checks.
Order of preference: Critical, Unknown, Warning, Ok
Example ¶
state := result.WorstState(check.Unknown, check.Critical, check.OK) fmt.Println(state)
Output: 2
Types ¶
type Overall ¶
type Overall struct { OKs int Warnings int Criticals int Unknowns int Summary string Outputs []string }
func (*Overall) Add ¶
Example ¶
overall := Overall{} overall.Add(check.OK, "One element is good") overall.Add(check.Critical, "The other is critical") fmt.Println(overall)
Output: {1 0 1 0 [[OK] One element is good [CRITICAL] The other is critical]}
func (*Overall) AddCritical ¶
func (*Overall) AddUnknown ¶
func (*Overall) AddWarning ¶
func (*Overall) GetOutput ¶
Example ¶
overall := Overall{} overall.Add(check.OK, "One element is good") overall.Add(check.Critical, "The other is critical") fmt.Println(overall.GetOutput())
Output: states: critical=1 ok=1 [OK] One element is good [CRITICAL] The other is critical
func (*Overall) GetStatus ¶
Example ¶
overall := Overall{} overall.Add(check.OK, "One element is good") overall.Add(check.Critical, "The other is critical") fmt.Println(overall.GetStatus())
Output: 2
func (*Overall) GetSummary ¶
Click to show internal directories.
Click to hide internal directories.