Documentation
¶
Overview ¶
Package croshealthd provides methods for running and obtaining output from cros_healthd commands.
Index ¶
- Constants
- func GetDiagRoutines(ctx context.Context) ([]string, error)
- func RunAndParseJSONTelem(ctx context.Context, params TelemParams, outDir string, result interface{}) error
- func RunAndParseTelem(ctx context.Context, params TelemParams, outDir string) ([][]string, error)
- func RunTelem(ctx context.Context, params TelemParams, outDir string) ([]byte, error)
- type RoutineParams
- type RoutineResult
- type TelemCategory
- type TelemParams
Constants ¶
const ( RoutineBatteryCapacity string = "battery_capacity" RoutineBatteryHealth = "battery_health" RoutineURandom = "urandom" RoutineSmartctlCheck = "smartctl_check" RoutineACPower = "ac_power" RoutineCPUCache = "cpu_cache" RoutineCPUStress = "cpu_stress" RoutineFloatingPointAccurary = "floating_point_accuracy" RoutineNVMEWearLevel = "nvme_wear_level" RoutineNVMESelfTest = "nvme_self_test" RoutineDiskRead = "disk_read" RoutinePrimeSearch = "prime_search" RoutineBatteryDischarge = "battery_discharge" RoutineBatteryCharge = "battery_charge" RoutineMemory = "memory" RoutineLanConnectivity = "lan_connectivity" RoutineSignalStrength = "signal_strength" RoutineGatewayCanBePinged = "gateway_can_be_pinged" RoutineHasSecureWifiConnection = "has_secure_wifi_connection" RoutineDNSResolverPresent = "dns_resolver_present" RoutineDNSLatency = "dns_latency" RoutineDNSResolution = "dns_resolution" RoutineCaptivePortal = "captive_portal" RoutineHTTPFirewall = "http_firewall" RoutineHTTPSFirewall = "https_firewall" RoutineHTTPSLatency = "https_latency" )
List of cros_healthd diagnostic routines
const ( StatusReady string = "Ready" StatusRunning = "Running" StatusWaiting = "Waiting" StatusPassed = "Passed" StatusFailed = "Failed" StatusError = "Error" StatusCancelled = "Cancelled" StatusFailedToStart = "Failed to start" StatusRemoved = "Removed" StatusCancelling = "Cancelling" StatusUnsupported = "Unsupported" StatusNotRun = "Not run" )
List of possible routine statuses
const NotApplicable = "N/A"
NotApplicable is the value printed for optional fields when they aren't populated.
Variables ¶
This section is empty.
Functions ¶
func GetDiagRoutines ¶
GetDiagRoutines returns a list of valid routines for the device on success, or an error.
func RunAndParseJSONTelem ¶
func RunAndParseJSONTelem(ctx context.Context, params TelemParams, outDir string, result interface{}) error
RunAndParseJSONTelem runs RunTelem and parses the JSON output. Example:
var result certainStruct err := RunAndParseJSONTelem(_, _, _, &result)
func RunAndParseTelem ¶
RunAndParseTelem runs RunTelem and parses the CSV output into a two-dimensional array. An error is returned if there is a failure to obtain or parse the output or if a line of output has an unexpected number of fields.
Types ¶
type RoutineParams ¶
type RoutineParams struct { Routine string // The name of the routine to run Cancel bool // Boolean flag to cancel the routine }
RoutineParams are different configuration options for running a diagnostic routine.
type RoutineResult ¶
RoutineResult contains the progress of the routine as a percentage and the routine status.
func RunDiagRoutine ¶
func RunDiagRoutine(ctx context.Context, params RoutineParams) (*RoutineResult, error)
RunDiagRoutine runs the specified routine based on `params`. Returns a RoutineResult on success or an error.
type TelemCategory ¶
type TelemCategory string
TelemCategory represents a category flag that can be passed to the cros_healthd telem command.
const ( TelemCategoryAudio TelemCategory = "audio" TelemCategoryBacklight TelemCategory = "backlight" TelemCategoryBattery TelemCategory = "battery" TelemCategoryBluetooth TelemCategory = "bluetooth" TelemCategoryBootPerformance TelemCategory = "boot_performance" TelemCategoryBus TelemCategory = "bus" TelemCategoryCPU TelemCategory = "cpu" TelemCategoryDisplay TelemCategory = "display" TelemCategoryFan TelemCategory = "fan" TelemCategoryGraphics TelemCategory = "graphics" TelemCategoryMemory TelemCategory = "memory" TelemCategoryNetwork TelemCategory = "network" TelemCategoryStatefulPartition TelemCategory = "stateful_partition" TelemCategoryStorage TelemCategory = "storage" TelemCategorySystem TelemCategory = "system" TelemCategorySystem2 TelemCategory = "system2" TelemCategoryTimezone TelemCategory = "timezone" )
Categories for the cros_healthd telem command.
type TelemParams ¶
type TelemParams struct { // The category to pass as the --category flag. Category TelemCategory // The pid to pass as the --process flag. PID int }
TelemParams provides arguments for running `cros-health-tool telem`.