plugins

package
v0.0.0-...-5884264 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2016 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

+build linux

+build linux

Index

Constants

View Source
const (
	MeminfoFile = "/proc/meminfo"
)

Variables

This section is empty.

Functions

func CollectorWrapper

func CollectorWrapper(done <-chan bool, plug DataCollector) (<-chan Result, <-chan error)

CollectorWrapper wraps plugins to create channels and call CollectData as a goroutine.

Returns a result channel and an error channel

func SplitMeminfoLine

func SplitMeminfoLine(line string) (string, string)

SplitMeminfoLine splits each line of /proc/meminfo into key/value pairs. Returns a string and a string pair.

Types

type Collection

type Collection struct {
	Items map[string]Result
}

Collection is a group of metrics namespaced by their plugin name.

func NewCollection

func NewCollection() Collection

Returns a Collection instance

type DataCollector

type DataCollector interface {
	CollectData() (string, map[string]*MetricValue, error)
}

DataCollector's must define a CollectData() method.

` type MemoryPlugin struct {}

func (plug MemoryPlugin) CollectData() (string, map[string]*MetricValue, error) { ... } `

type Memory

type Memory struct {
	Name string
}

func (*Memory) CollectData

func (m *Memory) CollectData() (string, map[string]*MetricValue, error)

Memory.CollectData returns memory information about the system. Values are in KB. Returns a string and a map[string]interface{}.

type MetricValue

type MetricValue struct {
	Val string
}

type Platform

type Platform struct {
	Name string
}

func (Platform) CollectData

func (p Platform) CollectData() (string, map[string]*MetricValue, error)

type Result

type Result struct {
	PluginName string
	Metrics    map[string]*MetricValue
}

Result is a struct that holds a map of metrics for a specific plugin.

Jump to

Keyboard shortcuts

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