collectors

package
v0.0.0-...-61dff04 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2014 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CPU_FIELDS = []string{
	"user",
	"nice",
	"system",
	"idle",
	"iowait",
	"irq",
	"softirq",
	"steal",
	"guest",
	"guest_nice",
}
View Source
var (
	// DefaultFreq is the duration between collection intervals if none is
	// specified.
	DefaultFreq = time.Second * 15
)

Functions

func Add

func Add(md *opentsdb.MultiDataPoint, name string, value interface{}, t opentsdb.TagSet, rate metadata.RateType, unit metadata.Unit, desc string)

Add appends a new data point with given metric name, value, and tags. Tags may be nil. If tags is nil or does not contain a host key, it will be automatically added. If the value of the host key is the empty string, it will be removed (use this to prevent the normal auto-adding of the host tag).

func AddTS

func AddTS(md *opentsdb.MultiDataPoint, name string, ts int64, value interface{}, t opentsdb.TagSet, rate metadata.RateType, unit metadata.Unit, desc string)

AddTS is the same as Add but lets you specify the timestamp

func ICMP

func ICMP(host string)

ICMP registers an ICMP collector a given host.

func InitFake

func InitFake(fake int)

func InitPrograms

func InitPrograms(cpath string)

func IsAlNum

func IsAlNum(s string) bool

IsAlNum returns true if s is alphanumeric.

func IsDigit

func IsDigit(s string) bool

IsDigit returns true if s consists of decimal digits.

func Run

func Run(cs []Collector) chan *opentsdb.DataPoint

Runs specified collectors. Use nil for all collectors.

func SNMPCisco

func SNMPCisco(community, host string)

SNMPCisco registers a SNMP CISCO collector for the given community and host.

func SNMPIfaces

func SNMPIfaces(community, host string)

SNMPIfaces registers a SNMP Interfaces collector for the given community and host.

func TSys100NStoEpoch

func TSys100NStoEpoch(nsec uint64) int64

func Vsphere

func Vsphere(user, pwd, host string)

Vsphere registers a vSphere collector.

func WatchProcesses

func WatchProcesses(procs []*WatchedProc) error

Types

type Collector

type Collector interface {
	Run(chan<- *opentsdb.DataPoint)
	Name() string
	Init()
}
func Search(s string) []Collector

Search returns all collectors matching the pattern s.

type IntervalCollector

type IntervalCollector struct {
	F        func() (opentsdb.MultiDataPoint, error)
	Interval time.Duration // defaults to DefaultFreq if unspecified
	Enable   func() bool

	// internal use
	sync.Mutex
	// contains filtered or unexported fields
}

func (*IntervalCollector) Enabled

func (c *IntervalCollector) Enabled() bool

func (*IntervalCollector) Init

func (c *IntervalCollector) Init()

func (*IntervalCollector) Name

func (c *IntervalCollector) Name() string

func (*IntervalCollector) Run

func (c *IntervalCollector) Run(dpchan chan<- *opentsdb.DataPoint)

type PRSummary

type PRSummary struct {
	Changes struct {
		Total float64 `yaml:"total"`
	} `yaml:"changes"`
	Events struct {
		Failure float64 `yaml:"failure"`
		Success float64 `yaml:"success"`
		Total   float64 `yaml:"total"`
	} `yaml:"events"`
	Resources struct {
		Changed         float64 `yaml:"changed"`
		Failed          float64 `yaml:"failed"`
		FailedToRestart float64 `yaml:"failed_to_restart"`
		OutOfSync       float64 `yaml:"out_of_sync"`
		Restarted       float64 `yaml:"restarted"`
		Scheduled       float64 `yaml:"scheduled"`
		Skipped         float64 `yaml:"skipped"`
		Total           float64 `yaml:"total"`
	} `yaml:"resources"`
	Time struct {
		Augeas           float64 `yaml:"augeas"`
		ConfigRetrieval  float64 `yaml:"config_retrieval"`
		Cron             float64 `yaml:"cron"`
		Exec             float64 `yaml:"exec"`
		File             float64 `yaml:"file"`
		Filebucket       float64 `yaml:"filebucket"`
		Group            float64 `yaml:"group"`
		IniSetting       float64 `yaml:"ini_setting"`
		LastRun          int64   `yaml:"last_run"`
		Package          float64 `yaml:"package"`
		Schedule         float64 `yaml:"schedule"`
		Service          float64 `yaml:"service"`
		SshAuthorizedKey float64 `yaml:"ssh_authorized_key"`
		Total            float64 `yaml:"total"`
		User             float64 `yaml:"user"`
		Yumrepo          float64 `yaml:"yumrepo"`
	} `yaml:"time"`
	Version struct {
		Config string `yaml:"config"`
		Puppet string `yaml:"puppet"`
	} `yaml:"version"`
}

type Process

type Process struct {
	Pid       string
	Command   string
	Arguments string
}

type ProgramCollector

type ProgramCollector struct {
	Path     string
	Interval time.Duration
}

func (*ProgramCollector) Init

func (c *ProgramCollector) Init()

func (*ProgramCollector) Name

func (c *ProgramCollector) Name() string

func (*ProgramCollector) Run

func (c *ProgramCollector) Run(dpchan chan<- *opentsdb.DataPoint)

type WatchedProc

type WatchedProc struct {
	Command   string
	Name      string
	Processes map[string]int
	ArgMatch  *regexp.Regexp
	// contains filtered or unexported fields
}

func NewWatchedProc

func NewWatchedProc(watch string) (*WatchedProc, error)

NewWatchedProc takes a string of the form "command,name,regex".

func (*WatchedProc) Check

func (w *WatchedProc) Check(procs []*Process)

Check finds all matching processes and assigns them a new unique id.

func (*WatchedProc) Remove

func (w *WatchedProc) Remove(pid string)

Jump to

Keyboard shortcuts

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