analyzer

package
v0.51.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2022 License: Apache-2.0 Imports: 47 Imported by: 20

Documentation

Index

Constants

View Source
const (
	SynchronizedActive     = "synchronized+active"
	SynchronizedInactive   = "synchronized+inactive"
	UnsynchronizedActive   = "unsynchronized+active"
	UnsynchronizedInactive = "unsynchronized+inactive"
)

Variables

View Source
var CephStatusDefaultOutcomes = []*troubleshootv1beta2.Outcome{
	{
		Pass: &troubleshootv1beta2.SingleOutcome{
			Message: "Ceph is healthy",
		},
	},
	{
		Warn: &troubleshootv1beta2.SingleOutcome{
			Message: "Ceph status is HEALTH_WARN",
			URI:     "https://rook.io/docs/rook/v1.4/ceph-common-issues.html",
		},
	},
	{
		Fail: &troubleshootv1beta2.SingleOutcome{
			Message: "Ceph status is HEALTH_ERR",
			URI:     "https://rook.io/docs/rook/v1.4/ceph-common-issues.html",
		},
	},
}
View Source
var Filemap = map[string]string{
	"Deployment":           "deployments",
	"StatefulSet":          "statefulsets",
	"NetworkPolicy":        "network-policy",
	"Pod":                  "pods",
	"Ingress":              "ingress",
	"Service":              "services",
	"ResourceQuota":        "resource-quotas",
	"Job":                  "jobs",
	"PersistentVoumeClaim": "pvcs",
	"pvc":                  "pvcs",
	"ReplicaSet":           "replicasets",
	"Namespace":            "namespaces.json",
	"PersistentVolume":     "pvs.json",
	"pv":                   "pvs.json",
	"Node":                 "nodes.json",
	"StorageClass":         "storage-classes.json",
}

Functions

func CheckApiResourcesForProviders added in v0.45.0

func CheckApiResourcesForProviders(foundProviders *providers, apiResources []*metav1.APIResourceList, provider string) string

func ExtractTroubleshootBundle added in v0.9.37

func ExtractTroubleshootBundle(reader io.Reader, destDir string) error

func FindBundleRootDir added in v0.9.48

func FindBundleRootDir(localBundlePath string) (string, error)

FindBundleRootDir detects whether the bundle is stored inside a subdirectory or not. returns the subdirectory path if so, otherwise, returns the path unchanged

func FindResource added in v0.51.0

func FindResource(kind string, clusterScoped bool, namespace string, name string, getFileContents getCollectedFileContents) (interface{}, error)

FindResource locates and returns a kubernetes resource as an interface{} from a support bundle based on some basic selectors if clusterScoped is false and namespace is not provided, it will default to looking in the "default" namespace

func GetExcludeFlag added in v0.36.0

func GetExcludeFlag(analyzer *troubleshootv1beta2.Analyze) *multitype.BoolOrString

func ParseNodesForProviders added in v0.9.27

func ParseNodesForProviders(nodes []corev1.Node) (providers, string)

Types

type AnalyzeHostBlockDevices added in v0.10.8

type AnalyzeHostBlockDevices struct {
	// contains filtered or unexported fields
}

func (*AnalyzeHostBlockDevices) Analyze added in v0.10.8

func (a *AnalyzeHostBlockDevices) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error)

func (*AnalyzeHostBlockDevices) IsExcluded added in v0.10.8

func (a *AnalyzeHostBlockDevices) IsExcluded() (bool, error)

func (*AnalyzeHostBlockDevices) Title added in v0.10.8

func (a *AnalyzeHostBlockDevices) Title() string

type AnalyzeHostCPU added in v0.10.8

type AnalyzeHostCPU struct {
	// contains filtered or unexported fields
}

func (*AnalyzeHostCPU) Analyze added in v0.10.8

func (a *AnalyzeHostCPU) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error)

func (*AnalyzeHostCPU) IsExcluded added in v0.10.8

func (a *AnalyzeHostCPU) IsExcluded() (bool, error)

func (*AnalyzeHostCPU) Title added in v0.10.8

func (a *AnalyzeHostCPU) Title() string

type AnalyzeHostCertificate added in v0.10.8

type AnalyzeHostCertificate struct {
	// contains filtered or unexported fields
}

func (*AnalyzeHostCertificate) Analyze added in v0.10.8

func (a *AnalyzeHostCertificate) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error)

func (*AnalyzeHostCertificate) IsExcluded added in v0.10.8

func (a *AnalyzeHostCertificate) IsExcluded() (bool, error)

func (*AnalyzeHostCertificate) Title added in v0.10.8

func (a *AnalyzeHostCertificate) Title() string

type AnalyzeHostDiskUsage added in v0.10.8

type AnalyzeHostDiskUsage struct {
	// contains filtered or unexported fields
}

func (*AnalyzeHostDiskUsage) Analyze added in v0.10.8

func (a *AnalyzeHostDiskUsage) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error)

func (*AnalyzeHostDiskUsage) IsExcluded added in v0.10.8

func (a *AnalyzeHostDiskUsage) IsExcluded() (bool, error)

func (*AnalyzeHostDiskUsage) Title added in v0.10.8

func (a *AnalyzeHostDiskUsage) Title() string

type AnalyzeHostFilesystemPerformance added in v0.10.8

type AnalyzeHostFilesystemPerformance struct {
	// contains filtered or unexported fields
}

func (*AnalyzeHostFilesystemPerformance) Analyze added in v0.10.8

func (a *AnalyzeHostFilesystemPerformance) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error)

func (*AnalyzeHostFilesystemPerformance) IsExcluded added in v0.10.8

func (a *AnalyzeHostFilesystemPerformance) IsExcluded() (bool, error)

func (*AnalyzeHostFilesystemPerformance) Title added in v0.10.8

type AnalyzeHostHTTP added in v0.10.8

type AnalyzeHostHTTP struct {
	// contains filtered or unexported fields
}

func (*AnalyzeHostHTTP) Analyze added in v0.10.8

func (a *AnalyzeHostHTTP) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error)

func (*AnalyzeHostHTTP) IsExcluded added in v0.10.8

func (a *AnalyzeHostHTTP) IsExcluded() (bool, error)

func (*AnalyzeHostHTTP) Title added in v0.10.8

func (a *AnalyzeHostHTTP) Title() string

type AnalyzeHostHTTPLoadBalancer added in v0.10.8

type AnalyzeHostHTTPLoadBalancer struct {
	// contains filtered or unexported fields
}

func (*AnalyzeHostHTTPLoadBalancer) Analyze added in v0.10.8

func (a *AnalyzeHostHTTPLoadBalancer) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error)

func (*AnalyzeHostHTTPLoadBalancer) IsExcluded added in v0.10.8

func (a *AnalyzeHostHTTPLoadBalancer) IsExcluded() (bool, error)

func (*AnalyzeHostHTTPLoadBalancer) Title added in v0.10.8

type AnalyzeHostIPV4Interfaces added in v0.10.8

type AnalyzeHostIPV4Interfaces struct {
	// contains filtered or unexported fields
}

func (*AnalyzeHostIPV4Interfaces) Analyze added in v0.10.8

func (a *AnalyzeHostIPV4Interfaces) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error)

func (*AnalyzeHostIPV4Interfaces) IsExcluded added in v0.10.8

func (a *AnalyzeHostIPV4Interfaces) IsExcluded() (bool, error)

func (*AnalyzeHostIPV4Interfaces) Title added in v0.10.8

func (a *AnalyzeHostIPV4Interfaces) Title() string

type AnalyzeHostKernelModules added in v0.15.0

type AnalyzeHostKernelModules struct {
	// contains filtered or unexported fields
}

func (*AnalyzeHostKernelModules) Analyze added in v0.15.0

func (a *AnalyzeHostKernelModules) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error)

Analyze the kernel module collection results.

When an outcome is specified, the "when" condition must be empty (for default conditions), or made up of 3 parts:

  • comma-separated list of kernel module names, e,g, "target_core_mod,target_core_file,tcm_loop"
  • comparison operator ("==", "=", "!=", "<>")
  • comma-separated state list ("unknown", "loaded", "loadable", "loading", "unloading")

Multiple outcomes can be provided. Outcomes should not conflict.

Default outcomes (with empty when clauses) can be provided for fail, warn and pass. When multiple defaults are provided, evaluation is processed in the order that they were specified and the first to match is returned.

  • a default fail will only trigger if there are no matching non-default pass outcomes.
  • a default warn will only trigger if there are no matching non-default pass or fail outcomes.
  • a default pass will only trigger if there are no matching non-default fail outcomes.

func (*AnalyzeHostKernelModules) IsExcluded added in v0.15.0

func (a *AnalyzeHostKernelModules) IsExcluded() (bool, error)

func (*AnalyzeHostKernelModules) Title added in v0.15.0

func (a *AnalyzeHostKernelModules) Title() string

type AnalyzeHostMemory added in v0.10.8

type AnalyzeHostMemory struct {
	// contains filtered or unexported fields
}

func (*AnalyzeHostMemory) Analyze added in v0.10.8

func (a *AnalyzeHostMemory) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error)

func (*AnalyzeHostMemory) IsExcluded added in v0.10.8

func (a *AnalyzeHostMemory) IsExcluded() (bool, error)

func (*AnalyzeHostMemory) Title added in v0.10.8

func (a *AnalyzeHostMemory) Title() string

type AnalyzeHostOS added in v0.16.0

type AnalyzeHostOS struct {
	// contains filtered or unexported fields
}

func (*AnalyzeHostOS) Analyze added in v0.16.0

func (a *AnalyzeHostOS) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error)

func (*AnalyzeHostOS) IsExcluded added in v0.16.0

func (a *AnalyzeHostOS) IsExcluded() (bool, error)

func (*AnalyzeHostOS) Title added in v0.16.0

func (a *AnalyzeHostOS) Title() string

type AnalyzeHostServices added in v0.10.15

type AnalyzeHostServices struct {
	// contains filtered or unexported fields
}

func (*AnalyzeHostServices) Analyze added in v0.10.15

func (a *AnalyzeHostServices) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error)

func (*AnalyzeHostServices) IsExcluded added in v0.10.15

func (a *AnalyzeHostServices) IsExcluded() (bool, error)

func (*AnalyzeHostServices) Title added in v0.10.15

func (a *AnalyzeHostServices) Title() string

type AnalyzeHostSystemPackages added in v0.24.0

type AnalyzeHostSystemPackages struct {
	// contains filtered or unexported fields
}

func (*AnalyzeHostSystemPackages) Analyze added in v0.24.0

func (a *AnalyzeHostSystemPackages) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error)

func (*AnalyzeHostSystemPackages) IsExcluded added in v0.24.0

func (a *AnalyzeHostSystemPackages) IsExcluded() (bool, error)

func (*AnalyzeHostSystemPackages) Title added in v0.24.0

func (a *AnalyzeHostSystemPackages) Title() string

type AnalyzeHostTCPConnect added in v0.10.8

type AnalyzeHostTCPConnect struct {
	// contains filtered or unexported fields
}

func (*AnalyzeHostTCPConnect) Analyze added in v0.10.8

func (a *AnalyzeHostTCPConnect) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error)

func (*AnalyzeHostTCPConnect) IsExcluded added in v0.10.8

func (a *AnalyzeHostTCPConnect) IsExcluded() (bool, error)

func (*AnalyzeHostTCPConnect) Title added in v0.10.8

func (a *AnalyzeHostTCPConnect) Title() string

type AnalyzeHostTCPLoadBalancer added in v0.10.8

type AnalyzeHostTCPLoadBalancer struct {
	// contains filtered or unexported fields
}

func (*AnalyzeHostTCPLoadBalancer) Analyze added in v0.10.8

func (a *AnalyzeHostTCPLoadBalancer) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error)

func (*AnalyzeHostTCPLoadBalancer) IsExcluded added in v0.10.8

func (a *AnalyzeHostTCPLoadBalancer) IsExcluded() (bool, error)

func (*AnalyzeHostTCPLoadBalancer) Title added in v0.10.8

type AnalyzeHostTCPPortStatus added in v0.10.8

type AnalyzeHostTCPPortStatus struct {
	// contains filtered or unexported fields
}

AnalyzeHostTCPPortStatus is an analyzer that will return only one matching result, or a warning if nothing matches. The first match that is encountered is the one that is returned.

func (*AnalyzeHostTCPPortStatus) Analyze added in v0.10.8

func (a *AnalyzeHostTCPPortStatus) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error)

func (*AnalyzeHostTCPPortStatus) IsExcluded added in v0.10.8

func (a *AnalyzeHostTCPPortStatus) IsExcluded() (bool, error)

func (*AnalyzeHostTCPPortStatus) Title added in v0.10.8

func (a *AnalyzeHostTCPPortStatus) Title() string

type AnalyzeHostTime added in v0.10.8

type AnalyzeHostTime struct {
	// contains filtered or unexported fields
}

func (*AnalyzeHostTime) Analyze added in v0.10.8

func (a *AnalyzeHostTime) Analyze(getCollectedFileContents func(string) ([]byte, error)) ([]*AnalyzeResult, error)

func (*AnalyzeHostTime) IsExcluded added in v0.10.8

func (a *AnalyzeHostTime) IsExcluded() (bool, error)

func (*AnalyzeHostTime) Title added in v0.10.8

func (a *AnalyzeHostTime) Title() string

type AnalyzeResult

type AnalyzeResult struct {
	IsPass bool
	IsFail bool
	IsWarn bool
	Strict bool

	Title   string
	Message string
	URI     string
	IconKey string
	IconURI string

	InvolvedObject *corev1.ObjectReference
}

func Analyze

func Analyze(analyzer *troubleshootv1beta2.Analyze, getFile getCollectedFileContents, findFiles getChildCollectedFileContents) ([]*AnalyzeResult, error)

func AnalyzeLocal added in v0.9.37

func AnalyzeLocal(localBundlePath string, analyzers []*troubleshootv1beta2.Analyze, hostAnalyzers []*troubleshootv1beta2.HostAnalyze) ([]*AnalyzeResult, error)

Analyze local will analyze a locally available (already downloaded) bundle

func DownloadAndAnalyze added in v0.9.1

func DownloadAndAnalyze(bundleURL string, analyzersSpec string) ([]*AnalyzeResult, error)

func HostAnalyze added in v0.10.0

func HostAnalyze(hostAnalyzer *troubleshootv1beta2.HostAnalyze, getFile getCollectedFileContents, findFiles getChildCollectedFileContents) []*AnalyzeResult

func NewAnalyzeResultError added in v0.10.8

func NewAnalyzeResultError(analyzer HostAnalyzer, err error) []*AnalyzeResult

type CephHealth added in v0.9.50

type CephHealth string
const (
	CephHealthOK   CephHealth = "HEALTH_OK"
	CephHealthWarn CephHealth = "HEALTH_WARN"
	CephHealthErr  CephHealth = "HEALTH_ERR"
)

func (CephHealth) Compare added in v0.9.50

func (a CephHealth) Compare(b CephHealth) int

type CephStatus added in v0.15.0

type CephStatus struct {
	Health HealthStatus `json:"health"`
	OsdMap struct {
		OsdMap OsdMap `json:"osdmap"`
	} `json:"osdmap"`
	PgMap PgMap `json:"pgmap"`
}

type CheckMessage added in v0.34.0

type CheckMessage struct {
	Severity string  `json:"severity"`
	Summary  Summary `json:"summary"`
}

type HealthStatus added in v0.15.0

type HealthStatus struct {
	Status string                  `json:"status"`
	Checks map[string]CheckMessage `json:"checks"`
}

type HostAnalyzer added in v0.10.8

type HostAnalyzer interface {
	Title() string
	IsExcluded() (bool, error)
	Analyze(getFile func(string) ([]byte, error)) ([]*AnalyzeResult, error)
}

func GetHostAnalyzer added in v0.10.8

func GetHostAnalyzer(analyzer *troubleshootv1beta2.HostAnalyze) (HostAnalyzer, bool)

type OsdMap added in v0.15.0

type OsdMap struct {
	NumOsd   int  `json:"num_osds"`
	NumUpOsd int  `json:"num_up_osds"`
	Full     bool `json:"full"`
	NearFull bool `json:"nearfull"`
}

type PgMap added in v0.15.0

type PgMap struct {
	UsedBytes  uint64 `json:"bytes_used"`
	TotalBytes uint64 `json:"bytes_total"`
}

type Provider added in v0.9.13

type Provider int

type Summary added in v0.34.0

type Summary struct {
	Message string `json:"message"`
}

type WeaveAttributes added in v0.13.9

type WeaveAttributes struct {
	Encrypted bool   `json:"encrypted"`
	MTU       int    `json:"mtu"`
	Name      string `json:"name"`
}

type WeaveConnection added in v0.13.9

type WeaveConnection struct {
	State string
	Info  string
	Attrs WeaveAttributes
}

type WeaveIPAM added in v0.13.9

type WeaveIPAM struct {
	RangeNumIPs      int
	ActiveIPs        int
	PendingAllocates []string
}

type WeaveRouter added in v0.13.9

type WeaveRouter struct {
	NickName    string // this is the hostname
	Connections []WeaveConnection
}

Jump to

Keyboard shortcuts

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