gohop

package
v0.0.0-...-0df215e Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2016 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CycleAuto  = "auto"
	Cycle30Sec = "30sec"
	Cycle5Min  = "5min"
	Cycle1Hr   = "1hr"
	Cycle24Hr  = "24hr"
)

Posible Values for the Cycle Parameter of a Metric Query

Functions

This section is empty.

Types

type Client

type Client struct {
	APIKey  string
	APIUrl  *url.URL
	APIHost string
}

func NewClient

func NewClient(APIUrl, APIKey string) *Client

NewClient creates an instance of a ExtraHop REST API v1 client.

func (*Client) GetNetworkList

func (c *Client) GetNetworkList(FetchVlans bool) (NetworkList, error)

func (*Client) GetVlanList

func (c *Client) GetVlanList(NetworkId int64, l *VlanList) error

func (*Client) KeyedMetricQuery

func (c *Client) KeyedMetricQuery(cycle, category, objectType string, fromMS, untilMS int64, metrics []MetricSpec,
	objectIds []int64) (MetricResponseKeyed, error)

func (*Client) SimpleMetricQuery

func (c *Client) SimpleMetricQuery(cycle, category, objectType string, fromMS, untilMS int64, metrics []MetricSpec, objectIds []int64) (MetricResponseSimple, error)

Simple Metric query is for when you are making a query that doesn't have any facets ("Keys").

type ExtraHopMetric

type ExtraHopMetric struct {
	ObjectType         string
	ObjectId           int64
	MetricCategory     string
	MetricSpecName     string
	MetricSpecCalcType string
}

func StoEHMetric

func StoEHMetric(i string) (ExtraHopMetric, error)

type KeyPair

type KeyPair struct {
	Key1Regex        string `json:"key1,omitempty"`
	Key2Regex        string `json:"key2,omitempty"` // I can't find an example using 2 keys at the moment
	OpenTSDBKey1     string `json:"-"`
	Key2OpenTSDBKey2 string `json:"-"`
}

type MetricQuery

type MetricQuery struct {
	// Can be"auto", "30sec", "5min", "1hr", "24hr"
	Cycle string `json:"cycle:`
	From  int64  `json:"from"`
	// Currently these seem secret, can be net or app though
	Category string `json:"metric_category"`
	//Stats.Values in the response becomes increases in length when there are more than one stat MetricSpec Requested
	Specs []MetricSpec `json:"metric_specs"`
	// OID becomes
	ObjectIds []int64 `json:"object_ids"`
	//Can be "network", "device", "application", "vlan", "device_group", and "activity_group".
	Type  string `json:"object_type"`
	Until int64  `json:"until"`
}

Metrics

type MetricResponseBase

type MetricResponseBase struct {
	Cycle  string `json:"cycle"`
	From   int64  `json:"from"`
	NodeID int64  `json:"node_id"`
	Until  int64  `json:"until"`
}

type MetricResponseKeyed

type MetricResponseKeyed struct {
	MetricResponseBase
	Stats []MetricStatKeyed `json:"stats"`
}

func (*MetricResponseKeyed) OpenTSDBDataPoints

func (mr *MetricResponseKeyed) OpenTSDBDataPoints(metrics []MetricSpec, objectKey string, objectIdToName map[int64]string) (opentsdb.MultiDataPoint, error)

Keyed Metric query is for when you are making a query that has facets ("Keys"). For example bytes "By L7 Protocol"

type MetricResponseSimple

type MetricResponseSimple struct {
	MetricResponseBase
	Stats []MetricStatSimple `json:"stats"`
}

func (*MetricResponseSimple) OpenTSDBDataPoints

func (mr *MetricResponseSimple) OpenTSDBDataPoints(metricNames []string, objectKey string, objectIdToName map[int64]string) (opentsdb.MultiDataPoint, error)

type MetricSpec

type MetricSpec struct {
	Name     string `json:"name"`
	CalcType string `json:"calc_type"`
	// The type of Stats.Values changes when there are keys added. It goes from []ints to an [][]structs, so the tag can be included
	KeyPair
	Percentiles []int64 `json:"percentiles,omitempty"`
	// The following are not part of the extrahop API
	OpenTSDBMetric string `json:"-"`
}

type MetricStat

type MetricStat struct {
	Duration int64 `json:"duration"`
	Oid      int64 `json:"oid"`
	Time     int64 `json:"time"`
}

type MetricStatKeyed

type MetricStatKeyed struct {
	MetricStat
	Values [][]struct {
		Key struct {
			KeyType string `json:"key_type"`
			Str     string `json:"str"`
		} `json:"key"`
		Value int64  `json:"value"`
		Vtype string `json:"vtype"`
	} `json:"values"`
}

type MetricStatSimple

type MetricStatSimple struct {
	MetricStat
	Values []float64 `json:"values"`
}

type NetworkList

type NetworkList []struct {
	Id          int64    `json:"id"`
	NodeId      int64    `json:"node_id"`
	Description string   `json:"description"`
	Name        string   `json:"name"`
	Idle        bool     `json:"idle"`
	Vlans       VlanList //This is not part of the JSON returned by ExtraHop's /network endpoint, so this gets populated by a 2nd step.
}

type VlanList

type VlanList []struct {
	Id          int64  `json:"id"`
	NetworkId   int64  `json:"network_id"`
	VlanId      int64  `json:"vlanid"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

Jump to

Keyboard shortcuts

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