bun

package module
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2018 License: Unlicense Imports: 13 Imported by: 0

README

Bun

DC/OS diagnostics bundle analysis tool

Installation

Download binaries from the release page or install from source:

$ go get github.com/adyatlov/bun/bun

Usage

$ mkdir bundle
$ unzip bundle.zip -d bundle
$ cd bundle
bundle$ bun check
PROBLEM: dcos-version - Versions are different
Details:
master 172.20.0.22 has DC/OS version 1.11.0
master 172.20.0.24 has DC/OS version 1.11.0
agent 172.20.0.25 has DC/OS version 1.11.0
public agent 172.20.0.26 has DC/OS version 1.11.0
agent 172.20.0.27 has DC/OS version 1.11.0
agent 172.20.0.29 has DC/OS version 1.11.0
agent 172.20.0.21 has DC/OS version 1.10.1
master 172.20.0.23 has DC/OS version 1.11.0
agent 172.20.0.28 has DC/OS version 1.11.0

PROBLEM: health - Some DC/OS systemd units are not healthy.
Details:
172.20.0.21 dcos-docker-gc.service: health = 1

OK: node-count - Masters: 3, Agents: 5, Public Agents: 1, Total: 9

Feedback

Please, report bugs and share your ideas for new features via the issue page.

Contributing

Pull requests are welcome.

Documentation

Index

Constants

View Source
const (
	SUndefined Status = "UNDEFINED"
	SOK               = "OK"
	SProblem          = "PROBLEM"
)
View Source
const (
	JSON    ContentType = "JSON"
	Journal             = "journal"
	Dmesg               = "dmesg"
)
View Source
const (
	Master      HostType = "master"
	Agent                = "agent"
	PublicAgent          = "public agent"
)

Variables

This section is empty.

Functions

func RegisterCheck

func RegisterCheck(ci CheckInfo, c Check)

func RegisterFileType

func RegisterFileType(f FileType)

func SendProg

func SendProg(p chan<- Progress, stage string, step int, count int)

Types

type Bundle

type Bundle struct {
	Path  string
	Hosts map[string]Host // IP to Host map
}

func NewBundle

func NewBundle(ctx context.Context, path string) (Bundle, error)

func (Bundle) OpenFile

func (b Bundle) OpenFile(fileType string) (File, error)

OpenFile opens a file in a root directory of the bundle. The caller is responsible for closing the file.

type Check

type Check func(context.Context, Bundle, chan<- Progress) (Fact, error)

type CheckInfo

type CheckInfo struct {
	Name        string
	Description string
}

func Checks

func Checks() []CheckInfo

type ContentType

type ContentType string

type Fact

type Fact struct {
	Status     Status
	Short      string
	Long       string
	Errors     []string
	Structured interface{}
}

Fact is a piece of knowledge about DC/OS cluster learned from a diagnostic bundle.

type File added in v1.2.0

type File io.ReadCloser

func OpenFile

func OpenFile(basePath string, typeName string) (file File, err error)

OpenFile opens bundle file. Caller is responsible for closing the file.

type FileSystem added in v1.2.0

type FileSystem interface {
	// ReadDir reads the directory named by dirname and returns
	// a list of directory entries sorted by filename.
	// It's mocking the io/ioutil.ReadDir.
	ReadDir(string) ([]os.FileInfo, error)

	// Open opens the named file for reading. If successful, methods on
	// the returned file can be used for reading.
	// It's partially mocking the os.Open function.
	Open(string) (File, error)

	// Getwd returns a rooted path name corresponding to the
	// current directory. If the current directory can be
	// reached via multiple paths (due to symbolic links),
	// Getwd may return any one of them.
	// It's mocking os.Getwd.
	Getwd() (string, error)
}

type FileType

type FileType struct {
	Name        string
	ContentType ContentType
	// If HostTypes is not empty, then Path is relative to the host's directory,
	// otherwise, it's relative to the bundle's root directory.
	Paths       []string
	Description string
	HostTypes   map[HostType]struct{}
}

func GetFileType

func GetFileType(typeName string) (FileType, error)

type Host

type Host struct {
	Type HostType
	IP   string
	Path string
}

func (Host) OpenFile

func (h Host) OpenFile(fileType string) (io.ReadCloser, error)

OpenFile opens a host-related file. Caller is responsible for closing the file.

type HostType

type HostType string

type NamedProgress

type NamedProgress struct {
	Name string
	Progress
}

type OSFS added in v1.2.0

type OSFS struct {
}

osFS implements FileSystem

func (OSFS) Getwd added in v1.2.0

func (osfs OSFS) Getwd() (string, error)

func (OSFS) Open added in v1.2.0

func (osfs OSFS) Open(name string) (File, error)

func (OSFS) ReadDir added in v1.2.0

func (osfs OSFS) ReadDir(dirname string) ([]os.FileInfo, error)

type Progress

type Progress struct {
	Stage string
	Step  int
	Count int
}

type Report

type Report struct {
	CheckInfo
	Fact
}

func RunCheck

func RunCheck(ctx context.Context, name string, b Bundle,
	np chan<- NamedProgress) (Report, error)

func RunCheckSimple added in v1.2.0

func RunCheckSimple(name string, b Bundle) (Report, error)

type Status

type Status string

Directories

Path Synopsis
bun
cmd
check

Jump to

Keyboard shortcuts

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