flasharray

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: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	APIPrefix                             = "/api"
	APIVersionEndpoint                    = "/api/api_version"
	ArrayEndpoint                         = "/array"
	ArrayCapacityMetricsEndpoint          = "/array?space=true"
	ArrayControllersEndpoint              = "/array?controllers=true"
	ArrayPerformanceMetricsEndpoint       = "/array?action=monitor&size=true"
	HostCountEndpoint                     = "/host?start=0&limit=1"
	MessageFlaggedEndpoint                = "/message?flagged=true"
	MessageTimelineEndpoint               = "/message?timeline=true"
	SessionEndpoint                       = "/auth/session"
	VolumeCapacityMetricsEndpoint         = "/volume?space=true"
	VolumeCountEndpoint                   = "/volume?start=0&limit=1"
	VolumePerformanceMetricsEndpoint      = "/volume?action=monitor"
	VolumePendingEradicationCountEndpoint = "/volume?pending_only=true&start=0&limit=1"
	VolumeSnapshotCountEndpoint           = "/volume?snap=true&start=0&limit=1"
	VolumeSnapshotsEndpoint               = "/volume?snap=true"
)

These are endpoint constants

View Source
const (
	PreferredAPIVersion  = "1.7"
	RequestAttemptCount  = 3
	TotalItemCountHeader = "x-total-item-count"
	UserAgent            = "Pure1 Unplugged FlashArray Client v1.0"
	UserAgentHeader      = "User-Agent"
)

These are other constants

Variables

This section is empty.

Functions

func NewCollector

func NewCollector(arrayID string, displayName string, managementEndpoint string, apiToken string, metaConnection resources.ArrayMetadata) (resources.ArrayCollector, error)

NewCollector creates both a new array collector and its underlying array client

Types

type APIVersionResponse

type APIVersionResponse struct {
	Version []string `json:"version"`
}

APIVersionResponse is from /api/api_versions

type AlertResponse

type AlertResponse struct {
	Actual          string `json:"actual"`
	Category        string `json:"category"`
	Closed          string `json:"closed"`
	Code            uint16 `json:"code"`
	ComponentName   string `json:"component_name"`
	ComponentType   string `json:"component_type"`
	CurrentSeverity string `json:"current_severity"`
	Details         string `json:"details"`
	Event           string `json:"event"`
	Expected        string `json:"expected"`
	ID              uint64 `json:"id"`
	Opened          string `json:"opened"`
}

AlertResponse is from /message regardless of parameters

type AlertResponseBundle

type AlertResponseBundle struct {
	FlaggedResponse  []*AlertResponse
	TimelineResponse []*AlertResponse
}

AlertResponseBundle is used to return all alerts responses together

type ArrayCapacityMetricsResponse

type ArrayCapacityMetricsResponse struct {
	Capacity       uint64  `json:"capacity"`
	DataReduction  float64 `json:"data_reduction"`
	SharedSpace    uint64  `json:"shared_space"`
	Snapshots      uint64  `json:"snapshots"`
	SystemSpace    uint64  `json:"system"`
	TotalReduction float64 `json:"total_reduction"`
	TotalSpace     uint64  `json:"total"`
	VolumeSpace    uint64  `json:"volumes"`
}

ArrayCapacityMetricsResponse is from /array with parameters space=true

type ArrayClient

type ArrayClient interface {
	GetAlertsFlagged() ([]*AlertResponse, error)
	GetAlertsTimeline() ([]*AlertResponse, error)
	GetArrayCapacityMetrics() (*ArrayCapacityMetricsResponse, error)
	GetArrayInfo() (*ArrayInfoResponse, error)
	GetArrayPerformanceMetrics() (*ArrayPerformanceMetricsResponse, error)
	GetHostCount() (uint32, error)
	GetModel() (string, error)
	GetVolumeCapacityMetrics() ([]*VolumeCapacityMetricsResponse, error)
	GetVolumeCount() (uint32, error)
	GetVolumePerformanceMetrics() ([]*VolumePerformanceMetricsResponse, error)
	GetVolumePendingEradicationCount() (uint32, error)
	GetVolumeSnapshotCount() (uint32, error)
	GetVolumeSnapshots() ([]*VolumeSnapshotResponse, error)
}

ArrayClient is the interface for the FlashArray client

func NewClient

func NewClient(displayName string, managementEndpoint string, apiToken string) (ArrayClient, error)

NewClient creates a new FlashArray client and initializes it by getting the API version, refreshing a new session, and getting the array metadata

type ArrayControllersResponse

type ArrayControllersResponse struct {
	Mode  string `json:"mode"`
	Model string `json:"model"`
}

ArrayControllersResponse is from /array with parameters controllers=true

type ArrayInfoResponse

type ArrayInfoResponse struct {
	ArrayName string `json:"array_name"`
	ID        string `json:"id"`
	Version   string `json:"version"`
}

ArrayInfoResponse is from /array with no parameters

type ArrayMetricsResponseBundle

type ArrayMetricsResponseBundle struct {
	CapacityMetricsResponse    *ArrayCapacityMetricsResponse
	PerformanceMetricsResponse *ArrayPerformanceMetricsResponse
}

ArrayMetricsResponseBundle is used to return all array metric responses together

type ArrayPerformanceMetricsResponse

type ArrayPerformanceMetricsResponse struct {
	BytesPerRead  uint64 `json:"bytes_per_read"`
	BytesPerWrite uint64 `json:"bytes_per_write"`
	BytesPerOp    uint64 `json:"bytes_per_op"`
	InputPerSec   uint64 `json:"input_per_sec"`
	OutputPerSec  uint64 `json:"output_per_sec"`
	QueueDepth    uint16 `json:"queue_depth"`
	ReadLatency   uint64 `json:"usec_per_read_op"`
	ReadsPerSec   uint64 `json:"reads_per_sec"`
	WriteLatency  uint64 `json:"usec_per_write_op"`
	WritesPerSec  uint64 `json:"writes_per_sec"`
}

ArrayPerformanceMetricsResponse is from /array with parameters action=monitor, size=true

type Client

type Client struct {
	APIToken     string
	APIVersion   string
	DisplayName  string
	ManagementIP net.IP
}

Client is a FlashArray client that handles specific REST API requests

func (*Client) GetAlertsFlagged

func (client *Client) GetAlertsFlagged() ([]*AlertResponse, error)

GetAlertsFlagged returns only flagged alert messages from the array

func (*Client) GetAlertsTimeline added in v1.0.1

func (client *Client) GetAlertsTimeline() ([]*AlertResponse, error)

GetAlertsTimeline returns all alert messages from the array with a "closed" response field

func (*Client) GetArrayCapacityMetrics

func (client *Client) GetArrayCapacityMetrics() (*ArrayCapacityMetricsResponse, error)

GetArrayCapacityMetrics returns all capacity metrics for the array

func (*Client) GetArrayInfo

func (client *Client) GetArrayInfo() (*ArrayInfoResponse, error)

GetArrayInfo returns the basic array metadata

func (*Client) GetArrayPerformanceMetrics

func (client *Client) GetArrayPerformanceMetrics() (*ArrayPerformanceMetricsResponse, error)

GetArrayPerformanceMetrics returns all capacity metrics for the array

func (*Client) GetHostCount

func (client *Client) GetHostCount() (uint32, error)

GetHostCount returns the count of hosts on the array

func (*Client) GetModel

func (client *Client) GetModel() (string, error)

GetModel returns the model of the primary controller (usually CT0)

func (*Client) GetVolumeCapacityMetrics

func (client *Client) GetVolumeCapacityMetrics() ([]*VolumeCapacityMetricsResponse, error)

GetVolumeCapacityMetrics returns the capacity metrics for all volumes

func (*Client) GetVolumeCount

func (client *Client) GetVolumeCount() (uint32, error)

GetVolumeCount returns the count of volumes on the array (without getting all of the volumes)

func (*Client) GetVolumePendingEradicationCount

func (client *Client) GetVolumePendingEradicationCount() (uint32, error)

GetVolumePendingEradicationCount returns the count of volumes that are pending eradication

func (*Client) GetVolumePerformanceMetrics

func (client *Client) GetVolumePerformanceMetrics() ([]*VolumePerformanceMetricsResponse, error)

GetVolumePerformanceMetrics returns the performance metrics for all volumes

func (*Client) GetVolumeSnapshotCount

func (client *Client) GetVolumeSnapshotCount() (uint32, error)

GetVolumeSnapshotCount returns the count of volume snapshots on the array (without getting all of the snapshots)

func (*Client) GetVolumeSnapshots

func (client *Client) GetVolumeSnapshots() ([]*VolumeSnapshotResponse, error)

GetVolumeSnapshots returns volume snapshots

type Collector

type Collector struct {
	ArrayID      string
	ArrayType    string
	Client       ArrayClient
	DisplayName  string
	MgmtEndpoint string
	// contains filtered or unexported fields
}

Collector is a FlashArray collector that uses the client to make requests

func (*Collector) GetAllArrayData

func (collector *Collector) GetAllArrayData() (*metrics.AllArrayData, error)

GetAllArrayData makes multiple underlying requests to get metric data for alerts and the array

func (*Collector) GetAllVolumeData

func (collector *Collector) GetAllVolumeData(timeWindow int64) (*metrics.AllVolumeData, error)

GetAllVolumeData makes multiple underlying requests to get metric data for volumes Note that timeWindow is ignored for FlashArray, and only gets the latest data

func (*Collector) GetArrayID

func (collector *Collector) GetArrayID() string

GetArrayID returns the ID of the array

func (*Collector) GetArrayModel

func (collector *Collector) GetArrayModel() (string, error)

GetArrayModel returns the model of the array

func (*Collector) GetArrayName

func (collector *Collector) GetArrayName() (string, error)

GetArrayName returns the name of the array

func (*Collector) GetArrayTags

func (collector *Collector) GetArrayTags() (map[string]string, error)

GetArrayTags returns the tags of the array from the API server

func (*Collector) GetArrayType

func (collector *Collector) GetArrayType() string

GetArrayType returns the type of array

func (*Collector) GetArrayVersion

func (collector *Collector) GetArrayVersion() (string, error)

GetArrayVersion returns the version of the array

func (*Collector) GetDisplayName

func (collector *Collector) GetDisplayName() string

GetDisplayName returns the display name for the array

type EmptyResponse

type EmptyResponse struct{}

EmptyResponse is from any endpoint where we only read the headers

type ObjectCountResponseBundle

type ObjectCountResponseBundle struct {
	HostCount                     uint32
	SnapshotCount                 uint32
	VolumeCount                   uint32
	VolumePendingEradicationCount uint32
}

ObjectCountResponseBundle is used to return all object count responses together

type VolumeCapacityMetricsResponse

type VolumeCapacityMetricsResponse struct {
	DataReduction  float64 `json:"data_reduction"`
	Name           string  `json:"name"`
	Size           uint64  `json:"size"`
	TotalReduction float64 `json:"total_reduction"`
}

VolumeCapacityMetricsResponse is from /volume with parameters space=true

type VolumePerformanceMetricsResponse

type VolumePerformanceMetricsResponse struct {
	InputPerSec  uint64 `json:"input_per_sec"`
	OutputPerSec uint64 `json:"output_per_sec"`
	Name         string `json:"name"`
	ReadLatency  uint64 `json:"usec_per_read_op"`
	ReadsPerSec  uint64 `json:"reads_per_sec"`
	WriteLatency uint64 `json:"usec_per_write_op"`
	WritesPerSec uint64 `json:"writes_per_sec"`
}

VolumePerformanceMetricsResponse is from /volume with parameters action=monitor

type VolumeSnapshotResponse

type VolumeSnapshotResponse struct {
	Source string `json:"source"`
}

VolumeSnapshotResponse is from /volume with parameters snap=true

Jump to

Keyboard shortcuts

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