Sensuctl errors and questions - SOLVED


#1

I’m completely new to Sensu and am trying out Sensu Go 5.1.1.

I successfully installed and configured the backend, agent and a couple of checks on a CentOS 7 server. Now I’m struggling to get the agent and some checks installed on a Windows server.

I get the following error when I run ‘sensuctl configure’ on Windows:
Error: unable to authenticate with error: Received an unexpected response from the API

I retried ‘sensuctl configure’ with a bad agent password and got the following error:
Error: unable to authenticate with error: {“Code”:5,“Message”:“bad credentials”}

I tried a bunch of other commands like sensuctl check list and sensuctl entity list and got the following error:
Error: Unable to locate credentials. You can configure credentials by running “sensuctl configure”

For fun, I tried running the Windows agent and it appears to be working OK. I used the example agent.yml config file modifed for my server and passwords. The agent runs and keepalives appear in the console.

Aside from the errors, my question is, is it necessary to run sensuctl on all clients in addition to the clients? What exactly does sensuctl do?

Thanks,
Dave


#2

Hi @DaveO! :wave:

Welcome to Sensu! Super happy to have you trying things out.

I wanted to address the error you’re seeing:

Error: unable to authenticate with error: Received an unexpected response from the API

Typically we see this when folks have something between their workstation they have sensuctl installed on and the backend. A proxy tends to be the most likely culprit. Can you tell us a bit more about your setup?

Also, to answer your question about sensuctl, it’s a command line utility and really only needs to be installed on whatever workstation you’re using. So for example, you can have a remote setup in some DC, and just have sensuctl installed on your laptop/desktop and interact with your deployment from there. So all that to say, remote systems that you’re monitoring don’t need sensuctl installed on them, only agents.

Let me know if this helps!


#3

Also, the following articles might be of use to help clarify things:

That last guide will walk you through an example scenario and should help with understanding how to use sensuctl with your deployment.


#4

Aaron,

Thanks for the explanation. I was under the impression that I had to run sensuctl on all the agent managed nodes, but it sort of didn’t make sense why.

I installed the backend and an agent on a CentOS 7 using the docs install instructions. I did not use the sandbox virtualbox download. Everything on that server seems to be running fine, including sensuctl.

I opened firewall ports on the CentOS box for the agent config, api config and dashboard ports using firewall-cmd.

I was able to get the agent working on Win2008 R2 and Win2012 R2, but sensctl does not work on either. There is no firewall on the Windows servers and no proxy between the agents and the backend.

We’re mostly a Windows shop and at this point am unable to test whether sensuctl would work on a separate linux box.

Dave


#5

Hi @DaveO,

I did some testing on my end and did run into the same error you did on Windows (both from WSL and from Powershell). Ultimately, this came down to how I was configuring Sensu using sensuctl and some hosts issues (I’m currently running it in a K8s environment, so there’s some funky stuff happening).

Can you attach a screenshot of running through sensuctl.exe configure from one of the Windows boxes?

After accounting for the K8s weirdness, things are working just fine:


#6

Aaron,

Here’s the screenshot:

sensuctl

Don’t know if this will shed any light on the problem, but when I run sensuctl without any parameters on the Windows boxes I get the following error:

Error: Unable to locate credentials. You can configure credentials by running “sensuctl configure”

When I run the same command line on my CentOS box, I get the help text.


#7

Hi @DaveO,

I think I may have spotted a couple of issues.

  1. Sensuctl is designed to communicated with the backend(HTTP) API. By default, this listens on :8080, not :8081. See https://docs.sensu.io/sensu-go/5.1/getting-started/faq/ for the list of ports. It’s totally understandable if there’s confusion around the HTTP API and the Agent API.

  2. Have you created a user via Sensuctl that is named agent? If not, then this will not work. See https://docs.sensu.io/sensu-go/5.1/sensuctl/quickstart/ for the initial configuration.

So ideally, if you’ve not done anything beyond just setting up a Sensu backend instance, your sensuctl configure should look like this:

sensuctl configure
? Sensu Backend URL: http://NAME.OF.YOUR.CENTOS.BACKEND:8080
? Username: admin
? Password: P@ssw0rd!

The output indicates to me that using :8081 is giving some garbled output since it doesn’t know what Sensuctl is trying to do. Can you try running sensuctl configure with the options I listed above on the Windows box and see if that makes a differnce?


#8

I should clarify this:

I mean, if you’ve not created any users or namespaces, etc. We’re talking a bare minimum configuration.


#9

Aaron,

It works after switching to port 8080. Funny thing, I’m almost certain I tried that on Friday.

My config at this point is pretty minimal. Sensuctl worked fine on my CentOS box and I was able to change the admin password, create the agent account and install a couple of check plugins. I just wasn’t able to get that going on Windows. All good now.

Thanks for your help!

Dave


#10

Hi @DaveO,

Glad to hear things are sorted! You’re not the first to try having sensuctl connect to the agent API, so no worries! If you run into any additional issues, don’t hesitate to reach out!