cmd/scollector: Additional functionality into ExtraHop collector #1698

Merged
merged 1 commit into from May 13, 2016

Projects

None yet

2 participants

@mhenderson-so
Contributor

Additional functionality into ExtraHop collector for specifying additional keyed metrics to be collected.

Also made some small formatting & comment changes to be in-line with Go standards.

@kylebrandt kylebrandt commented on an outdated diff Apr 6, 2016
cmd/scollector/collectors/extrahop.go
return md, nil
}
-/*
- This grabs the complex metrics of the L7 traffic from ExtraHop. It is a complex type because the data is not just a simple time series,
- the data needs to be tagged with vlan, protocol, etc. We can do the network and vlan tagging ourselves, but the protocol tagging comes
- from ExtraHop itself.
-*/
+func extraHopGetAdditionalMetrics(c *gohop.Client, md *opentsdb.MultiDataPoint) error {
+ for _, v := range extraHopAdditionalMetrics {
+ metric, err := gohop.StoEHMetric(v)
+ if err != nil {
+ log.Println(err)
@kylebrandt
kylebrandt Apr 6, 2016 Member

continue or return so main logic isn't indented.

@kylebrandt kylebrandt commented on an outdated diff Apr 6, 2016
vendor/github.com/kylebrandt/gohop/gohop.go
@@ -208,8 +218,8 @@ func (c *Client) SimpleMetricQuery(cycle, category, objectType string, fromMS, u
From: fromMS,
Until: untilMS,
}
- for _, name := range metricsNames {
- mq.Specs = append(mq.Specs, MetricSpec{Name: name})
+ for _, spec := range metrics {
+ mq.Specs = append(mq.Specs, spec)
@kylebrandt
kylebrandt Apr 6, 2016 Member

no loop needed, just mq.Spects = append(mq.Specs, metrics...)

@kylebrandt kylebrandt commented on an outdated diff Apr 6, 2016
cmd/scollector/collectors/extrahop.go
@@ -170,3 +210,29 @@ func calculateDataCutoff(k gohop.MetricResponseKeyed) map[int64]int64 {
}
return rets
}
+
+func ehItemNameToTagSet(c *gohop.Client, ehName string) opentsdb.TagSet {
+ thisTagSet := opentsdb.TagSet{"host": strings.ToLower(c.APIUrl.Host)}
+
+ if strings.IndexAny(ehName, ",") == 0 {
+ return thisTagSet
+ }
+
+ nameParts := strings.Split(ehName, ",")
+ for _, p := range nameParts {
+ tagparts := strings.Split(p, "=")
+ if len(tagparts) > 0 {
+ thisTagSet[tagparts[0]] = tagparts[1]
+ }
+
@kylebrandt
kylebrandt Apr 6, 2016 Member

whitespace

@kylebrandt kylebrandt commented on an outdated diff Apr 6, 2016
cmd/scollector/collectors/extrahop.go
@@ -170,3 +210,29 @@ func calculateDataCutoff(k gohop.MetricResponseKeyed) map[int64]int64 {
}
return rets
}
+
+func ehItemNameToTagSet(c *gohop.Client, ehName string) opentsdb.TagSet {
+ thisTagSet := opentsdb.TagSet{"host": strings.ToLower(c.APIUrl.Host)}
+
+ if strings.IndexAny(ehName, ",") == 0 {
+ return thisTagSet
+ }
+
+ nameParts := strings.Split(ehName, ",")
+ for _, p := range nameParts {
+ tagparts := strings.Split(p, "=")
@kylebrandt
kylebrandt Apr 6, 2016 Member

tagParts

@kylebrandt kylebrandt commented on an outdated diff Apr 6, 2016
cmd/scollector/collectors/extrahop.go
-//Register a collector for ExtraHop
-func ExtraHop(host, apikey, filterby string, filterpercent int) error {
+// ExtraHop collection registration
+func ExtraHop(host, apikey, filterby string, filterpercent int, custommetrics []string) error {
@kylebrandt
kylebrandt Apr 6, 2016 Member

customMetrics

@kylebrandt kylebrandt merged commit 3fd1015 into bosun-monitor:master May 13, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@simnv simnv added a commit to simnv/bosun that referenced this pull request May 18, 2016
@mhenderson-so @simnv mhenderson-so + simnv cmd/scollector: Additional functionality into ExtraHop collector, for…
… specifying additional keyed metrics to be collected (#1698)
bb7caf7
@mhenderson-so mhenderson-so deleted the mhenderson-so:ExtraHopMetrics branch Jul 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment