Sensu-agent not running - Solved

Hi all,

I have installed the sensu-agent and trying to start it using the service manager.
When I hit sudo service sensu-agent start, it is showing as started.
When I check the status, it is showing as sensu-agent not running.
I also have my agent .yml file in /etc/sensu folder.

Can someone help me with this?


Which linux distribution are you using? If you are using a linux distribution that is using systemd you may be about to use journalctl

Example, show logs from sensu-agent from the last hour

journalctl -u sensu-agent -S "1 hour ago"

Off the top of my head I’m suspicious you have an error in your configuration file.

If you want to troubleshoot outside of service management, you can run sensu-agent manually like this:

sudo -u sensu /usr/sbin/sensu-agent start --config-file /etc/sensu/agent.yml --log-level debug

I’ll do this when I troubleshooting something subtle in my config file or i have a filesystem permissions problem that is causing the agent to fail to operate.

I am using amazon linux and I can start the agent manually using the sensu-agent start and there is nothing wrong in the config file.
But I need to replace it by starting the agent using service manager.

Also when we manually start the agent, it is running all over the screen. So I want that running in the back. I don’t want my log on the screen. So I am using the service manager.

Please help me with this.

Without the logs it’s going to be hard.
Still can you check the access right on the folowing files/folders:

ls -l /var/cache/sensu/
ls -l /var/lib/sensu
ls -l /etc/sensu

You have to make sure that the sensu user have access to the files/directory.
You can also try to launch the sensu-agent manually to see if it will give you more information

You will have to log on as sensu user first I think (su - sensu, but you may have to change the shell to something like /bin/bash first) and then run the following command:

sensu-agent start -c /etc/sensu/agent.yml

sensu-agent start -c /etc/sensu/agent.yml is working fine.

But I want this command to act like a daemon so that after this command I can execute some other commands. That is why I need sudo service sensu-agent start to start the sensu-agent properly

Any ideas??

Do you have anything in the output? maybe you will have to increase log level or so.

After on Ubuntu like distro I never tried to use sensu (I’m only using it on windows and centos), but if the sensu-agent start (as sensu user not as root) is working, then i think just issuing this command should be enugh

service sensu-agent start

If you ever launched the sensu-agent start command as root, most likely you have directories on which don’t have any more the correct access right.

I’m getting the output as:

@ganeshkatakam these screenshots aren’t useful in trying to help you resolve the issue. @jspaleta had provided a command to collect log output, and @Luc_Dandoy had also provided some commands to look at permissions. Please collect the log output and the information that Luc has provided commands for and add that here.

@aaronsachs-sensu since I am using amazon linux version 1, I am unable to use the journalctl to get logs. Yet I have checked the permissions of the paths mentioned by @Luc_Dandoy. I am attaching them here.

As told by @Luc_Dandoy I tried starting the agent manually using the command sensu-agent start -c /etc/sensu/agent.yml which is working fine.

My problem is that why cannot the service manager run the agent when I can do that manually.

I need some clarity as to which amazon linux version you are running as to avoid confusion. amazon linux(based on centos6) uses upstart for its init, and amazon linux 2 uses systemd (based on centos7). So the instructions on how to troubleshoot a running service will be different. Once I know for sure which init system you using, I’ll be able to give you detailed instructions.

But for now here’s how I would go about troubleshooting the different options

Amazon Linux (centos6)
If you are running amazon linux based on centos6 you should see this file:


and log messages from service start up attempts should be in /var/log/sensu/sensu-agent.log. This service script uses a pretty advanced start up that requires chroot to be installed. Look at the start() function in that file to see what’s invovled.
Possible problems you make be having include:

  • chroot command is not available
  • sensu user does not have permissions to write into /var/log/sensu/ or /var/run/sensu/

Amazon Linux 2 (centos7)
If you are running amazon linux 2 based on centos7 you should see this file:


Troubleshooting the systemd based service is much easier, as you can make use of journalctl to look at the logs from sensu-agent start up failures.

Thanks @jspaleta ,

The error in the log is
{“component”:“agent”,“error”:“error creating agent: could not open api queue (/var/cache/sensu/sensu-agent/queue.db): open /var/cache/sensu/sensu-agent/queue.db: permission denied”,“level”:“fatal”,“msg”:“error executing sensu-agent”,“time”:“2020-04-22T15:12:16Z”}

For thia problem, there is a solution in

Finally resolved.