Checks Location

I previously used sensu go version 5.1 so I know there was a directory that you can put python scripts to run checks however I cant figure it out for the current version. I currently deployed latest version of sensu go as a test run (backend and agent). I created my checks and I’m calling a few python scripts of my own that are also compatible with Nagios. I spent a long time trying to figure out where sensu calls on scripts/commands to run from but cant seem to figure it out. Currently for bash scripts I get command not found and for python scripts I get sh: no such file or directory. please advise.


I’m having a little trouble understanding your concern, so let me first restate what I think your problem is and the provide a solution for that. Let me know if I’ve misinterpreted what you wrote.

Okay, so I think what you are saying is you want to be able to adjust the executable path used by the Sensu agent so that things like your python scripts(installed on the agent host) work as expected.

I’m also going to assume for the purpose of this discussion below that the Sensu agent you are running right now is running on linux using the official packages.

So assuming all of that…
you always have the ability to use the full path to your executable in the check command. I generally do that as a first diagnostic when working on a new script. I put it in an oddball location and then write the check such that its explicitly calling the executable script using the full path on disk. This isn’t ideal, across multiple agents, buts its good for testing on an agent host i have full control over.

After that, if you want to keep you executables in a special directory, you can update the agent’s environment and explicitly set the PATH environment variable to exactly what you need. If using the official packages, the service lifecycle scripts (either systemd or sysvinit depending on the version of linux) know how to make use of environment files to read in your customized envvars.

Also if you update the agent running environment to set the PATH explicitly, a simple way to test your agent’s environment is what you expect after agent restart is to run a simple diagnostic check that echo’s out $PATH . I keep simple diagnostic checks like this unpublished in my Sensu namespace so I can use sensuctl check execute to run the checks in an adhoc manner so I can quickly get agent environment information without having to login to a specific agent to try to check the running environment config.