thousandeyes

package
v0.0.0-...-8b8d914 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// dynamic metrics
	// Network Path Visualization
	ThousandTestNetPathVisNumberOfHopsDesc = prometheus.NewDesc(
		"thousandeyes_test_network_path_visualizion_number_of_hops",
		"Network Vis Path test ran in ThousandEyes - metric: numberOfHops.",
		[]string{"test_id", "type", "prefix", "agent_name", "agent_id", "country_id", "source_ip", "ip_address", "path_id"},
		nil)
	ThousandTestNetPathVisResponseTimeDesc = prometheus.NewDesc(
		"thousandeyes_test_network_path_visualizion_response_time_milliseconds",
		"Network Vis Path test ran in ThousandEyes - metric: responseTime.",
		[]string{"test_id", "type", "prefix", "agent_name", "agent_id", "country_id", "source_ip", "ip_address", "path_id"},
		nil)
	// - alerts
	ThousandAlertDesc = prometheus.NewDesc(
		"thousandeyes_alert",
		"triggered / active alerts for a rule in ThousandEyes.",
		[]string{"test_name", "type", "rule_name", "rule_expression"},
		nil)
	ThousandAlertHTMLReachabilitySuccessRatioDesc = prometheus.NewDesc(
		"thousandeyes_alert_html_reachability_ratio",
		"Reachability Success Ratio Gauge defined by: 1 - ViolationCount / MonitorCount ",
		[]string{"test_name", "type", "rule_name", "rule_expression"},
		nil)
	// - bgp tests
	ThousandTestBGPReachabilityDesc = prometheus.NewDesc(
		"thousandeyes_test_bgp_reachability_percentage",
		"BGP test ran in ThousandEyes - metric: reachability.",
		[]string{"test_id", "test_name", "type", "prefix", "country", "monitor_name"},
		nil)
	//ThousandTestBGPUpdatesDesc
	ThousandTestBGPUpdatesDesc = prometheus.NewDesc(
		"thousandeyes_test_bgp_updates",
		"BGP test ran in ThousandEyes - metric: updates.",
		[]string{"test_id", "test_name", "type", "prefix", "country", "monitor_name"},
		nil)
	ThousandTestBGPPathChangesDesc = prometheus.NewDesc(
		"thousandeyes_test_bgp_path_changes",
		"BGP test ran in ThousandEyes - metric: pathChanges.",
		[]string{"test_id", "test_name", "type", "prefix", "country", "monitor_name"},
		nil)

	// - html tests web
	ThousandTestHTMLconnectTimeDesc = prometheus.NewDesc(
		"thousandeyes_test_html_avg_connect_time_milliseconds",
		"HTML test ran in ThousandEyes - metric: connectTime.",
		[]string{"test_id", "test_name", "type", "prefix", "country", "agent_name"},
		nil)
	//ThousandTestHTMLDNSTimeDesc
	ThousandTestHTMLDNSTimeDesc = prometheus.NewDesc(
		"thousandeyes_test_html_avg_dns_time_milliseconds",
		"HTML test ran in ThousandEyes - metric: dnsTime.",
		[]string{"test_id", "test_name", "type", "prefix", "country", "agent_name"},
		nil)
	//ThousandTestHTMLRedirectsDesc
	ThousandTestHTMLRedirectsDesc = prometheus.NewDesc(
		"thousandeyes_test_html_num_redirects",
		"HTML test ran in ThousandEyes - metric: NumRedirects.",
		[]string{"test_id", "test_name", "type", "prefix", "country", "agent_name"},
		nil)
	//ThousandTestHTMLreceiveTimeDesc
	ThousandTestHTMLreceiveTimeDesc = prometheus.NewDesc(
		"thousandeyes_test_html_receiveTime_milliseconds",
		"HTML test ran in ThousandEyes - metric: receiveTime.",
		[]string{"test_id", "test_name", "type", "prefix", "country", "agent_name"},
		nil)
	//ThousandTestHTMLresponseCodeDesc
	ThousandTestHTMLresponseCodeDesc = prometheus.NewDesc(
		"thousandeyes_test_html_response_code",
		"HTML test ran in ThousandEyes - metric: responseCode.",
		[]string{"test_id", "test_name", "type", "prefix", "country", "agent_name"},
		nil)
	ThousandTestHTMLresponseTimeDesc = prometheus.NewDesc(
		"thousandeyes_test_html_response_time_milliseconds",
		"HTML test ran in ThousandEyes - metric: responseTime.",
		[]string{"test_id", "test_name", "type", "prefix", "country", "agent_name"},
		nil)
	//ThousandTestHTMLTotalTimeDesc
	ThousandTestHTMLTotalTimeDesc = prometheus.NewDesc(
		"thousandeyes_test_html_total_time_milliseconds",
		"HTML test ran in ThousandEyes - metric: totalTime.",
		[]string{"test_id", "test_name", "type", "prefix", "country", "agent_name"},
		nil)
	ThousandTestHTMLwaitTimeDesc = prometheus.NewDesc(
		"thousandeyes_test_html_wait_time_milliseconds",
		"HTML test ran in ThousandEyes - metric: waitTime.",
		[]string{"test_id", "test_name", "type", "prefix", "country", "agent_name"},
		nil)
	ThousandTestHTMLwireSizeDesc = prometheus.NewDesc(
		"thousandeyes_test_html_wire_size_byte",
		"HTML test ran in ThousandEyes - metric: wireSize.",
		[]string{"test_id", "test_name", "type", "prefix", "country", "agent_name"},
		nil)

	// - html tests metrics
	ThousandTestHTMLLossDesc = prometheus.NewDesc(
		"thousandeyes_test_html_loss_percentage",
		"HTML test ran in ThousandEyes - metric: loss.",
		[]string{"test_id", "test_name", "type", "prefix", "country", "agent_name"},
		nil)
	//ThousandTestHTMLAvgLatencyDesc
	ThousandTestHTMLAvgLatencyDesc = prometheus.NewDesc(
		"thousandeyes_test_html_avg_latency_milliseconds",
		"HTML test ran in ThousandEyes - metric: avgLatency.",
		[]string{"test_id", "test_name", "type", "prefix", "country", "agent_name"},
		nil)
	//ThousandTestHTMLMinLatencyDesc
	ThousandTestHTMLMinLatencyDesc = prometheus.NewDesc(
		"thousandeyes_test_html_min_latency_milliseconds",
		"HTML test ran in ThousandEyes - metric: minLatency.",
		[]string{"test_id", "test_name", "type", "prefix", "country", "agent_name"},
		nil)
	ThousandTestHTMLMaxLatencyDesc = prometheus.NewDesc(
		"thousandeyes_test_html_max_latency_milliseconds",
		"HTML test ran in ThousandEyes - metric: maxLatency.",
		[]string{"test_id", "test_name", "type", "prefix", "country", "agent_name"},
		nil)
	//ThousandTestHTMLJitterDesc
	ThousandTestHTMLJitterDesc = prometheus.NewDesc(
		"thousandeyes_test_html_jitter_milliseconds",
		"HTML test ran in ThousandEyes - metric: jitter.",
		[]string{"test_id", "test_name", "type", "prefix", "country", "agent_name"},
		nil)

	// fixed metrics
	ThousandRequestsTotalMetric = prometheus.NewCounter(prometheus.CounterOpts{
		Name: "thousandeyes_requests_total",
		Help: "The number requests done against ThousandEyes API.",
	})
	//ThousandRequestsFailMetric
	ThousandRequestsFailMetric = prometheus.NewCounter(prometheus.CounterOpts{
		Name: "thousandeyes_requests_fails",
		Help: "The number requests failed against ThousandEyes API.",
	})
	//ThousandRequestParsingFailMetric
	ThousandRequestParsingFailMetric = prometheus.NewCounter(prometheus.CounterOpts{
		Name: "thousandeyes_parsing_fails",
		Help: "The number request parsing failed.",
	})
	//ThousandRequestScrapingTime
	ThousandRequestScrapingTime = prometheus.NewGauge(prometheus.GaugeOpts{
		Name: "thousandeyes_scraping_seconds",
		Help: "TEST2: The number of scraping time in seconds.",
	})
	//ThousandRequestAPILimitReached
	ThousandRequestAPILimitReached = prometheus.NewGauge(prometheus.GaugeOpts{
		Name: "thousandeyes_api_request_limit_reached",
		Help: "0 no, 1 hit limit. Request not complete. Tests Details skipped first",
	})
	ThousandRequestsetRospectionPeriodMetric = prometheus.NewGauge(prometheus.GaugeOpts{
		Name: "thousandeyes_retrospection_period_seconds",
		Help: "TEST: The number of seconds into the past we query ThousandEyes for.",
	})

	// stuff for 1000 eyes API
	RetrospectionPeriod = flag.Duration(
		"retrospectionPeriod",
		0,
		"The number of hours into the past we query ThousandEyes for. You should it just use for Debugging! Syntax: 1800h")
)

Functions

func CallParallel

func CallParallel(token string, user string, isBasicAuth bool, requests []Request) (bHitRateLimit bool, bError bool)

CallParallel does CallSingle calls in parallel - can hit thousandeyes api restrictions easily it returns true, if the API Rate Limit was hit the error & result object itself are modified in the Request struct

func CallSequence

func CallSequence(token string, user string, isBasicAuth bool, requests []Request) (bHitAPILimit bool, bError bool)

CallSequence does CallSingle calls one after the other it returns true, if the API Rate Limit was hit the error & result object itself are modified in the Request struct

func CallSingle

func CallSingle(token string, user string, isBasicAuth bool, request *Request) (bHitAPILimit bool, bError bool)

CallSingle is a single URL call it returns true, if the API Rate Limit was hit the error & result object itself are modified in the Request struct

Types

type BGPTestResults

type BGPTestResults struct {
	Net struct {
		Test       ThousandTest `json:"test"`
		BgpMetrics []struct {
			CountryID    string  `json:"countryId"`
			Prefix       string  `json:"prefix"`
			MonitorName  string  `json:"monitorName"`
			Reachability float32 `json:"reachability"`
			Updates      float32 `json:"updates"`
			PathChanges  float32 `json:"pathChanges"`
		} `json:"bgpMetrics"`
	} `json:"net"`
}

BGPTestResults BGP Test details

type Collector

type Collector struct {
	//thousandEyes *ThousandEyes
	IsBasicAuth bool
	Token       string
	User        string
	//tbd: RefreshToken string
	IsCollectNetPathViz  bool
	IsCollectBgp         bool
	IsCollectHttp        bool
	IsCollectHttpMetrics bool
}

func (Collector) Collect

func (t Collector) Collect(ch chan<- prometheus.Metric)

func (*Collector) Describe

func (t *Collector) Describe(ch chan<- *prometheus.Desc)

func (*Collector) GetAlerts

func (t *Collector) GetAlerts() (ThousandAlerts, bool, bool)

func (*Collector) GetTests

func (t *Collector) GetTests() (bgpMs []BGPTestResults,
	httpMs []HTTPTestMetricResults,
	httpWs []HTTPTestWebServerResults,
	netPathVis []NetworkPathVisualizationResults,
	bHitAPILimit,
	bError bool)

type HTTPTestMetricResults

type HTTPTestMetricResults struct {
	Net struct {
		Test        ThousandTest `json:"test"`
		HTTPMetrics []struct {
			AvgLatency float32 `json:"avgLatency"`
			Loss       float32 `json:"loss"`
			MaxLatency float32 `json:"maxLatency"`
			Jitter     float32 `json:"jitter"`
			MinLatency float32 `json:"minLatency"`
			ServerIP   string  `json:"serverIp"`
			AgentName  string  `json:"agentName"`
			CountryID  string  `json:"countryId"`
		} `json:"metrics"`
	} `json:"net"`
}

HTTPTestMetricResults HTTP Test details on network metrics

type HTTPTestWebServerResults

type HTTPTestWebServerResults struct {
	Web struct {
		Test       ThousandTest `json:"test"`
		HTTPServer []struct {
			ConnectTime  int    `json:"connectTime"`
			DNSTime      int    `json:"dnsTime"`
			ErrorType    string `json:"errorType"`
			NumRedirects int    `json:"numRedirects"`
			ReceiveTime  int    `json:"receiveTime"`
			ResponseCode int    `json:"responseCode"`
			ResponseTime int    `json:"responseTime"`
			TotalTime    int    `json:"totalTime"`
			WaitTime     int    `json:"waitTime"`
			WireSize     int    `json:"wireSize"`
			AgentName    string `json:"agentName"`
			CountryID    string `json:"countryId"`
			Date         string `json:"date"`
			AgentID      int    `json:"agentId"`
			RoundID      int    `json:"roundId"`
		} `json:"httpServer"`
	} `json:"web"`
}

HTTPTestWebServerResults HTTP Test details on Server Response

type NetworkPathVisualizationResults

type NetworkPathVisualizationResults struct {
	Net struct {
		Test    ThousandTest `json:"test"`
		PathVis []struct {
			AgentName string `json:"agentName"`
			AgentID   int    `json:"agentId"`
			CountryID string `json:"countryId"`
			ServerIp  string `json:"serverIp"`
			SourceIp  string `json:"sourceIp"`
			EndPoints []struct {
				NumberOfHops int    `json:"numberOfHops"`
				IpAddress    string `json:"ipAddress"`
				ResponseTime int    `json:"responseTime"`
				PathId       string `json:"pathId"`
			} `json:"endPoints"`
		} `json:"pathVis"`
	} `json:"net"`
}

Test Type agent-to-agent Network - Path Visualization https://developer.thousandeyes.com/v6/test_data/#/path-vis

type Request

type Request struct {
	URL            string
	ResponseCode   int
	ResponseObject interface{}
	Error          error
}

ThousandeyesRequest the request struct

type ThousandAlerts

type ThousandAlerts struct {
	From  string `json:"from"`
	Alert []struct {
		Active    int    `json:"active"`
		AlertID   int    `json:"alertId"`
		DateEnd   string `json:"dateEnd,omitempty"`
		DateStart string `json:"dateStart"`
		Monitors  []struct {
			Active         int    `json:"active"`
			MetricsAtStart string `json:"metricsAtStart"`
			MetricsAtEnd   string `json:"metricsAtEnd"`
			MonitorID      int    `json:"monitorId"`
			MonitorName    string `json:"monitorName"`
			PrefixID       int    `json:"prefixId"`
			Prefix         string `json:"prefix"`
			DateStart      string `json:"dateStart"`
			DateEnd        string `json:"dateEnd"`
			Permalink      string `json:"permalink"`
			Network        string `json:"network"`
		} `json:"monitors,omitempty"`
		Permalink      string `json:"permalink"`
		RuleExpression string `json:"ruleExpression"`
		RuleID         int    `json:"ruleId"`
		RuleName       string `json:"ruleName"`
		TestID         int    `json:"testId"`
		TestName       string `json:"testName"`
		ViolationCount int    `json:"violationCount"`
		Type           string `json:"type"`
		APILinks       []struct {
			Rel  string `json:"rel"`
			Href string `json:"href"`
		} `json:"apiLinks,omitempty"`
		Agents []struct {
			Active         int    `json:"active"`
			MetricsAtStart string `json:"metricsAtStart"`
			MetricsAtEnd   string `json:"metricsAtEnd"`
			AgentID        int    `json:"agentId"`
			AgentName      string `json:"agentName"`
			DateStart      string `json:"dateStart"`
			DateEnd        string `json:"dateEnd"`
			Permalink      string `json:"permalink"`
		} `json:"agents,omitempty"`
	} `json:"alert"`
	Pages struct {
		Current int `json:"current"`
	} `json:"pages"`
}

ThousandAlerts describes the JSON returned by a request active alerts to ThousandEyes

type ThousandTest

type ThousandTest struct {
	TestID   int    `json:"testId"`
	TestName string `json:"testName"`
	Type     string `json:"type"`
	Prefix   string `json:"prefix"`
	Interval int    `json:"interval"`
	URL      string `json:"url"`
}

ThousandTest in detail

type ThousandTests

type ThousandTests struct {
	Tests []ThousandTest `json:"test"`
}

ThousandTests describes needed Fields from the JSON returned by a request to ThousandEyes

Jump to

Keyboard shortcuts

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