Troubleshooting Sensu

In this guide, we’ll cover some of the more common issues to run into when deploying Sensu. For each section, we’ll start with the behavior that’s most commonly observed, and then walk through some possible solutions to solve that issue.

Have an issue that isn’t listed here? Open an issue with what you think should be added to this guide!

Initial Troubleshooting

Before we dive into things like troubleshooting connectivity with RabbitMQ, or Redis, it’s important to start off with some baseline troubleshooting steps you can take whenever you encounter an issue with your Sensu deployment.

Setting Log Levels

Sensu has the ability to set log levels interactively, or by using a configuration directive in /etc/default/sensu. This is particularly useful when attempting to debug an issue where the current log level doesn’t provide sufficient information. Let’s take a look at the ways you can set your log levels.

Perhaps the quickest way to set your log level is to use the following command:

sudo kill -TRAP $SENSUPID

This will toggle the debug log level on/off for Sensu. In practice, it looks something like this:

sudo ps aux | grep [s]ensu-server
sensu     5992  1.7  0.3 177232 24352 ...
sudo kill -TRAP 5992

Additionally, you can set the log level to info or debug by using the configuration directive in /etc/default/sensu. Let’s take a look at an example:

sudo cat /etc/default/sensu

And after setting that directive, restarting the respective Sensu services:

sudo systemctl restart sensu-{server,api,client}

Keep in mind that to set log levels back to normal, you can either run sudo kill -TRAP $SENSUPID (if you’ve used that method), or revert the change in /etc/default/sensu and restart the Sensu processes for the change to take place.

NOTE: By default, Sensu’s logging level is set to info. However, there are more log levels available than just info and debug. You can find the full list of available log levels in the configuration reference documentation. It’s worth noting that debug is the most granular log level, while fatal is the least granular.

Printing Configurations

Frequently, Sensu staff or community members may ask you to print your configuration. It’s fairly easy to print the configuration for your Sensu deployment:

Sensu Core:

/opt/sensu/bin/sensu-client --print_config | tee sensu-core-config.json

Sensu Enterprise:

sudo -u sensu java -jar /usr/lib/sensu-enterprise/sensu-enterprise.jar -c /etc/sensu/config.json -d /etc/sensu/conf.d --print_config | tee se-config.json

This command will result in output that will list the entire configuration for your Sensu deployment. This can be especially useful when comparing the configuration that Sensu is aware of, versus the configuration living on-disk. If the values of a particular file differ from what you’re expecting, then see the next section for how to proceed.

Restarting Services

It’s crucial that you restart your Sensu services after each change so that the configuration changes are read. For most recent Linux distributions (CentOS/RHEL, Debian/Ubuntu) this is done using systemd:

sudo systemctl restart sensu-{server,api,client}

In the event that you’re using a system where sysvinit is the service manager of choice, you can use:

sudo service sensu-client restart
sudo service sensu-server restart
sudo service sensu-api restart

It’s especially important to restart the sensu-client process if you’re making use of any standalone checks, as the client will be responsible for check scheduling and execution.

Collecting Logs

Sensu’s logs provide a wealth of information when troubleshooting issues. They live at /var/log/sensu:

# tree /var/log/sensu
├── sensu-api.log
├── sensu-client.log
└── sensu-server.log

Sensu staff, or community members may ask to see your logs. You can view them at the paths above, or provide them in an archive:

tail -n 10000 /var/log/sensu/sensu-server.log > sensu-server-10k.log && gzip -9 sensu-server-10k.log

RabbitMQ Connectivity

In this section, we’ll discuss issues faced when connecting to RabbitMQ and how you can go about troubleshooting them.

Authentication Failures

One of the more common issues that you’ll encounter when having RabbitMQ connectivity difficulties is the client and/or server failing to authenticate to RabbitMQ. Let’s take a look at what an example error message might look like from both Sensu and from RabbitMQ:

  "timestamp": "2018-06-25T15:34:54.222674-0500",
  "level": "warn",
  "message": "transport connection error",
  "reason": "possible authentication failure. wrong credentials?",
  "user": "sensu"
tail -f /var/log/rabbitmq/rabbit\@sensu.log
2018-06-26 01:28:00.439 [info] <0.618.0> accepting AMQP connection <0.618.0> ( ->
2018-06-26 01:28:00.442 [error] <0.618.0> Error on AMQP connection <0.618.0> ( ->, state: starting):
PLAIN login refused: user 'sensu' - invalid credentials
2018-06-26 01:28:03.469 [info] <0.618.0> closing AMQP connection <0.618.0> ( ->

As you can see, both RabbitMQ and Sensu will give errors if the credentials are incorrect. We’ll now walk through the ways in which you can verify that the credentials are correct.

Troubleshooting Authenticating Failures

We’ll start by going through the process of setting up RabbitMQ manually. If you’ve gone through our RabbitMQ installation guide, these commands should be familiar.

Ensure that you’ve created the correct vhost:

sudo rabbitmqctl list_vhosts

This should give you output that looks like:

Listing vhosts ...

NOTE: The / in front the sensu vhost is required. If you’re missing the slash, but have configured Sensu to use the vhost /sensu, you will see an error.

If your vhost output doesn’t look like the output above, create the vhost:

sudo rabbitmqctl add_vhost /sensu
  • Ensure that the sensu user is present:
sudo rabbitmqctl list_users

This should give you output that looks like:

Listing users ...
sensu   []
guest   [administrator]

If the user isn’t present, add the user and the password for the user:

sudo rabbitmqctl add_user sensu secret

NOTE: If the user is present, and the password needs to be reset, you can reset it by using sudo rabbitmqctl change_password sensu secret

  • Ensure that the sensu user has the correct permissions for the vhost:
sudo rabbitmqctl list_permissions -p /sensu

You should see output that looks like the following:

Listing permissions for vhost "/sensu" ...
sensu   .*      .*      .*

If the permissions are not correct, you can set them via:

sudo rabbitmqctl set_permissions -p /sensu sensu ".*" ".*" ".*"

Once we’ve ensured that our credentials are correct, we can see that RabbitMQ starts showing connections being accepted again:

tail -f /var/log/rabbitmq/rabbit\@sensu.log
2018-06-26 01:28:35.191 [info] <0.642.0> accepting AMQP connection <0.642.0> ( ->
2018-06-26 01:28:35.194 [info] <0.642.0> connection <0.642.0> ( -> user 'sensu' authenticated and granted access to vhost '/sensu'

WARNING: The credentials in this guide shouldn’t be used in any production environment. If you’re curious about how to better secure RabbitMQ, see our Securing RabbitMQ Guide.


SSL issues are one of the more difficult ones to troubleshoot inside of Sensu. What lends to this difficulty is the way that AMQP (the protocol used by RabbitMQ) handles SSL failures, primarily in that the failure seen is indistinguishable from an actual authentication issue.

If you’ve already gone through the steps in the previous section to confirm that your Sensu instance is using the correct credentials to connect to your RabbitMQ instance, then you’ll want to proceed through this part of the guide to rule out any issues with SSL.

PRO TIP: For troubleshooting SSL issues, the openssl tool provides a wealth of troubleshooting capabilities. To see what is possible with the tool, take a look at this handy cheat sheet.

Handshake Failures

There are several layers of the proverbial onion when it comes to diagnosing handshake failures. We’ll start by looking at the obvious errors that you’ll see in logs, and dive deeper from there. The assumption here is that you’ve already configured Sensu to use SSL. If not, you’ll want to refer back to our SSL Configuration Reference material before you proceed. Now, on to examining the errors you’ll likely encounter in a handshake failure scenario:

Sensu Logs:

{"timestamp":"2018-06-10T16:39:15.988000+0200","level":"warn","message":"transport connection error","reason":"tcp connection lost"}
{"timestamp":"2018-06-10T16:39:15.989000+0200","level":"warn","message":"transport connection error","reason":"possible authentication failure. wrong credentials?","user":"sensu"}

Much like the errors seen in the previous section, the failure to connect to RabbitMQ appears to be one related to credentials. However, we can go a bit deeper by looking at the RabbitMQ logs, which present an error similar to the following:

2018-06-11 15:31:03.515 [info] <0.1540.0> TLS server: In state certify at ssl_handshake.erl:1289 generated SERVER ALERT: Fatal - Handshake Failure - {bad_cert,invalid_ext_key_usage}

NOTE: We’ll presume that if you’ve gone through our SSL guide, that you’re using the SSL tool to generate the certificates used in your deployment. If not, this is not a problem, as the commands we’ll use for troubleshooting this particular scenario will prove useful no matter how your cert and key pairs are generated.

Let’s start off by manually verifying our certificate and key pairs. Sensu’s SSL tool will place the certs/keys in the following directory:

├── client
│ ├── cert.pem
│ ├── keycert.p12
│ ├── key.pem
│ └── req.pem
├── sensu_ca
│ ├── cacert.cer
│ ├── cacert.pem
│ ├── certs
│ │ ├── 01.pem
│ │ └── 02.pem
│ ├── index.txt
│ ├── index.txt.attr
│ ├── index.txt.attr.old
│ ├── index.txt.old
│ ├── openssl.cnf
│ ├── private
│ │ └── cakey.pem
│ ├── serial
│ └── serial.old
├── server
│ ├── cert.pem
│ ├── keycert.p12
│ ├── key.pem
│ └── req.pem

From the sensu_ssl_tool directory, we’ll check for a match between the cert and key used inside of the RabbitMQ configuration:

openssl x509 -noout -modulus -in server/cert.pem | openssl md5
(stdin)= 32df80471e2d4e7d0453f60cfb66b2b2
openssl rsa -noout -modulus -in server/key.pem | openssl md5
(stdin)= 32df80471e2d4e7d0453f60cfb66b2b2

And then the same with our client cert and key (cert and key being used inside of the Sensu configuration):

openssl x509 -noout -modulus -in client/cert.pem | openssl md5
(stdin)= c2a6a5a28a629653741e7674c3b95b19
openssl rsa -noout -modulus -in client/key.pem | openssl md5
(stdin)= c2a6a5a28a629653741e7674c3b95b19

WARNING: Should the values here NOT match, you’ll need to regenerate your cert/key pairs.

And just to test to ensure that we can indeed connect with our cert/key pairs, we can use openssl to connect to our RabbitMQ instance directly:

openssl s_client -connect localhost:5671 -key client/key.pem

Which should give you output that will look similar to the following:

depth=1 CN = SensuCA
verify error:num=19:self signed certificate in certificate chain
Certificate chain
0 s:/CN=sensu/O=server
1 s:/CN=SensuCA

Provided that the MD5 sums match and we’re able to connect to RabbitMQ via openssl, we can effectively rule out any issues with the certificates.

Let’s move on to looking at the certificate (in this case, the server certificate specifically) and see what we find there. You can use the following command to examine the inner details of a certificate:

openssl x509 -in server/cert.pem -text -noout

This will give you quite a bit, but the most important thing to note here is a specific extension:

        X509v3 extensions:
            X509v3 Basic Constraints:
            X509v3 Key Usage:
                Key Encipherment
            X509v3 Extended Key Usage:
                TLS Web Server Authentication

In the output above, we’re specifically interested in the TLS Web Server Authentication extension. In a non-working certificate, you will not see this present. Instead, you’ll end up seeing a value that looks similar to a SNMP MIB. See the image below for an example.