Coder Social home page Coder Social logo

agent's Introduction

Mainflux - MIGRATED TO MAGISTRALA

Mainflux project has been successfully rebranded and migrated to Magistrala repository.

All the further development will be happening over there, under the supervision and professional support of Abstract Mahines company.

This old Mainflux repository will be archived - please move to the new Magistrala repo, star it and follow the development over there.

agent's People

Contributors

blokovi avatar dependabot[bot] avatar drasko avatar mteodor avatar pricelessrabbit avatar sammyoina 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

Watchers

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

agent's Issues

Add Support For Multi-broker Messaging From Mainflux

FEATURE REQUEST

  1. Is there an open issue addressing this request? No

  2. Describe the feature you are requesting, as well as the possible use case(s) for it.
    Since mainflux now supports multi-broker messaging, it would be nice to have a way to specify the broker to use when publishing messages. This would allow for a more flexible deployment of mainflux.

  3. Indicate the importance of this feature to you (must-have, should-have, nice-to-have).
    Should-have

agent stop to relay messages to nats when disconnects and reconnects to mqtt

steps to reproduce

  1. start the agent and send commands from a mainflux instance
  2. simulate a connection issue and wait agent to notify the disconnection
  3. re-enable the connection and wait agent to notify the reconnection

expected

commands and service messages (channels//services/# ) are managed by agent and relayed into the local nats bus

actual

agent stops to relay commands until the service is restarted


imo the issue is related to the Paho clean session flag that is set to "true" in the config. when paho disconnects and auto reconnects, seems that it does not re-subscribe to the mqtt topics that the broker has wiped out when client disconnected. In fact, when changing clean session to false, the agent works as expected.

Are there any drawbacks in setting the session as persistent (clean session = false)? If not i can open a PR. A more involed solution is to use the paho handlers to re-subscribe to the topics when connection is lost. If a clean session is needed when the service process starts / restarts, there is also this workaround to have a cleaned persistent session

Question about proxying commands

When Agent forwards command to NATS like described here service on the edge should subscribe directly to subject commands.<service_name>. Do I need to connect to NATS or it can go over MQTT? And channels are not used here?

Sorry if question is naive, I'm a beginner with NATS and MQTT

Undefined reference to 'gccgoRealSyscall' and 'gccgoRealSyscallNoError'

Hi.
Here is my tryout to build your package, using gollvm("llvm-goc"):

$make

full/verbose stdout output

I caught these errors:

/home/oceanfish81/agent/vendor/golang.org/x/sys/unix/gccgo.go:55: error: undefined reference to 'gccgoRealSyscall'
/home/oceanfish81/agent/vendor/golang.org/x/sys/unix/gccgo.go:30: error: undefined reference to 'gccgoRealSyscall'
/home/oceanfish81/agent/vendor/golang.org/x/sys/unix/gccgo.go:23: error: undefined reference to 'gccgoRealSyscallNoError'
/home/oceanfish81/agent/vendor/golang.org/x/sys/unix/gccgo.go:37: error: undefined reference to 'gccgoRealSyscall'
/home/oceanfish81/agent/vendor/golang.org/x/sys/unix/gccgo.go:44: error: undefined reference to 'gccgoRealSyscall'
/home/oceanfish81/agent/vendor/golang.org/x/sys/unix/gccgo.go:50: error: undefined reference to 'gccgoRealSyscallNoError'

This error does not arrive with CGO_ENABLED=1, despite that is not what you are targeting.
Just sharing for tracking down the cause, with CGO_ENABLED=0.

My environment look like this:

$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/oceanfish81/.cache/go-build"
GOENV="/home/oceanfish81/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/oceanfish81/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/oceanfish81/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/oceanfish81/gollvm_dist"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/oceanfish81/gollvm_dist/tools"
GCCGO="/home/oceanfish81/gollvm_dist/bin/llvm-goc"
AR="ar"
CC="/usr/bin/clang"
CXX="/usr/bin/clang++"
CGO_ENABLED="1"
GOMOD="/home/oceanfish81/agent/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build482369313=/tmp/go-build -gno-record-gcc-switches -funwind-tables"

$ go version
go version go1.15.2 gollvm LLVM 12.0.0git linux/amd64

CC @thanm @cherrymui @ianlancetaylor

nats: no server available

nats_error
I am able to connect to bootstrap and get data from mainflux, now I am stuck at nats server .
after getting data two toml files created export.toml and config.toml, what is the next step.
please help.

Remove docker dir

For some reason this repo has docker and deployments directory that both keep Dockerfile.

Please remove docker dir, previously checking that Dockerfile in deployments is up to date, and that Makefile actually calls this one to build the docker image.

Agent can't get bootstrap config from remote mainflux host

Agent can't get bootstrap config from remote mainflux host.
How to reproduce this issue:

Add new gw from mainflux/ui and see in bootstrap log: all ok.

mainflux-bootstrap | {"level":"info","message":"Method add for key eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzYxNjcwMjksImlhdCI6MTU3NjEzMTAyOSwiaXNzIjoibWFpbmZsdXgiLCJzdWIiOiI0cmVmcjBudEBnbWFpbC5jb20ifQ.F5kxbVuYEpJALQ4OZltx_LYuhQ6pQi10LeKRcr6vVrM and thing 8c85f5af-2d57-4ff0-ac88-6703fe16c33e took 44.830785ms to complete without errors.","ts":"2019-12-12T07:23:03.262090299Z"}
mainflux-bootstrap | {"level":"info","message":"Method bootstrap for thing with external id E8-EB-11-41-90-C0 took 2.274438ms to complete without errors.","ts":"2019-12-12T07:23:32.278903665Z"}
mainflux-bootstrap | {"level":"info","message":"Method bootstrap for thing with external id E8-EB-11-41-90-C0 took 2.639552ms to complete without errors.","ts":"2019-12-12T07:34:21.384956939Z"}

Copy chanells, keys, ID, MAC to agent config, then start agent - see agent and bootstrap logs.

gw log:

{"level":"info","message":"Requesting config for E8-EB-11-41-90-C0 from http://mainflux.example.com:8202/things/bootstrap","ts":"2019-12-12T07:35:59.945540972Z"}
{"level":"error","message":"Fetching bootstrap failed with error: unexpected end of JSON input","ts":"2019-12-12T07:35:59.974775806Z"}
{"level":"debug","message":"Retries remaining: 5. Retrying in 10 seconds","ts":"2019-12-12T07:35:59.978658139Z"}
{"level":"error","message":"Fetching bootstrap failed with error: unexpected end of JSON input","ts":"2019-12-12T07:36:09.98658414Z"}
{"level":"debug","message":"Retries remaining: 5. Retrying in 10 seconds","ts":"2019-12-12T07:36:09.987229599Z"}
{"level":"error","message":"Fetching bootstrap failed with error: unexpected end of JSON input","ts":"2019-12-12T07:36:19.99368735Z"}
{"level":"debug","message":"Retries remaining: 5. Retrying in 10 seconds","ts":"2019-12-12T07:36:19.994522391Z"}
{"level":"error","message":"Fetching bootstrap failed with error: unexpected end of JSON input","ts":"2019-12-12T07:36:30.000299184Z"}
{"level":"debug","message":"Retries remaining: 5. Retrying in 10 seconds","ts":"2019-12-12T07:36:30.000903393Z"}
{"level":"error","message":"Fetching bootstrap failed with error: unexpected end of JSON input","ts":"2019-12-12T07:36:40.006800977Z"}
{"level":"debug","message":"Retries remaining: 5. Retrying in 10 seconds","ts":"2019-12-12T07:36:40.007543227Z"}
{"level":"warn","message":"Retries exhausted","ts":"2019-12-12T07:36:50.008581853Z"}

mainflux bootstrap log:

mainflux-bootstrap | {"level":"warn","message":"Method bootstrap for thing with external id E8-EB-11-41-90-C0 took 2.146298ms to complete with error: non-existent entity.","ts":"2019-12-12T07:36:00.005816458Z"}
mainflux-bootstrap | {"level":"warn","message":"Method bootstrap for thing with external id E8-EB-11-41-90-C0 took 1.885635ms to complete with error: non-existent entity.","ts":"2019-12-12T07:36:10.021449609Z"}
mainflux-bootstrap | {"level":"warn","message":"Method bootstrap for thing with external id E8-EB-11-41-90-C0 took 2.483206ms to complete with error: non-existent entity.","ts":"2019-12-12T07:36:20.028677297Z"}
mainflux-bootstrap | {"level":"warn","message":"Method bootstrap for thing with external id E8-EB-11-41-90-C0 took 1.828785ms to complete with error: non-existent entity.","ts":"2019-12-12T07:36:30.035540444Z"}
mainflux-bootstrap | {"level":"warn","message":"Method bootstrap for thing with external id E8-EB-11-41-90-C0 took 2.079457ms to complete with error: non-existent entity.","ts":"2019-12-12T07:36:40.042089603Z"}

Package error while running the mainflux agent

Hi, I want to run the mainflux agent in my system. But when I try to do make, it is generating this error. Do I need to individually install these packages?

root@ip-172-26-13-75:~/.go/agent/cmd# go run main.go
/usr/local/go/src/src/github.com/mainflux/agent/pkg/terminal/terminal.go:12:2: cannot find package "github.com/creack/pty" in any of:
/usr/local/go/src/src/github.com/mainflux/agent/vendor/github.com/creack/pty (vendor tree)
/usr/local/go/src/vendor/github.com/creack/pty
/usr/local/go/src/src/github.com/mainflux/agent/vendor/github.com/creack/pty
/usr/local/go/src/github.com/creack/pty (from $GOROOT)
/usr/local/go/src/src/github.com/creack/pty (from $GOPATH)
main.go:14:2: cannot find package "github.com/eclipse/paho.mqtt.golang" in any of:
/usr/local/go/src/github.com/eclipse/paho.mqtt.golang (from $GOROOT)
/usr/local/go/src/src/github.com/eclipse/paho.mqtt.golang (from $GOPATH)
main.go:15:2: cannot find package "github.com/go-kit/kit/metrics/prometheus" in any of:
/usr/local/go/src/github.com/go-kit/kit/metrics/prometheus (from $GOROOT)
/usr/local/go/src/src/github.com/go-kit/kit/metrics/prometheus (from $GOPATH)
main.go:22:2: cannot find package "github.com/mainflux/mainflux" in any of:
/usr/local/go/src/github.com/mainflux/mainflux (from $GOROOT)
/usr/local/go/src/src/github.com/mainflux/mainflux (from $GOPATH)
main.go:23:2: cannot find package "github.com/mainflux/mainflux/logger" in any of:
/usr/local/go/src/github.com/mainflux/mainflux/logger (from $GOROOT)
/usr/local/go/src/src/github.com/mainflux/mainflux/logger (from $GOPATH)
/usr/local/go/src/src/github.com/mainflux/agent/pkg/agent/service.go:24:2: cannot find package "github.com/nats-io/nats.go" in any of:
/usr/local/go/src/src/github.com/mainflux/agent/vendor/github.com/nats-io/nats.go (vendor tree)
/usr/local/go/src/vendor/github.com/nats-io/nats.go
/usr/local/go/src/src/github.com/mainflux/agent/vendor/github.com/nats-io/nats.go
/usr/local/go/src/github.com/nats-io/nats.go (from $GOROOT)
/usr/local/go/src/src/github.com/nats-io/nats.go (from $GOPATH)
main.go:25:2: cannot find package "github.com/pkg/errors" in any of:
/usr/local/go/src/github.com/pkg/errors (from $GOROOT)
/usr/local/go/src/src/github.com/pkg/errors (from $GOPATH)
main.go:26:2: cannot find package "github.com/prometheus/client_golang/prometheus" in any of:
/usr/local/go/src/github.com/prometheus/client_golang/prometheus (from $GOROOT)
/usr/local/go/src/src/github.com/prometheus/client_golang/prometheus (from $GOPATH)
`

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.