Git Product home page Git Product logo

goarista's Introduction

Arista Go library Build Status codecov.io GoDoc Go Report Card

areflect

Helper functions to work with the reflect package. Contains ForceExport(), which bypasses the check in reflect.Value that prevents accessing unexported attributes.

monotime

Provides access to a fast monotonic clock source, to fill in the gap in the Go standard library, which lacks one. Don't use time.Now() in code that needs to time things or otherwise assume that time passes at a constant rate, instead use monotime.Now().

cmd

See the cmd directory.

dscp

Provides ListenTCPWithTOS(), which is a replacement for net.ListenTCP() that allows specifying the ToS (Type of Service), to specify DSCP / ECN / class of service flags to use for incoming connections. Requires go1.9.

key

Provides common types used across various Arista projects. The type key.Key is used to work around the fact that Go can't let one use a non-hashable type as a key to a map. Because we often use a map[string]interface{} (or other non-hashable type) as a key to a map, the type key.Map is used to represent a map that can store both natively hashable and non-hashable types alike. To do this, a non-hashable type must have a custom Hash() method defined. The type key.Path is the representation of a path broken down into individual elements, where each element is a key.Key. The type key.Pointer represents a pointer to a key.Path.

path

Provides functions that can be used to manipulate key.Path objects. The type path.Map may be used for mapping paths to values. It allows for some fuzzy matching for paths containing path.Wildcard keys.

lanz

A client for LANZ streaming servers. It connects to a LANZ streaming server, listens for notifications, decodes them and sends the LANZ protobuf on the provided channel.

monitor

A library to help expose monitoring metrics on top of the expvar infrastructure.

netns

netns.Do(namespace, cb) provides a handy mechanism to execute the given callback cb in the given network namespace.

influxlib

This is a influxdb library that provides easy methods of connecting to, writing to, and reading from the service.

test

This is a Go library to help in writing unit tests.

Examples

TBD

goarista's People

Contributors

7ac avatar aaronbee avatar aj-anet avatar alexaliu avatar allyn-wade avatar arista-jenkins avatar brianneville avatar chuchutrain-arista avatar devoxel avatar jcostaroberts avatar jfrabaute avatar jwshephard avatar kimmidi avatar leonsinc avatar mikegfink avatar nkitchen avatar noredistribution avatar padmini-m avatar peragwin avatar rmomin-arista avatar ronanmacf avatar rprada-arista avatar rski avatar sengleung avatar stephensdaily avatar tdacquet-arista avatar thesalmontapes avatar tsuna avatar vlad-arista avatar weiyougit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

goarista's Issues

deal with go-tip errors in test.Diff

since commit

37f84817247d3b8e687a701ccb0d6bc7ffe3cb78
Author: Marcel van Lohuizen [email protected]
AuthorDate: Fri Feb 22 23:41:38 2019 +0100
Commit: Marcel van Lohuizen [email protected]
CommitDate: Wed Feb 27 19:07:22 2019 +0000

Parent: 1d992f2e36 math/big: better initial guess for nat.sqrt
Contained: master
Follows: go1.12beta2 (261)

errors: add Frame and Formatter/Printer interfaces

errors.New now implements Formatter and includes Frame
information that is reported when detail is requested.

Partly implements proposal Issue #29934.

Change-Id: Id76888d246d7d862595b5e92d517b9c03f23a7a6
Reviewed-on: https://go-review.googlesource.com/c/163557
Run-TryBot: Marcel van Lohuizen [email protected]
TryBot-Result: Gobot Gobot [email protected]
Reviewed-by: Damien Neil [email protected]

It seems that test.Diffing two errors returns something like

Diff:attributes "Error" are different: attributes "frame" are different: attributes "frames" are different: In arrays, values are different at index 1: uintptr(8313386) != uintptr(4636598)

Error while compiling ockafka docker file

Getting this error on Step 5/6 : RUN go get -d ./cmd/ockafka/... && go install ./cmd/ockafka:

package github.com/aristanetworks/goarista/cmd/ockafka/...: /go/src/github.com/aristanetworks/goarista exists but /go/src/github.com/aristanetworks/goarista/.git does not - stale checkout?

Worked around it for now by changing the Dockerfile to

FROM golang:1.10.1

RUN mkdir -p /go/
WORKDIR /go/
COPY ./ .
RUN go get github.com/aristanetworks/goarista/cmd/ockafka  \
  && go install github.com/aristanetworks/goarista/cmd/ockafka

ENTRYPOINT ["/go/bin/ockafka"]

Interface packets-out doesnt work well

Hi, I'm using arista ceos and when I execute 'show interface counters', the number of outOctets in the Ethernet2 interface is 0, but when I capture traffic on that interface with 'tcpdump -i eth2' I see packets that enter and exit from that interface. The configuration of this interface is the following:

interface Ethernet2
description "Connection with Internet"
speed forced 10000full
no switchport
ip address 10.100.1.1/24
!

[email protected] fails to compile under windows

Hi

I was trying to build a go project with goarista under windows which fails to compiles.

The project pulls in github.com/aristanetworks/goarista/gnmi
which further pulls in github.com/aristanetworks/goarista/netns and then from this
github.com/aristanetworks/fsnotify

C:\project\go build .
github.com/aristanetworks/fsnotify
C:\Programming\go\pkg\mod\github.com\aristanetworks\[email protected]\windows.go:68:24: not enough arguments in call to w.AddWithFlags
have (number)
want (string, uint32)

Could the AddWithFlags function be modified so that it compiles under windows ?

many thanks

gnmireverse client fails to run

Hi,

I am trying to run gnmireverse client on my linux machine(ubuntu 18.04). I am running go version go1.10.4 linux/amd64.
When I am running the client I am getting the bellow error:

:~/work/src$ go install gnmireverse/client
# github.com/aristanetworks/goarista/dscp
github.com/aristanetworks/goarista/dscp/dial.go:20:10: unknown field 'Control' in struct literal of type net.Dialer
github.com/aristanetworks/goarista/dscp/dial.go:38:10: unknown field 'Control' in struct literal of type net.Dialer
github.com/aristanetworks/goarista/dscp/dial.go:56:10: unknown field 'Control' in struct literal of type net.Dialer
github.com/aristanetworks/goarista/dscp/dscp_unix.go:25:9: undefined: net.ListenConfig
# golang.org/x/net/http2
golang.org/x/net/http2/client_conn_pool.go:305:6: undefined: errors.Is
golang.org/x/net/http2/server.go:234:72: undefined: tls.VersionTLS13

am I doing something wrong here?

GNMI - Unable to subscribe to use stream_mode with sample_interval

I am trying to use gnmi to enable -stream_mode sample and set a sample_interval of 1 min when using subscribe mode. I get below error
root@jumphost:~# gnmi -addr 10.xx.xx.xx:5909 -username user -password password -mode stream -stream_mode sample -sample_interval 1m subscribe '/components/component[name=PowerSupply1]/properties/'
F0502 14:56:40.145280 6775 main.go:141] rpc error: code = Unimplemented desc = only TARGET_DEFINED Subscription mode supported.

Am i using the wrong flags?

ocprometheus returns error : failed to subscribe

I am trying to setup ocprometheus/gnmi on Arista 7060CX2 device using Arista version 4.20.6F.

Below is the configuration on my Arista device:

qa-001#sh run | sec management
!
management api gnmi
transport grpc def
vrf MGMT
!

qa-001#sh management api gnmi
Enabled: Yes
Server: running on port 6030, in MGMT VRF
SSL Profile: none
qa-001#

qa-001#show processes | i Open
4273 2.4 1.8 ? Sl 09:10:24 00:32:19 /usr/bin/OpenConfig --agenttitle=OpenConfig --demuxerOpts=3325211945484,3325211570139,tbl://sysdb/+n,Sysdb (pid:1523) --sysdbfd=7
17414 0.0 0.0 pts/4 Ss+ 07:30:28 00:00:00 grep -aEe Open
qa-001#

I am on go version go1.10.1 linux/amd64 and Centos 7.2.

[root@qa0801 ~]#ocprometheus -addr qa-001.mgmt:6030 -config sampleconfig_above_4.20.yml
F1024 07:39:39.609355 70578 main.go:90] rpc error: code = Unauthenticated desc = Authentication failed

[root@qa0801 ~]# ocprometheus -addr qa-001.mgmt:6030 -config sampleconfig_above_4.20.yml -username xxxxx -password xxxxx
F1024 06:51:19.050065 39284 main.go:90] rpc error: code = InvalidArgument desc = failed to subscribe to /Sysdb/environment/archer/cooling/status: path invalid: failed to access node "Sysdb" in node ""

[root@qa0801 ~]# ocprometheus -addr qa-001.mgmt:6030 -config sampleconfig_above_4.20.yml -username xxxxx -password xxxxx -subscribe /Sysdb
F1024 06:58:25.154923 43467 main.go:90] rpc error: code = InvalidArgument desc = failed to subscribe to /Sysdb: path invalid: failed to access node "Sysdb" in node ""
[root@qa0801 ~]#

Am I hitting a bug or did I miss some piece of configuration? Could you please assist?

interface counter collection doesn't work in EOS 4.25.2F+

In EOS 4.25.2F-EFT1 ocprometheus can throw something similar when subscribing to openconfig paths via gnmi/OCTA:

collected metric "intfCounter" { label:<name:"countertype" value:"out-unicast-pkts" > label:<name:"intf" value:"Management1" > gauge:<value:1.84297e+06 > } was collected before with the same name and label values

This is due to nil prefix in the openconfig notif which can cause ocprometheus to complain about having handled a metric already

TestListenTCPWithTOS failing on go tip

The first recorded failure was seen in Job #179.2, which built with go version devel +689fa9c Tue Feb 21 18:43:02 2017 +0000 linux/amd64. Might be worthwhile taking a look at what's going on over there.

=== RUN   TestListenTCPWithTOS
--- FAIL: TestListenTCPWithTOS (0.00s)
panic: reflect: call of reflect.Value.Int on zero Value [recovered]
	panic: reflect: call of reflect.Value.Int on zero Value
goroutine 6 [running]:
testing.tRunner.func1(0xc42006a8f0)
	/home/travis/.gimme/versions/go/src/testing/testing.go:624 +0x264
panic(0x55f2a0, 0xc42000ce40)
	/home/travis/.gimme/versions/go/src/runtime/panic.go:489 +0x25a
reflect.Value.Int(0x0, 0x0, 0x0, 0x58fb4e)
	/home/travis/.gimme/versions/go/src/reflect/value.go:902 +0xb5
github.com/aristanetworks/goarista/dscp.listenTCPWithTOS(0xc420010f00, 0x28, 0x570d00, 0x1, 0xc420010f00)
	/home/travis/gopath/src/github.com/aristanetworks/goarista/dscp/listen_unix.go:22 +0x14a
github.com/aristanetworks/goarista/dscp.ListenTCPWithTOS(0xc420010f00, 0xc420010f28, 0xc4200151d0, 0x10, 0x10)
	/home/travis/gopath/src/github.com/aristanetworks/goarista/dscp/listen.go:16 +0x34
github.com/aristanetworks/goarista/dscp_test.testListenTCPWithTOS(0xc42006a8f0, 0x590478, 0x9)
	/home/travis/gopath/src/github.com/aristanetworks/goarista/dscp/listen_test.go:24 +0xcf
github.com/aristanetworks/goarista/dscp_test.TestListenTCPWithTOS(0xc42006a8f0)
	/home/travis/gopath/src/github.com/aristanetworks/goarista/dscp/listen_test.go:15 +0x40
testing.tRunner(0xc42006a8f0, 0x599468)
	/home/travis/.gimme/versions/go/src/testing/testing.go:659 +0x98
created by testing.(*T).Run
	/home/travis/.gimme/versions/go/src/testing/testing.go:701 +0x2da
FAIL	github.com/aristanetworks/goarista/dscp	0.018s

panic: runtime error: invalid memory address or nil pointer dereference

Hi,

After installing go and the gnmi client I get the following error:

gnmi -addr localhost:46030 -username admin get '/'
/:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1388036]

goroutine 1 [running]:
main.get(0x14e22a0, 0xc4200a9b90, 0x14e2460, 0xc4200bc040, 0xc4201923e0, 0x1, 0x1, 0x1, 0x0)
	/Users/sean/go/src/github.com/aristanetworks/goarista/cmd/gnmi/main.go:132 +0x1e6
main.main()
	/Users/sean/go/src/github.com/aristanetworks/goarista/cmd/gnmi/main.go:77 +0x7c5

Any idea why this might be happening?

Thanks.

Update the gnmi installation readme

Hello,
I think GO111MODULE=on go get github.com/aristanetworks/goarista/cmd/gnmi is now obsolete. But the readme still refers to this.
It need to be updated with GO111MODULE=on go install github.com/aristanetworks/goarista/cmd/gnmi@latest
Thanks

GNMI calls fails with below error

gnmi -addr 172.18.0.4 --username admin --password admin get origin="/" /n
etwork-instance[name=โ€™defaultโ€™]/
F0218 21:35:04.518261 88 main.go:114] rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error:

gnmi --addr 172.18.0.4 --mode stream --username admin --password admin sub
scribe origin="/" /network-instance[name=โ€™defaultโ€™]/
F0218 21:34:24.533781 80 main.go:141] rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error:

Any idea what is going wrong? Same if I use gnmi_cli of open config things work.

Core Dumped when options are set without path for DELETE, REPLACE, UPDATE

Instead of displaying a friendly error message stating missing paths, the user is instead greeted with the core dump shown below.

This happens for delete, replace, and update requests.

@ash% gnmi -username admin -addr al331:6030 update origin=openconfig
.
.
.
goroutine 12 [runnable]:
runtime.gcTrigger.test({0x0?, 0x0?, 0x0?})
	runtime/mgc.go:547 +0xfb fp=0xc00060cd30 sp=0xc00060cd28 pc=0x41c29b
runtime.mallocgc(0x60, 0x0, 0x1)
	runtime/malloc.go:1171 +0x768 fp=0xc00060cd98 sp=0xc00060cd30 pc=0x410468
runtime.makechan(0xc000a326c0?, 0x0)
	runtime/chan.go:96 +0x126 fp=0xc00060cdd8 sp=0xc00060cd98 pc=0x408386
google.golang.org/grpc.(*addrConn).updateConnectivityState(0xc0003ef080, 0x1, {0x0?, 0x0})
	google.golang.org/[email protected]/clientconn.go:1282 +0x73 fp=0xc00060ce60 sp=0xc00060cdd8 pc=0x955f33
google.golang.org/grpc.(*addrConn).resetTransport(0xc0003ef080)
	google.golang.org/[email protected]/clientconn.go:1334 +0x186 fp=0xc00060cf78 sp=0xc00060ce60 pc=0x956326
google.golang.org/grpc.(*addrConn).connect(0xc0003ef080)
	google.golang.org/[email protected]/clientconn.go:978 +0x96 fp=0xc00060cfc8 sp=0xc00060cf78 pc=0x954476
google.golang.org/grpc.(*acBalancerWrapper).Connect.func1()
	google.golang.org/[email protected]/balancer_conn_wrappers.go:398 +0x26 fp=0xc00060cfe0 sp=0xc00060cfc8 pc=0x94e7a6
runtime.goexit()
	runtime/asm_amd64.s:1598 +0x1 fp=0xc00060cfe8 sp=0xc00060cfe0 pc=0x46f9a1
created by google.golang.org/grpc.(*acBalancerWrapper).Connect
	google.golang.org/[email protected]/balancer_conn_wrappers.go:398 +0x59
Aborted (core dumped)

Add cloudEOS DPS examples

e.g.:

metrics:
        - name: dpslatency
          path: /Smash/its/sessStatus/itsSessCharacData/(?P<dpskey>.*)/latency
          help: DPS latency
        - name: dpsthroughput
          path: /Smash/its/sessStatus/itsSessCharacData/(?P<dpskey>.*)/throughput
          help: DPS throughput
        - name: dpsloss
          path: /Smash/its/sessStatus/itsSessCharacData/(?P<dpskey>.*)/loss
          help: DPS loss
        - name: dpsjitter
          path: /Smash/its/sessStatus/itsSessCharacData/(?P<dpskey>.*)/jitter
          help: DPS jitter

deviceLabels feature doesn't work in ocprometheus

I'm trying:
./ocprometheus -addr 10.1.1.1:6042 -username blah -password blah -config sampleconf.yml

Config file:
deviceLabels:
10.1.1.1:
device_name: xyz

subscriptions:
- /Sysdb/connectivityMonitor/status/

metrics:
- name: PacketLossAristaXBRs
path: /Sysdb/connectivityMonitor/status/hostStatus/(?P<dst_target>.+)/packetLoss
help: Packet loss on Arista XBRs

The label device_name never gets added. Tried the same with FQDN - the same issue.

parsing the gNMI path

Hi,

I just wanted to know what is the best way of parsing the gNMI path. here is some data that I am getting from the Arista box:

map[/interfaces/interface[name=Port-Channel226]/state/counters/out-unicast-pkts:598230893]
map[/interfaces/interface[name=Port-Channel224]/state/counters/in-unicast-pkts:208183099]
map[/interfaces/interface[name=Port-Channel224]/state/counters/out-multicast-pkts:8616378]
map[/interfaces/interface[name=Port-Channel224]/state/counters/out-unicast-pkts:327460909]
map[/interfaces/interface[name=Port-Channel224]/state/counters/in-octets:88626871847]
map[/interfaces/interface[name=Port-Channel224]/state/counters/out-octets:372953173718]
map[/interfaces/interface[name=Port-Channel221]/state/counters/in-unicast-pkts:335453344]
map[/interfaces/interface[name=Port-Channel221]/state/counters/out-unicast-pkts:674831508]
map[/interfaces/interface[name=Port-Channel221]/state/counters/in-octets:119804970761]
map[/interfaces/interface[name=Port-Channel221]/state/counters/out-octets:864045654312]
map[/interfaces/interface[name=Port-Channel221]/state/counters/out-multicast-pkts:8616934]
map[/interfaces/interface[name=Port-Channel200]/state/counters/out-unicast-pkts:3753840804]
map[/interfaces/interface[name=Port-Channel200]/state/counters/out-octets:2738173779493]
map[/interfaces/interface[name=Port-Channel200]/state/counters/in-unicast-pkts:3144894501]
map[/interfaces/interface[name=Port-Channel200]/state/counters/out-multicast-pkts:8616981]
map[/interfaces/interface[name=Port-Channel200]/state/counters/in-octets:351296153373]
map[/interfaces/interface[name=Port-Channel222]/state/counters/in-multicast-pkts:437702]
map[/interfaces/interface[name=Port-Channel222]/state/counters/out-octets:908188033189]
map[/interfaces/interface[name=Port-Channel222]/state/counters/out-unicast-pkts:708918871]
map[/interfaces/interface[name=Port-Channel222]/state/counters/in-unicast-pkts:370284215]
map[/interfaces/interface[name=Port-Channel222]/state/counters/out-multicast-pkts:8608520]
map[/interfaces/interface[name=Port-Channel222]/state/counters/in-octets:106991631465]
map[/interfaces/interface[name=Port-Channel223]/state/counters/out-multicast-pkts:8616366]
map[/interfaces/interface[name=Port-Channel223]/state/counters/out-octets:369357998866]
map[/interfaces/interface[name=Port-Channel223]/state/counters/in-unicast-pkts:196088837]
map[/interfaces/interface[name=Port-Channel223]/state/counters/out-unicast-pkts:338519621]
map[/interfaces/interface[name=Port-Channel223]/state/counters/in-octets:97310470424]

I am trying to create a struct for each interface and save the values.

Thanks,

Do you have a docker image for gnmi?

I am looking for docker image of arista gnmi? Do you have a image open source? There is dockerfile for openconfig/gnmi, any idea if the collector would be compatible with arista switches?

valuelabel doesn't work for non strings

There are a few metrics in openconfig for example bgp asn along the path of

/network-instances/network-instance[name=(?P.+)]/protocols/protocol[identifier=BGP][name=BGP]/bgp/neighbors/neighbor[neighbor-address=(?P.+)]/state/peer-as

where valuelabel would be handy as it is difficult to join prometheus metrics based on values.

Can single grpc connection be used to receive data from multiple switches?

I am able to subscribe to data on a single switch with arista gnmi client.
Below is the command used to get some data from switch. So this is essentially one to one connection.

gnmi -addr xx.xx.xx.xx:xxxx -username admin -password password get '/components/component'.

Can i use the same connection and add more switch ip's to receive more data? I would like to give string of switch ip's to receive same data from all the devices.

ockafka running on Arista EOS version 4.23.5M and TerminAttr 1.7.6 throws panic: unknown type *gnmi.TypedValue_BytesVal for value <nil>

Running ockafka on a 7150 with static source NAT configured throws the following exception when subscribing to the following path:
/Sysdb/ip/nat/status/intfStatus
I0521 21:18:44.490292 10738 main.go:37] Connected to Kafka brokers at [10.81.110.68:9092]
I0521 21:18:44.490713 10738 main.go:68] Initialized Kafka producer for 127.0.0.1:6042
I0521 21:18:44.497136 10738 producer.go:82] batch: update:{timestamp:1621476850616303724 prefix:{elem:{name:"Sysdb"} elem:{name:"ip"} elem:{name:"nat"} elem:{name:"status"} elem:{name:"_counts"}} update:{path:{elem:{name:"intfStatus"}} val:{uint_val:1}}}
I0521 21:18:44.497556 10738 encoder.go:77] kafka: {"DatasetID":"127.0.0.1:6042","Key":"L2ludGZTdGF0dXM=","KeyString":"/intfStatus","Path":"/Sysdb/ip/nat/status/_counts/intfStatus","Timestamp":1621476850616303724,"ValueLong":1}
I0521 21:18:44.497583 10738 producer.go:120] Message produced to Kafka: &{nat_entries 127.0.0.1:6042 [123 34 68 97 116 97 115 101 116 73 68 34 58 34 49 50 55 46 48 46 48 46 49 58 54 48 52 50 34 44 34 75 101 121 34 58 34 76 50 108 117 100 71 90 84 100 71 70 48 100 88 77 61 34 44 34 75 101 121 83 116 114 105 110 103 34 58 34 47 105 110 116 102 83 116 97 116 117 115 34 44 34 80 97 116 104 34 58 34 47 83 121 115 100 98 47 105 112 47 110 97 116 47 115 116 97 116 117 115 47 95 99 111 117 110 116 115 47 105 110 116 102 83 116 97 116 117 115 34 44 34 84 105 109 101 115 116 97 109 112 34 58 49 54 50 49 52 55 54 56 53 48 54 49 54 51 48 51 55 50 52 44 34 86 97 108 117 101 76 111 110 103 34 58 49 125] [] {2021-05-19 22:14:10.616303724 -0400 EDT 1} 0 0 0001-01-01 00:00:00 +0000 UTC 0 0 0 0 false}
I0521 21:18:44.497772 10738 producer.go:82] batch: update:{timestamp:1621476850616303724 prefix:{elem:{name:"Sysdb"} elem:{name:"ip"} elem:{name:"nat"} elem:{name:"status"} elem:{name:"intfStatus"} elem:{name:"Vlan1000"}} update:{path:{elem:{name:"kernelStatus"}} val:{json_val:"null"}} update:{path:{elem:{name:"fullCone"}} val:{bool_val:false}} update:{path:{elem:{name:"profileId"}} val:{uint_val:0}} update:{path:{elem:{name:"name"}} val:{string_val:"Vlan1000"}}}
z

goroutine 14 [running]:
github.com/aristanetworks/goarista/kafka/producer.(*producer).run(0x90631a0)
/home/mike/software/goarista/kafka/producer/producer.go:86 +0x20c
created by github.com/aristanetworks/goarista/kafka/producer.(*producer).Start
/home/mike/software/goarista/kafka/producer/producer.go:71 +0x88

This same binary works when run on EOS 4.21.7M using TerminAttr version 1.5.2

This binary was built from master at the following commit:
Ic53da2b1230cf3e88973691b6e1ded1fb0fd5ad2

Not able to use ocprometheus with multiple targets

It doesn't make much sense to run the bellow command for every Arista sw on my network:
./ocprometheus -addr 10.1.1.1:6042 -listenaddr :8080 -username blah -password blah -config sampleconfig.yml
./ocprometheus -addr 10.1.1.2:6042 -listenaddr :8080 -username blah -password blah -config sampleconfig.yml
...

-addr needs to support a list of targets in order to make this exporter worthwhile.

ocprometheus build fails

go get github.com/aristanetworks/goarista/cmd/ocprometheus

# github.com/prometheus/client_model/go
prometheus/client_model/go/metrics.pb.go:96:31: undefined: proto.InternalMessageInfo
prometheus/client_model/go/metrics.pb.go:141:27: undefined: proto.InternalMessageInfo
prometheus/client_model/go/metrics.pb.go:179:29: undefined: proto.InternalMessageInfo
prometheus/client_model/go/metrics.pb.go:218:30: undefined: proto.InternalMessageInfo
prometheus/client_model/go/metrics.pb.go:265:29: undefined: proto.InternalMessageInfo
prometheus/client_model/go/metrics.pb.go:317:29: undefined: proto.InternalMessageInfo
prometheus/client_model/go/metrics.pb.go:357:31: undefined: proto.InternalMessageInfo
prometheus/client_model/go/metrics.pb.go:410:28: undefined: proto.InternalMessageInfo
prometheus/client_model/go/metrics.pb.go:461:28: undefined: proto.InternalMessageInfo
prometheus/client_model/go/metrics.pb.go:544:34: undefined: proto.InternalMessageInfo
prometheus/client_model/go/metrics.pb.go:544:34: too many errors
# github.com/aristanetworks/goarista/gnmi
aristanetworks/goarista/gnmi/operation.go:212:12: undefined: gnmi.TypedValue_ProtoBytes

gNMI fails with timeout error

Hello, I am currently getting an issue.

When I try to dial into Arista switch and subcribe a path to grab data from swith. I got an error:
rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: timed out waiting for server handshake.

Does it mean too many connection requests to the switch? I am not sure why it returns timeout. Is it the issue about my code or something wrong on the switch side. Thanks

some codes:
ip :=ipaddress
cfg := &aristagnmi.Config{}
cfg.Username =username
cfg.Password = password
cfg.Addr = ip + ":5909"
ctx := aristagnmi.NewContext(context.Background(), cfg)
client, err := aristagnmi.Dial(cfg)
if err != nil {
	fmt.Println(err)
}
respChan := make(chan *pb.SubscribeResponse)
errChan := make(chan error)
defer close(respChan)
defer close(errChan)
	
paths := append(make([]string, 0), "/lldp/interfaces/interface/neighbors")
subscribeOptions := &aristagnmi.SubscribeOptions{
	Mode:       "stream",
	StreamMode: "target_defined",
	Paths:      aristagnmi.SplitPaths(paths),
}

go aristagnmi.Subscribe(ctx, client, subscribeOptions, respChan, errChan)

for {
     select {
          case resp := <-respChan:
                         .........
          case err := <-errChan:
                     **got error here: timeout**
     }
}

cmd/ockafka doesn't allow to subscribe to specific keys

I tried it out, but kafka producer didn't publish a message. Without looking deep into the cause of the glitch, I thought I'd better use newish gnmi code like those for other storage (ocredis, ocsplunk, etc.). So I did, and it looks working. Please review my PR.

Encoding supports for GNMI

Hi ,

I just wanted to know if Arista supports protobuf as part of the GNMI encoding. I could not find it in your GNMI codes.

Thanks,

ocprometheus not able to parse complex path

Hello,

I`m trying to collect LLDP data using the telemetry paths ( that I found in CVP ) :

/Sysdb/l2discovery/lldp/status/local/1/portStatus/Ethernet1/1/remoteSystem/2 :
sysName : { "value": "NeighborHostname" }

Exporter config :

Metrics:
   - name: lldpNeighborInfo
     path: /Sysdb/l2discovery/lldp/status/local/(?P<localIndex>.+)/portStatus/(?P<intf>.+)/remoteSystem/(?P<remoteSystemIndex>.+)/sysName/value
     help: LLDP metric info
     valuelabel: neighborName
     defaultvalue: 1

The metric is not mapped and no error logs are found.

I`m trying other paths to debug and when I try the config below :

       - name: lldpPortStatus
          path: /Sysdb/l2discovery/lldp/status/local/1/portStatus/(?P<intf>.+)/(?P<type>.+)
          help: Test with PortStatus
          valuelabel: textValue

Seems the path changes for the remotesystem, adding "_counts" after the interface :

lldpPortStatus{intf="Ethernet10\/3/_counts",job="poc-arista",textValue="textValue",type="remoteSystem"}
EOS : 4.22.4M

Could you please verify?

Thank you,
Anderson Topine

Is there a way to pass encrypted credentials to ocprometheus from cli

Hi,
I am testing ocprometheus on Arista. We want to configure everything from CLI using daemons. This is how the config looks like currently in our lab:
daemon ocprometheus
exec /sbin/ip netns exec ns-MGMT /mnt/flash/ocprometheus -config /mnt/flash/ocprometheus.yml -addr localhost:6030 -username arista -password arista
no shutdown

However - what I don't like is having username and password in clear text in the run config. Is there any way to either pass this credentials in encrypted manner?

getting the following error while docker build.

$ docker build .
Sending build context to Docker daemon  2.034MB
Step 1/6 : FROM golang:1.7.3
 ---> ef15416724f6
Step 2/6 : RUN mkdir -p /go/src/github.com/aristanetworks/goarista/cmd
 ---> Using cache
 ---> fdf3a3ba0c95
Step 3/6 : WORKDIR /go/src/github.com/aristanetworks/goarista
 ---> Using cache
 ---> 6869da3b94d5
Step 4/6 : COPY ./ .
 ---> Using cache
 ---> 3b2b1dfcad37
Step 5/6 : RUN go get -d ./cmd/ockafka/...   && go install ./cmd/ockafka
 ---> Running in dfa3e2835a09
# github.com/aristanetworks/goarista/monitor
monitor/map.go:24: undefined: sync.Map
# github.com/Shopify/sarama
../../Shopify/sarama/delete_records_request.go:96: undefined: sort.Slice
../../Shopify/sarama/delete_records_response.go:99: undefined: sort.Slice
The command '/bin/sh -c go get -d ./cmd/ockafka/...   && go install ./cmd/ockafka' returned a non-zero code: 2

gnmi prints some negative Decimal64 values as positive

When a Decimal64 value is between -1.0 and 0.0, the gnmi client displays it as the absolute value. This only occurs when the request includes the node's full path -- values embedded in JSON payloads do not have the issue.

For example:

% gnmi [...] get '/components/component[name=Ethernet54]/transceiver/physical-channels/channel/state/input-power/instant'
/components/component[name=Ethernet54]/transceiver/physical-channels/channel[index=0]/state/input-power/instant:
0.571985336820596
/components/component[name=Ethernet54]/transceiver/physical-channels/channel[index=1]/state/input-power/instant:
0.8926890195661912
/components/component[name=Ethernet54]/transceiver/physical-channels/channel[index=2]/state/input-power/instant:
0.289097868628847
/components/component[name=Ethernet54]/transceiver/physical-channels/channel[index=3]/state/input-power/instant:
0.23925268380125786

The actual values are negative (Optical Rx Power):

switch#show interfaces Et54/1 - 54/$ transceiver
If device is externally calibrated, only calibrated values are printed.
N/A: not applicable, Tx: transmit, Rx: receive.
mA: milliamperes, dBm: decibels (milliwatts).
                               Bias      Optical   Optical
          Temp       Voltage   Current   Tx Power  Rx Power
Port      (Celsius)  (Volts)   (mA)      (dBm)     (dBm)     Last Update
-----     ---------  --------  --------  --------  --------  -------------------
Et54/1     41.95      3.32      7.49     -0.27     -0.59     0:00:03 ago
Et54/2     41.95      3.32      7.49     -0.01     -0.89     0:00:03 ago
Et54/3     41.95      3.32      7.49     -0.28     -0.29     0:00:03 ago
Et54/4     41.95      3.32      7.49     0.01      -0.24     0:00:03 ago

The cause of the issue is here: https://github.com/aristanetworks/goarista/blob/9de84549183ed950/gnmi/operation.go#L223-L225
It doesn't account for the case where i is 0 but d.Digits was negative.

gNMI build fails

New Go installation: go version go1.11.1 windows/amd64

C:%GOPATH%>go get github.com/aristanetworks/goarista/cmd/gnmi

github.com/aristanetworks/goarista/netns

src\github.com\aristanetworks\goarista\netns\netns.go:35:17: undefined: getNs
src\github.com\aristanetworks\goarista\netns\netns.go:39:8: undefined: setNs
src\github.com\aristanetworks\goarista\netns\netns_110.go:34:19: undefined: getNs
src\github.com\aristanetworks\goarista\netns\netns_110.go:54:11: undefined: setNs

ockafka does not seem to build

As I'm not the biggest Go hero around, I can't seem to resolve this issue while building ockafka. Any suggestions or is there a bug that needs solving?

joris@lab:~$ go install github.com/aristanetworks/goarista/cmd/ockafka
# github.com/aristanetworks/goarista/monitor
go/src/github.com/aristanetworks/goarista/monitor/map.go:24: undefined: sync.Map
# github.com/Shopify/sarama
go/src/github.com/Shopify/sarama/delete_records_request.go:96: undefined: sort.Slice
go/src/github.com/Shopify/sarama/delete_records_response.go:99: undefined: sort.Slice

ocprometheus fails with duplicated metrics with EOS 4.27

Using latest goarista from master branch, EOS 4.27.4M, and a configuration like this:

metrics:

        - name: ocprometheus_bgp_peer_as_number  #No unit
          path: /Sysdb/routing/bgp/export/vrfBgpPeerInfoStatusEntryTable/(?P<vrf>.+)/bgpPeerInfoStatusEntry/(?P<name>.+)/bgpPeerAs
          help: BGP Peer  AS Number

ocprometheus fails with errors like this:

* collected metric "ocprometheus_bgp_peer_as_number" { label:<name:"name" value:"192.168.247.17" > label:<name:"vrf" value:"default" > gauge:<value:0 > } was collected before with the same name and label values

This used to work so far with EOS <= 4.26.6M :

ocprometheus_bgp_peer_as_number{name="10.64.226.33/bgpPeerSessionStatus",vrf="default"} 1234
ocprometheus_bgp_peer_as_number{name="10.64.226.35/bgpPeerSessionStatus",vrf="default"} 1234
ocprometheus_bgp_peer_as_number{name="192.168.247.19/bgpPeerSessionStatus",vrf="default"} 64850
ocprometheus_bgp_peer_as_number{name="192.168.248.19/bgpPeerSessionStatus",vrf="default"} 64850

It looks like the name "(?P.+)" used to match "10.64.226.33/bgpPeerSessionStatus", but now it only constructs a label with the first part before the first "/"

goprometheus to veos ?

Is it possible to test basic telemetry features such as bandwidth with vEOS?

I'm getting a timeout error trying to connect to the management1 interface, wireshark shows syn but no syn ack coming back from the switch. All default vrf. Also can see the openconfig service running.

~/go/bin# ./ocprometheus -config /etc/arista/config.yml -addr 10.224.122.80:6030 F0219 14:44:23.665902 11331 main.go:90] rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = "transport: Error while dialing dial tcp 10.224.122.80:6030: connect: connection timed out"

Feature Request: Dynamic targeting for ocprometheus

At present, when running ocprometheus outside of the switch, the address is provided by running with -address. This makes it a bit less flexible to gather metrics for multiple devices. That is, to have the metrics for, say, switch1, you need to start the app, e.g., ./ocprometheus -addr switch1 -config config.yml; to have the metrics for switch2, you need a separate instance running, e.g., ./ocprometheus -addr switch2 -config config.yml and so on. In other words, when running ocprometheus outside of the switch, it requires as many instances running as switches you have.

Typically, Prometheus exporters accept the target as an argument, e.g., http://prom.example.com/metrics?target=swtich1 for switch1, http://prom.example.com/metrics?target=swtich2 for switch2 etc.

It'd be awesome if we could make the necessary adjustments to accommodate this simplified usage? Thank you!

-v flag redefined when using with github.com/golang/glog

/tmp/go-build149476797/b001/tests.test flag redefined: v
panic: /tmp/go-build149476797/b001/tests.test flag redefined: v
goroutine 1 [running]:
flag.(*FlagSet).Var(0xc00007e180, 0x12ab2f8, 0x1b49c88, 0x1151007, 0x1, 0x116e1e8, 0x14)
/usr/local/go/src/flag/flag.go:871 +0x485
flag.Var(...)
/usr/local/go/src/flag/flag.go:886
github.com/golang/glog.init.0()
/home/go/pkg/mod/github.com/golang/[email protected]/glog.go:401 +0x127
Further investigating we discovered that go test module has its own glog module and again goarista package is redefining the same glog module with same flags, which is conflicting and Its expected to fail [go language behavior]

-v flag redefined when using with github.com/golang/glog

"github.com/aristanetworks/goarista/lanz" import in lanz plugin of telegraf defines the -v flag which is being redefined by "github.com/openconfig/ygot/ygot" causing telegraf to crash

Telegraf debug logs
./telegraf flag redefined: v
panic: ./telegraf flag redefined: v

goroutine 1 [running]:
flag.(*FlagSet).Var(0xc00013faa0, {0x8998f70, 0xc5ab260}, {0x89556d0, 0x1}, {0x7d8e7bd, 0x14})
/usr/local/go/src/flag/flag.go:982 +0x2f9
flag.Var(...)
/usr/local/go/src/flag/flag.go:997
github.com/aristanetworks/glog.init.0()
/Users/atolgi/go/pkg/mod/github.com/aristanetworks/[email protected]/glog_config.go:26 +0x4b

Related Closed telegraf issue

ocprometheus doesn't work on Arista running 4.21.5F

I'm getting this directly from gnmi cli:

./gnmi -addr 10.10.1.1:6042 -username admin -password blah get "/Sysdb/connectivityMonitor/status"

/Sysdb/connectivityMonitor/status/hostStatus/device-1/defaultStats/latency:
0.07800000160932541
/Sysdb/connectivityMonitor/status/hostStatus/device-1/defaultStats/jitter:
0.012000000104308128
/Sysdb/connectivityMonitor/status/hostStatus/device-1/defaultStats/packetLoss:
0

In ocprometheus I have this configured:

subscriptions:
        - /Sysdb/connectivityMonitor/status

metrics:
        - name: PacketLossArista
          path: /Sysdb/connectivityMonitor/status/hostStatus/(?P<dst_target>.+)/defaultStats/packetLoss
          help: Packet loss on Arista

        - name: LatencyArista
          path: /Sysdb/connectivityMonitor/status/hostStatus/(?P<dst_target>.+)/defaultStats/latency
          help: Latency on Arista

        - name: JitterArista
          path: /Sysdb/connectivityMonitor/status/hostStatus/(?P<dst_target>.+)/defaultStats/jitter
          help: Jitter on Arista

It worked fine on previous EOS version.

cmd/octsdb not json.Number

I am getting allot of "not json.Number" errors when running octsdb with -text output.

Go version:

go version go1.12.9 linux/amd64

I am running the latest octsdb:

/root/.gvm/pkgsets/go1.12.9/global/bin/octsdb

Command:

$GOPATH/bin/octsdb -addr leaf-sw5.test:6042 -config /root/user/terminattr/test.json -text

Config test.json:

{ "comment": "Arista Terminattr Config", "subscriptions": [ "/Sysdb/hardware/archer/xcvr/status/all" ], "metricPrefix": "eos.test", "metrics": { "rxpowerlane1": {"path": "/Sysdb/hardware/archer/xcvr/status/all/(?P<intf>.+)/domRegisterData/(lane1OpticalRxPower)"}, "txpowerlane1": {"path": "/Sysdb/hardware/archer/xcvr/status/all/(?P<intf>.+)/domRegisterData/(lane1TxPower)"} } }

Output:

I0820 11:31:56.850122 30273 main.go:211] Element 0: 111.111.1.11 is string, not json.Number I0820 11:31:56.850184 30273 main.go:211] Element 0: 222.222.2.22 is string, not json.Number I0820 11:31:56.852689 30273 main.go:211] Element 0: map[hop::: intfId:Ethernet50/1 mplsLabel:map[value:1048576] weight:1] is map[string]interface {}, not json.Number I0820 11:31:56.852723 30273 main.go:211] Element 0: map[hop::: intfId:Ethernet50/1 mplsLabel:map[value:1048576] weight:1] is map[string]interface {}, not json.Number I0820 11:31:56.852744 30273 main.go:211] Element 0: map[hop::: intfId:Vlan4094 mplsLabel:map[value:1048576] weight:1] is map[string]interface {}, not json.Number I0820 11:31:56.852772 30273 main.go:211] Element 0: map[hop::: intfId:Ethernet49/1 mplsLabel:map[value:1048576] weight:1] is map[string]interface {}, not json.Number I0820 11:31:56.852794 30273 main.go:211] Element 0: map[hop::: intfId:Vlan4094 mplsLabel:map[value:1048576] weight:1] is map[string]interface {}, not json.Number I0820 11:31:56.852817 30273 main.go:211] Element 0: map[hop::: intfId:Loopback0 mplsLabel:map[value:1048576] weight:1] is map[string]interface {}, not json.Number I0820 11:31:56.852841 30273 main.go:211] Element 0: map[hop::: intfId:Ethernet49/1 mplsLabel:map[value:1048576] weight:1] is map[string]interface {}, not json.Number I0820 11:31:56.852866 30273 main.go:211] Element 0: map[hop::: intfId:Loopback1 mplsLabel:map[value:1048576] weight:1] is map[string]interface {}, not json.Number

Arista software version:

4.20.3F-INT

TerminAttr version:

v1.4.1 go1.10.3

ockafka importing broken github links

I am trying to deploy the goarista project to use the cmd/ockafka for streaming data from arista devices to kafka. As I do not have access to the internet from this server I wanted to manually download the project dependencies, upon trying to download the import github URL I notice the github.com/golang/protobuf/proto is invalid

SECURITY ERROR: This download does NOT match an earlier download recorded in go.sum

I'm getting the following error when pulling the repo. Can someone advise ?

`
GOROOT=/usr/local/Cellar/go/1.13.4/libexec #gosetup
GOPATH=/Users/gav/go #gosetup
/usr/local/Cellar/go/1.13.4/libexec/bin/go mod tidy #gosetup
go: downloading google.golang.org/grpc v1.27.1
go: downloading gopkg.in/yaml.v2 v2.2.8
go: downloading golang.org/x/net v0.0.0-20200222125558-5a598a2470a0
go: downloading github.com/prometheus/client_golang v1.4.1
go: downloading github.com/golang/protobuf v1.3.3
go: downloading github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d
go: downloading github.com/xtaci/kcp-go v5.4.20+incompatible
go: extracting github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d
go: extracting github.com/prometheus/client_golang v1.4.1
go: downloading github.com/stretchr/testify v1.4.0
go: downloading gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15
go: downloading github.com/aristanetworks/glog v0.0.0-20191112221043-67e8567f59f3
go: extracting github.com/xtaci/kcp-go v5.4.20+incompatible
go: extracting github.com/golang/protobuf v1.3.3
go: downloading golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d
go: extracting github.com/aristanetworks/glog v0.0.0-20191112221043-67e8567f59f3
go: downloading github.com/prometheus/procfs v0.0.10
go: extracting github.com/stretchr/testify v1.4.0
go: extracting github.com/prometheus/procfs v0.0.10
go: downloading golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
go: extracting gopkg.in/yaml.v2 v2.2.8
go: extracting golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
go: extracting google.golang.org/grpc v1.27.1
go: extracting gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15
go: downloading github.com/kr/pretty v0.2.0
go: extracting golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d
go: downloading github.com/klauspost/reedsolomon v1.9.3
go: downloading github.com/prometheus/common v0.9.1
go: downloading github.com/pkg/errors v0.9.1
go: extracting github.com/kr/pretty v0.2.0
go: downloading github.com/Shopify/sarama v1.26.1
go: extracting golang.org/x/net v0.0.0-20200222125558-5a598a2470a0
go: extracting github.com/pkg/errors v0.9.1
go: extracting github.com/prometheus/common v0.9.1
go: downloading github.com/tjfoc/gmsm v1.3.0
go: downloading golang.org/x/sys v0.0.0-20200219091948-cb0a6d8edb6c
go: downloading github.com/cespare/xxhash/v2 v2.1.1
go: downloading github.com/kr/text v0.1.0
go: extracting github.com/klauspost/reedsolomon v1.9.3
go: downloading github.com/prometheus/client_model v0.2.0
go: extracting github.com/cespare/xxhash/v2 v2.1.1
go: extracting github.com/Shopify/sarama v1.26.1
go: extracting github.com/kr/text v0.1.0
go: downloading golang.org/x/tools v0.0.0-20200221224223-e1da425f72fd
go: downloading github.com/klauspost/cpuid v1.2.3
verifying github.com/tjfoc/[email protected]: checksum mismatch
downloaded: h1:qhgkrZru95jFP9NbVPknJvc9vgkMXhOEzkOASKdc0oQ=
go.sum: h1:i7c6Za/IlgBvnGxYpfD7L3TGuaS+v6oGcgq+J9/ecEA=

SECURITY ERROR
This download does NOT match an earlier download recorded in go.sum.
The bits may have been replaced on the origin server, or an attacker may
have intercepted the download attempt.

For more information, see 'go help module-auth'.
`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.