Sensu agent installed in windows is not connecting to backend

sensu Agent has been installed in windows machine
Backend url also available in agent,yml
when I started sensu agent service, sensu backed service went down
I observed below logs in backend log

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x3c pc=0xfc7708]

goroutine 251 [running]:
github.com/sensu/sensu-go/backend/keepalived.createKeepaliveEvent(0xc42018de30, 0x1786680)
        /go/src/github.com/sensu/sensu-go/backend/keepalived/keepalived.go:256 +0x128
github.com/sensu/sensu-go/backend/keepalived.(*Keepalived).handleUpdate(0xc42016aa00, 0xc42018de30, 0xc4200aa080, 0xc421788c00)
        /go/src/github.com/sensu/sensu-go/backend/keepalived/keepalived.go:307 +0x1be
github.com/sensu/sensu-go/backend/keepalived.(*Keepalived).processKeepalives(0xc42016aa00)
        /go/src/github.com/sensu/sensu-go/backend/keepalived/keepalived.go:223 +0x24d
created by github.com/sensu/sensu-go/backend/keepalived.(*Keepalived).startWorkers
        /go/src/github.com/sensu/sensu-go/backend/keepalived/keepalived.go:177 +0x87```


I can see below logs in agent log

```{"component":"agent","level":"info","msg":"starting statsd server on address: 127.0.0.1:8125","time":"2018-11-14T09:02:21-05:00"}
{"component":"agent","event":{"Title":"Gostatsd started","Text":"Gostatsd started","DateHappened":1542204141,"Hostname":"<AgentHostname>","AggregationKey":"","SourceTypeName":"","Tags":null,"SourceIP":"","Priority":1,"AlertType":0},"level":"info","msg":"statsd received an event","time":"2018-11-14T09:02:21-05:00"}
{"component":"agent","level":"info","msg":"sending keepalive","time":"2018-11-14T09:02:21-05:00"}
{"component":"agent","level":"info","msg":"starting UDP listener on address: 127.0.0.1:3030","time":"2018-11-14T09:02:21-05:00"}
{"component":"agent","level":"info","msg":"starting TCP listener on address: 127.0.0.1:3030","time":"2018-11-14T09:02:21-05:00"}
{"component":"agent","level":"info","msg":"starting api on address: 127.0.0.1:3031","time":"2018-11-14T09:02:21-05:00"}
{"component":"agent","level":"info","msg":"connected - starting receivePump","time":"2018-11-14T09:02:21-05:00"}
{"component":"agent","level":"info","msg":"connected - starting sendPump","time":"2018-11-14T09:02:21-05:00"}
{"component":"agent","error":"Connection error: websocket: close 1006 (abnormal closure): unexpected EOF","level":"error","msg":"transport receive error","time":"2018-11-14T09:02:21-05:00"}
{"component":"agent","error":"dial tcp {<Backend IP}:8081: connectex: No connection could be made because the target machine actively refused it.","level":"error","msg":"reconnection attempt failed","time":"2018-11-14T09:02:23-05:00"}
{"component":"agent","error":"dial tcp {<Backend IP}:8081: connectex: No connection could be made because the target machine actively refused it.","level":"error","msg":"reconnection attempt failed","time":"2018-11-14T09:02:24-05:00"}
{"component":"agent","error":"dial tcp {<Backend IP}:8081: connectex: No connection could be made because the target machine actively refused it.","level":"error","msg":"reconnection attempt failed","time":"2018-11-14T09:02:26-05:00"}
{"component":"agent","error":"dial tcp {<Backend IP}:8081: connectex: No connection could be made because the target machine actively refused it.","level":"error","msg":"reconnection attempt failed","time":"2018-11-14T09:02:29-05:00"}
{"component":"agent","error":"dial tcp {<Backend IP}:8081: connectex: No connection could be made because the target machine actively refused it.","level":"error","msg":"reconnection attempt failed","time":"2018-11-14T09:02:33-05:00"}
{"component":"agent","error":"dial tcp {<Backend IP}:8081: connectex: No connection could be made because the target machine actively refused it.","level":"error","msg":"reconnection attempt failed","time":"2018-11-14T09:02:39-05:00"}
{"component":"agent","level":"info","msg":"sending keepalive","time":"2018-11-14T09:02:41-05:00"}
{"component":"agent","error":"Connection closed: the websocket connection is no longer open","level":"warning","msg":"transport send error","time":"2018-11-14T09:02:41-05:00"}
{"component":"agent","error":"dial tcp {<Backend IP}:8081: connectex: No connection could be made because the target machine actively refused it.","level":"error","msg":"reconnection attempt failed","time":"2018-11-14T09:02:48-05:00"}
{"component":"agent","level":"info","msg":"sending keepalive","time":"2018-11-14T09:03:01-05:00"}
{"component":"agent","error":"Connection closed: the websocket connection is no longer open","level":"warning","msg":"transport send error","time":"2018-11-14T09:03:01-05:00"}
{"component":"agent","error":"dial tcp {Backend IP}:8081: connectex: No connection could be made because the target machine actively refused it.","level":"error","msg":"reconnection attempt failed","time":"2018-11-14T09:03:06-05:00"}```



Could you please let me know what has gone wrong

@balajik515 can you please wrap your code/error blocks in ```? This will make it much easier to read for those troubleshooting the issue.

Hi @balajik515,

Can you tell me the exact version of the Sensu agent and the Sensu backend? We identified a similar problem when running older agents with a recent version of the backend:

If that’s the case, I’d recommend to make sure to run the same version across your agents and backend.

sensu backedn 5.0.0-1 & sensu agent 5.0.0-1

I will need the exact version installed, which you can get by running the following commands:

sensu-backend version

sensu-agent version

Thanks!

sensu-agent version 2.0.0-beta.4-4#a05ad41, build a05ad411199077286f49c06629eed4823331176c, built 2018-08-16T21:12:56+00
00

sensu-backend version 2.0.0-beta.7-7#0ad392d, build 0ad392d15948e7cc38fdb93a9ada56aa05f42970, built 2018-10-26T17:07:52+0000

This agent we installed in windows.Its not working only in windows
But it is working in rhel

As you can see, the agent and the backend are running two different version (beta.7 vs beta.4), which is causing this issue:

Unfortunately Windows packages for the sensu-agent are no longer published for the moment. The easiest solution would probably to manually build a Windows binary for the agent from the source code, using the 2.0.0-beta.7-1 tag. Let us know if you need help with that.