cloudwatcher

package
v2.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2020 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name  = "cloudwatcher"
	Usage = `` /* 379-byte string literal not displayed */

)

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregationData

type AggregationData interface {
	// AddSample adds the given node to the data series
	AddSample(*NodeStats)

	// Datum returns the aggregated data as a CloudWatch
	// Metrics data point.
	Datum() *cloudwatch.MetricDatum
}

AggregationData represents a container for some data series about Elasticsearch nodes, that can be converted into a CloudWatch Metrics data point.

type App

type App struct {
	*kingpin.Application
	// contains filtered or unexported fields
}

App holds application state.

func NewApp

func NewApp(r prometheus.Registerer) (*App, error)

NewApp returns a new App.

func (*App) Main

func (app *App) Main(g prometheus.Gatherer)

Main is the main method of App and should be called in main.main() after flag parsing.

type EC2Instance

type EC2Instance struct {
	ID    string
	VCPUs int
}

EC2Instance is simplified version of an ec2.Instance that can be cached.

func NewEC2Instance

func NewEC2Instance(i ec2.Instance) *EC2Instance

NewEC2Instance returns a new EC2Instance.

type Flags

type Flags struct {
	// CloudWatch namespace to push metrics to.
	Namespace string

	// The interval at which cloudwatcher should poll
	// Elasticsearch for status information.
	PollInterval time.Duration

	*cmd.AWSFlags
	*cmd.ElasticsearchFlags
	*cmd.LoggingFlags
	*cmd.ServerFlags
}

Flags holds command line flags for the cloudwatcher App.

func NewFlags

func NewFlags(app *kingpin.Application) *Flags

NewFlags returns a new Flags.

func (*Flags) Tick

func (f *Flags) Tick() <-chan time.Time

Tick returns a channel on which

type Healthchecks

type Healthchecks struct {
	Handler healthcheck.Handler

	// Flag to be set true once a connection
	// to Elasticsearch is successfully established.
	ElasticSessionCreated bool

	// Flag to be set true once an AWS session
	// has been successfully created.
	AWSSessionCreated bool
}

func NewHealthchecks

func NewHealthchecks(r prometheus.Registerer, namespace string) *Healthchecks

type Instrumentation

type Instrumentation struct {
	// Count of the number of times cloudwatcher has
	// polled Elasticsearch for information.
	Loops prometheus.Counter

	// Total number of metrics pushed to CloudWatch.
	MetricsPushed prometheus.Counter

	// Hit ratio of the EC2Instances cache.
	EC2InstancesCacheHitRatio prometheus.GaugeFunc
}

Instrumentation holds Prometheus metrics specific to the cloudwatcher App.

func NewInstrumentation

func NewInstrumentation(namespace string, ec2InstancesCache *ristretto.Cache) *Instrumentation

NewInstrumentation returns a new Metrics.

func (*Instrumentation) Collect

func (m *Instrumentation) Collect(c chan<- prometheus.Metric)

Collect implements the prometheus.Collector interface.

func (*Instrumentation) Describe

func (m *Instrumentation) Describe(c chan<- *prometheus.Desc)

Describe implements the prometheus.Collector interface.

type JVMHeapStats

type JVMHeapStats struct {
	MaxBytes  int64
	UsedBytes int64
}

JVMHeapStats represents stats about the JVM heap of an Elasticsearch node.

type NodeStats

type NodeStats struct {
	Name  string
	Roles []string

	// Node is excluded from shard allocation.
	ExcludedFromAllocation bool

	// Count of vCPUs.
	VCPUs int

	// Linux load.
	Load1m  float64
	Load5m  float64
	Load15m float64

	// JVM heap stats.
	JVMHeapStats JVMHeapStats
	JVMHeapPools map[string]JVMHeapStats

	// Elasticsearch disk size in bytes.
	FilesystemTotalBytes int64

	// Elasticsearch disk available bytes.
	FilesystemAvailableBytes int64
}

NodeStats represents stats about an Elasticsearch node.

func NewNodeStats

NewNodeStats returns a new nodeStats based on the responses from various APIs. It returns ErrInconsistentNodes if the responses are for different nodes.

func (*NodeStats) HasRole

func (s *NodeStats) HasRole(role string) bool

HasRole returns true if the node has a particular role.

type NodeStatsSlice

type NodeStatsSlice []*NodeStats

NodeStatsSlice is a slice of nodeStats.

func (NodeStatsSlice) Aggregate

func (s NodeStatsSlice) Aggregate(dimensions []cloudwatch.Dimension) []cloudwatch.MetricDatum

Aggregate the nodeStats of this slice into a set of CloudWatch metric data points.

Metrics include:

- File system utilization (data nodes only) - JVM heap utilization (both in total, and per-memory pool) - Linux Load - Count of nodes excluded from shard allocation

type SelectorFn

type SelectorFn func(*NodeStats) *float64

SelectorFn returns some aspect of a NodeStats to be aggregated. If the node shouldn't count towards a data set, the selector function should return nil.

type StatsData

type StatsData struct {
	Template cloudwatch.MetricDatum
	Selector SelectorFn
	// contains filtered or unexported fields
}

StatsData aggregates count, min, max, and sum of the samples.

func (*StatsData) AddSample

func (d *StatsData) AddSample(ns *NodeStats)

func (*StatsData) Datum

func (d *StatsData) Datum() *cloudwatch.MetricDatum

type SumData

type SumData struct {
	Template cloudwatch.MetricDatum
	Selector SelectorFn
	// contains filtered or unexported fields
}

SumData aggregates a simple sum of samples.

func (*SumData) AddSample

func (d *SumData) AddSample(ns *NodeStats)

func (*SumData) Datum

func (d *SumData) Datum() *cloudwatch.MetricDatum

type UtilizationData

type UtilizationData struct {
	Template    cloudwatch.MetricDatum
	Numerator   SelectorFn
	Denominator SelectorFn
	// contains filtered or unexported fields
}

UtilizationData aggregates a percentage representing the utilization of some resource based on numerator and denominator. For example, disk utilization == bytes used / bytes total.

func (*UtilizationData) AddSample

func (d *UtilizationData) AddSample(ns *NodeStats)

func (*UtilizationData) Datum

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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