Random Project

Problem

I have ESXi 5.5. If i run this script in console it works great. But in nagios it is always OK status, even i have critical value. What can i do, to fix this?