diagnose

package
v0.0.0-...-50ddb51 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package diagnose provides the diagnose suite for the agent.

Index

Constants

View Source
const (
	// CheckDatadog is the suite name for the check-datadog suite
	CheckDatadog = "check-datadog"
	// AutodiscoveryConnectivity is the suite name for the connectivity-datadog-autodiscovery suite
	AutodiscoveryConnectivity = "connectivity-datadog-autodiscovery"
	// CoreEndpointsConnectivity is the suite name for the connectivity-datadog-core-endpoints suite
	CoreEndpointsConnectivity = "connectivity-datadog-core-endpoints"
	// EventPlatformConnectivity is the suite name for the connectivity-datadog-event-platform suite
	EventPlatformConnectivity = "connectivity-datadog-event-platform"
	// PortConflict is the suite name for the port-conflict suite
	PortConflict = "port-conflict"
	// FirewallScan is the suite name for the firewall-scan suite
	FirewallScan = "firewall-scan"
)
View Source
const (
	DiagnosisSuccess         Status = 0
	DiagnosisFail            Status = 1
	DiagnosisWarning         Status = 2
	DiagnosisUnexpectedError        = 3
	DiagnosisResultMIN              = DiagnosisSuccess
	DiagnosisResultMAX              = DiagnosisUnexpectedError
)

Diagnosis status

Variables

AllSuites is a list of all available suites

View Source
var MetadataAvailCatalog = make(metadataAvailDiagnoseCatalog)

MetadataAvailCatalog is a set of MetadataAvailDiagnose functions

Functions

func RegisterMetadataAvail

func RegisterMetadataAvail(name string, d func() error)

RegisterMetadataAvail adds a MetadataAvailDiagnose

Types

type Catalog

type Catalog struct {
	Suites Suites
}

Catalog stores the list of registered Diagnose functions

func GetCatalog

func GetCatalog() *Catalog

GetCatalog returns the global Catalog instance

func (*Catalog) Register

func (c *Catalog) Register(name string, diagnoseFunc func(Config) []Diagnosis)

Register registers a diagnose function

type Component

type Component interface {
	RunSuites(format string, verbose bool) ([]byte, error)
	RunSuite(suite string, format string, verbose bool) ([]byte, error)
	RunLocalSuite(suites Suites, config Config) (*Result, error)
}

Component is the component type.

type Config

type Config struct {
	Verbose bool
	Include []string
	Exclude []string
}

Config is the configuration for the diagnose

type Counters

type Counters struct {
	Total         int `json:"total,omitempty"`
	Success       int `json:"success,omitempty"`
	Fail          int `json:"fail,omitempty"`
	Warnings      int `json:"warnings,omitempty"`
	UnexpectedErr int `json:"unexpected_error,omitempty"`
}

Counters contains the count of the diagnosis results

func (*Counters) Increment

func (c *Counters) Increment(r Status)

Increment increments the count of the diagnosis results

type Diagnoses

type Diagnoses struct {
	Name      string      `json:"suite_name"`
	Diagnoses []Diagnosis `json:"diagnoses"`
}

Diagnoses contains the results of the diagnosis

type Diagnosis

type Diagnosis struct {
	// --------------------------
	// required fields
	// run-time (pass, fail etc)
	Status Status `json:"result"`
	// static-time (meta typically)
	Name string `json:"name"`
	// run-time (actual diagnosis consumable by a user)
	Diagnosis string `json:"diagnosis"`

	// static-time (meta typically)
	Category string `json:"category,omitempty"`
	// static-time (meta typically, description of what being tested)
	Description string `json:"description,omitempty"`
	// run-time (what can be done of what docs need to be consulted to address the issue)
	Remediation string `json:"remediation,omitempty"`
	// run-time
	RawError string `json:"rawerror,omitempty"`
	// run-time (additional metadata)
	Metadata map[string]string `json:"metadata,omitempty"`
}

Diagnosis contains the results of the diagnosis

func (Diagnosis) MarshalJSON

func (d Diagnosis) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Diagnose struct to JSON

type Result

type Result struct {
	Runs    []Diagnoses `json:"runs"`
	Summary Counters    `json:"summary"`
}

Result contains the results of the diagnosis

type Status

type Status int

Status contains the result of the diagnosis

func (Status) ToString

func (r Status) ToString(colors bool) string

ToString returns the string representation of the Result

type Suites

type Suites map[string]func(Config) []Diagnosis

Suites is a map of suite names to diagnose functions

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL