Documentation
¶
Index ¶
- Constants
- Variables
- func Check(ctx context.Context, r Checker, objs []interface{}) error
- func ObjectPathClaimingDir(ctx context.Context, p string, objs []interface{}) string
- func ObjectPathWithResource(ctx context.Context, objs []interface{}, match func(resource.Driver) bool) string
- func Register(c Checker)
- func RunnerWithCustomCheckPaths(paths ...string) funcopt.O
- func RunnerWithObjects(objs ...interface{}) funcopt.O
- func UnRegisterAll()
- func ValueText(value int64, unit string) string
- type Checker
- type DeviceIndex
- type Line
- type Result
- type ResultSet
- type Runner
- type T
Constants ¶
const ( // DefaultOutput is the listing of the check results. DefaultOutput = "tab=TYPE:type,DRIVER:driver,INSTANCE:instance,OBJECT:path,VALUE:value_text" // DefaultSort orders the results by type, the instances of a type // together. DefaultSort = "TYPE,INSTANCE" )
Variables ¶
var ExecCommand = exec.CommandContext
Functions ¶
func ObjectPathClaimingDir ¶
ObjectPathClaimingDir returns the first object using the directory: the object whose head it is, or else the object of a provisioned resource whose head it is.
func ObjectPathWithResource ¶
func ObjectPathWithResource(ctx context.Context, objs []interface{}, match func(resource.Driver) bool) string
ObjectPathWithResource returns the first object having a resource match selects, and empty when none has one.
func RunnerWithCustomCheckPaths ¶
RunnerWithCustomCheckPaths adds paths where additional check driver are installed.
func RunnerWithObjects ¶
RunnerWithObjects sets the list of objects the checkers can use to correlate a check instance to an object.
Types ¶
type DeviceIndex ¶
DeviceIndex is the object each device used or exposed by a disk or a fs resource belongs to, by device path, its links resolved, as /dev/mapper/<name> and the /dev/dm-<n> it leads to.
A checker reporting devices builds it once per check: asking every resource for its devices for each device reported would run their tools as many times.
func DeviceIndexOf ¶
func DeviceIndexOf(ctx context.Context, objs []interface{}) DeviceIndex
DeviceIndexOf returns the device index of the objects, built once for the checkers of a run.
func NewDeviceIndex ¶
func NewDeviceIndex(ctx context.Context, objs []interface{}) DeviceIndex
NewDeviceIndex returns the index of the devices of the disk and fs resources of the objects. The devices of the other resources, as a container, are not the ones a node device is attributed by.
func (DeviceIndex) Path ¶
func (t DeviceIndex) Path(devs ...string) string
Path returns the object of the first of the devices it knows, and empty when it knows none.
type Line ¶
Line is a check result as a listing shows it: the result, its value and its unit kept apart, and the value as a reader reads it, unit included.
type Result ¶
type Result struct {
DriverGroup string `json:"type"`
DriverName string `json:"driver"`
Path string `json:"path"`
Instance string `json:"instance"`
Unit string `json:"unit"`
Value int64 `json:"value"`
}
Result is the structure eventually collected for aggregation.
type ResultSet ¶
type ResultSet struct {
Data []Result
// Failed names the checkers that failed during the run, timed out
// or erred: their results are partial or missing, so the run does
// not tell the state of their checks.
Failed []string
}
ResultSet holds the list of all evaluated check instances.
func (*ResultSet) IsPartial ¶
IsPartial is true when a checker failed during the run, so the results miss some of the checks the node has.
func (ResultSet) MarshalJSON ¶
MarshalJSON turns this ResultSet into a byte slice.
func (*ResultSet) UnmarshalJSON ¶
UnmarshalJSON parses a byte slice and loads this ResultSet.