Sensu check is inconsistently failing with [Errno 9] Bad file descriptor error

I have script to get details from different VM’s. I have written a check, where I’m sending the VM names as parameters, which is coming to 5 checks in total and all the checks run at the same exact schedule. Very inconsistently I get below error for a particular check all the time.

python3.6: can’t open file ‘/etc/sensu/plugins/vm.py’: [Errno 9] Bad file descriptor

I understand that, when the file is being closed externally the above error occurs.

Is there a way to handle this in sensu, as I would like to keep the interval for all checks same.

Hmmmm, that doesn’t sound like an issue with Sensu, per se, but with the script–does it take a long time to execute? Not being a pythonista, some quick searches sound like you need to use a close() method in your script, if you’re not doing so already.