fixed bgp collector (#12)
This commit is contained in:
committed by
Steve Brunton
parent
39e54be98d
commit
eb9269527d
@@ -67,15 +67,11 @@ func (c *bgpCollector) fetch(ctx *collectorContext) ([]*proto.Sentence, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *bgpCollector) collectForStat(re *proto.Sentence, ctx *collectorContext) {
|
func (c *bgpCollector) collectForStat(re *proto.Sentence, ctx *collectorContext) {
|
||||||
var session, asn string
|
asn := re.Map["remote-as"]
|
||||||
for _, p := range c.props {
|
session := re.Map["name"]
|
||||||
if p == "name" {
|
|
||||||
session = re.Map[p]
|
for _, p := range c.props[2:] {
|
||||||
} else if p == "remote-as" {
|
c.collectMetricForProperty(p, session, asn, re, ctx)
|
||||||
asn = re.Map[p]
|
|
||||||
} else {
|
|
||||||
c.collectMetricForProperty(p, session, asn, re, ctx)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ type collector struct {
|
|||||||
// WithBGP enables BGP routing metrics
|
// WithBGP enables BGP routing metrics
|
||||||
func WithBGP() Option {
|
func WithBGP() Option {
|
||||||
return func(c *collector) {
|
return func(c *collector) {
|
||||||
c.collectors = append(c.collectors, &bgpCollector{})
|
c.collectors = append(c.collectors, newBGPCollector())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user