Sensu Windows client not seeing config.yml

I cannot get Windows to find my backend server. The windows client refuses to use the agent.yml configuration file. I have my configuration file in c:\programdata\sensu\config\agent.yml as documentation suggests.

I then use sensu-agent service install.
When the service starts i look in the log file configured at c:\programdata\sensu\log\agent.log and it is trying to connect to 127.0.0.1.

This is a vm running on Windows Server 2019. This was built from source code at https://github.com/sensu/sensu-go

Versions are:

sensu-agent version (devel)+ce, community edition, built with go1.15.2
sensu-backend version (devel)+ce, community edition, built with go1.14.6

They both used the same v. 6.0.0 tagged source code.

My configuration is:

---

Sensu agent configuration

agent overview

name: “GITCIDEVWIN03”
#namespace: “default”
#subscriptions:

- example

#labels:

example_key: “example value”

#annotations:

example/key: “example value”

agent configuration

backend-url:

  • “wss://sensutest-backend1:8081”
    #disable-assets: false
    log-level: “debug” # available log levels: panic, fatal, error, warn, info, debug

api configuration

#api-host: “127.0.0.1”
#api-port: 3031
#disable-api: false
#events-burst-limit: 10
#events-rate-limit: 10.0

authentication configuration

#user: “agent”
#password: “P@ssw0rd!”

monitoring configuration

#deregister: false
#deregistration-handler: “example_handler”
keepalive-warning-timeout: 300
#keepalive-interval: 20

security configuration

#insecure-skip-tls-verify: false
#redact:

- password

- passwd

- pass

- api_key

- api_token

- access_key

- secret_key

- private_key

- secret

trusted-ca-file: “c:\opt\sensu-go\ssl\ca.pem”

socket configuration

#disable-sockets: false
#socket-host: “127.0.0.1”
#socket-port: 3030

statsd configuration

#statsd-disable: false
#statsd-event-handlers:

- example_handler

#statsd-flush-interval: 10
#statsd-metrics-host: “127.0.0.1”
#statsd-metrics-port: 8125

Hey,
Did you make the change to the configuration file after starting the Sensu Agent service? You might need to stop and restart the service to ensure your changes are picked up. The configuration file is only read once at beginning of service start.

I have recreated the service multiple times. Stopped and started it. Is there something that needs to be deleted after the service restarts or anything?

The log states:

LogFile

{“component”:“agent”,“level”:“info”,“msg”:“API shutting down”,“time”:“2020-09-24T07:55:04-04:00”}
{“component”:“agent”,“event”:{“Title”:“Gostatsd stopped”,“Text”:“Gostatsd stopped”,“DateHappened”:1600948504,“Hostname”:“gitcidevwin03”,“AggregationKey”:"",“SourceTypeName”:"",“Tags”:null,“SourceIP”:"",“Priority”:1,“AlertType”:0},“level”:“info”,“msg”:“statsd received an event”,“time”:“2020-09-24T07:55:04-04:00”}
{“level”:“warning”,“msg”:“Error reading from socket: read udp 127.0.0.1:8125: use of closed network connection”,“time”:“2020-09-24T07:55:04-04:00”}
{“level”:“warning”,“msg”:“Error reading from socket: read udp 127.0.0.1:8125: use of closed network connection”,“time”:“2020-09-24T07:55:04-04:00”}
{“level”:“warning”,“msg”:“Error closing socket: close udp 127.0.0.1:8125: use of closed network connection”,“time”:“2020-09-24T07:55:04-04:00”}
{“level”:“warning”,“msg”:“Error reading from socket: read udp 127.0.0.1:8125: use of closed network connection”,“time”:“2020-09-24T07:55:04-04:00”}
{“level”:“warning”,“msg”:“Error reading from socket: read udp 127.0.0.1:8125: use of closed network connection”,“time”:“2020-09-24T07:55:04-04:00”}
{“component”:“cmd”,“level”:“info”,“logger-config”:{“Path”:“C:\ProgramData\sensu\log\sensu-agent.log”,“MaxSizeBytes”:134217728,“RetentionDuration”:604800000000000,“RetentionFiles”:10},“msg”:“logging to file”,“time”:“2020-09-24T07:55:06-04:00”}
{“component”:“cmd”,“level”:“info”,“msg”:“sensu-agent service starting”,“time”:“2020-09-24T07:55:06-04:00”}
{“component”:“agent”,“level”:“info”,“msg”:“compacting api queue”,“time”:“2020-09-24T07:55:06-04:00”}
{“component”:“agent”,“level”:“info”,“msg”:“finished api queue compaction”,“time”:“2020-09-24T07:55:06-04:00”}
{“component”:“agent”,“level”:“info”,“msg”:“using password auth”,“time”:“2020-09-24T07:55:06-04:00”}
{“component”:“agent”,“level”:“info”,“msg”:“configuration successfully validated”,“time”:“2020-09-24T07:55:06-04:00”}
{“component”:“agent”,“level”:“info”,“msg”:“starting statsd server on address: 127.0.0.1:8125”,“time”:“2020-09-24T07:55:06-04:00”}
{“component”:“agent”,“level”:“info”,“msg”:“starting UDP listener on address: 127.0.0.1:3030”,“time”:“2020-09-24T07:55:06-04:00”}
{“component”:“agent”,“level”:“info”,“msg”:“starting TCP listener on address: 127.0.0.1:3030”,“time”:“2020-09-24T07:55:06-04:00”}
{“component”:“agent”,“event”:{“Title”:“Gostatsd started”,“Text”:“Gostatsd started”,“DateHappened”:1600948506,“Hostname”:“gitcidevwin03”,“AggregationKey”:"",“SourceTypeName”:"",“Tags”:null,“SourceIP”:"",“Priority”:1,“AlertType”:0},“level”:“info”,“msg”:“statsd received an event”,“time”:“2020-09-24T07:55:06-04:00”}
{“component”:“agent”,“level”:“info”,“msg”:"connecting to backend URL “ws://127.0.0.1:8081"”,“time”:“2020-09-24T07:55:06-04:00”}
{“component”:“agent”,“level”:“info”,“msg”:“starting api on address: 127.0.0.1:3031”,“time”:“2020-09-24T07:55:06-04:00”}
{“component”:“agent”,“error”:“dial tcp 127.0.0.1:8081: connectex: No connection could be made because the target machine actively refused it.”,“level”:“error”,“msg”:“reconnection attempt failed”,“time”:“2020-09-24T07:55:07-04:00”}
{“component”:“agent”,“level”:“info”,“msg”:"connecting to backend URL “ws://127.0.0.1:8081"”,“time”:“2020-09-24T07:55:07-04:00”}
{“component”:“agent”,“error”:“dial tcp 127.0.0.1:8081: connectex: No connection could be made because the target machine actively refused it.”,“level”:“error”,“msg”:“reconnection attempt failed”,“time”:“2020-09-24T07:55:08-04:00”}
{“component”:“agent”,“level”:“info”,“msg”:"connecting to backend URL “ws://127.0.0.1:8081"”,“time”:“2020-09-24T07:55:08-04:00”}
{“component”:“agent”,“error”:“dial tcp 127.0.0.1:8081: connectex: No connection could be made because the target machine actively refused it.”,“level”:“error”,“msg”:“reconnection attempt failed”,“time”:“2020-09-24T07:55:09-04:00”}

I found out what was wrong. There should be something that says why the config file isnt valid. It turned out to be this line:

trusted-ca-file: “c:\opt\sensu-go\ssl\ca.pem”

It should be escaped…

trusted-ca-file: “c:\opt\sensu-go\ssl\ca.pem”