elastic

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2020 License: Apache-2.0 Imports: 12 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetErrorLogIndexName

func GetErrorLogIndexName() string

GetErrorLogIndexName returns the dynamic index name for error logs

func GetTimerLogIndexName

func GetTimerLogIndexName() string

GetTimerLogIndexName returns then dynamic index name for timer logs

Types

type Client

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

Client is a wrapper around the core Elastic Client struct which provides some additional methods. It also implements the metrics.Database interface and will, in the future, implement the API server-related resources.ArrayDatabase interface as well.

func InitializeClient

func InitializeClient(host string, maxAttempts uint, attemptDelay time.Duration) (*Client, error)

InitializeClient creates a new Client and has it attempt to connect

func (*Client) AddArrayMetrics

func (c *Client) AddArrayMetrics(metrics []*metrics.ArrayMetric) error

AddArrayMetrics adds the given metrics to both the time-series and latest indices

func (*Client) AddVolumeMetrics

func (c *Client) AddVolumeMetrics(metrics []*metrics.VolumeMetric) error

AddVolumeMetrics adds the given volume metrics to both the time-series and latest indices

func (*Client) CleanAlerts

func (c *Client) CleanAlerts(maxAgeInDays int) error

CleanAlerts deletes all alerts older than the given age in days

func (*Client) CleanArrayMetrics

func (c *Client) CleanArrayMetrics(maxAgeInDays int) error

CleanArrayMetrics deletes all indices that are older than the given age in days and marks any older than today as read-only

func (*Client) CleanErrorLogs

func (c *Client) CleanErrorLogs(maxAgeInDays int) error

CleanErrorLogs deletes all error logs that are older than the given age in days and marks any older than today as read-only

func (*Client) CleanTimerLogs

func (c *Client) CleanTimerLogs(maxAgeInDays int) error

CleanTimerLogs deletes all timer logs that are older than the given age in days and marks any older than today as read-only

func (*Client) CleanVolumeMetrics

func (c *Client) CleanVolumeMetrics(maxAgeInDays int) error

CleanVolumeMetrics deletes all volume indices that are older than the given age in days and marks any older than today as read-only

func (*Client) Client

func (e *Client) Client() *elastic.Client

Client returns the inner Elastic client to perform standard Elasticsearch calls on

func (*Client) Connect

func (e *Client) Connect() error

Connect will attempt to connect this Client instance to the Elastic server

func (*Client) Connected

func (e *Client) Connected(ctx context.Context) bool

Connected checks if this Client is connected with a couple basic checks

func (*Client) CreateAlertsTemplate

func (c *Client) CreateAlertsTemplate(ctx context.Context) error

CreateAlertsTemplate creates the template for the alert index

func (*Client) CreateArrayMetricsTemplate

func (c *Client) CreateArrayMetricsTemplate(ctx context.Context) error

CreateArrayMetricsTemplate creates the template for the array metrics indices

func (*Client) CreateArrayTemplate

func (c *Client) CreateArrayTemplate(ctx context.Context) error

CreateArrayTemplate creates the template for the array index

func (*Client) CreateErrorLogTemplate

func (c *Client) CreateErrorLogTemplate(ctx context.Context) error

CreateErrorLogTemplate creates the template for the error logs

func (*Client) CreateTimerLogTemplate

func (c *Client) CreateTimerLogTemplate(ctx context.Context) error

CreateTimerLogTemplate creates the template for the error logs

func (*Client) CreateVolumeMetricsTemplate

func (c *Client) CreateVolumeMetricsTemplate(ctx context.Context) error

CreateVolumeMetricsTemplate creates the template for the volume metrics indices

func (*Client) DeleteArray

func (c *Client) DeleteArray(query *resources.ArrayQuery) ([]string, error)

DeleteArray deletes the devices matching the given query from Elastic.

func (*Client) DeleteByQuery

func (e *Client) DeleteByQuery(ctx context.Context, indexName string, query elastic.Query) error

DeleteByQuery deletes documents by query in the given index

func (*Client) DeleteIndices

func (e *Client) DeleteIndices(ctx context.Context, indexNames []string) error

DeleteIndices deletes the given indices

func (*Client) EnsureConnected

func (e *Client) EnsureConnected(ctx context.Context) error

EnsureConnected provides a method such that, once called, the client is guaranteed to be connected or an error will be thrown

func (*Client) FindArrays

func (c *Client) FindArrays(query *resources.ArrayQuery) ([]*resources.Array, error)

FindArrays searches with the given query to find arrays. Note that this leaves the API token blank, and thus it will need to be filled in by the calling method.

func (*Client) InsertArray

func (c *Client) InsertArray(device *resources.Array) error

InsertArray inserts the given storage device into Elastic.

func (*Client) PatchArray

func (c *Client) PatchArray(device *resources.Array) (*resources.Array, error)

PatchArray patches the given device's fields (except for tags).

func (*Client) PatchArrayTags

func (c *Client) PatchArrayTags(device *resources.Array) (*resources.Array, error)

PatchArrayTags patches the tags on the given device.

func (*Client) UpdateAlerts

func (c *Client) UpdateAlerts(alerts []*metrics.Alert) error

UpdateAlerts upserts the given alerts

Jump to

Keyboard shortcuts

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