title: Creating a tty for Sensu with Python
body: <p>Hello guys I'm trying to create a sensu check in python that requires a shell but is currently giving me a tty error.</p>
  
  <pre><code>cmd = '/usr/bin/pstorage stat |grep %s |grep failed' % hostname
  output = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True).communicate()[0]
  </code></pre>
  
  <p>Sensu by default doesn't have a tty so when it tries to execute the script</p>
  
  <pre><code>sudo /etc/sensu/plugins/diskauto.py --storage_name pool-01
  </code></pre>
  
  <p>the output is </p>
  
  <pre><code>sudo: no tty present and no askpass program specified
  </code></pre>
  
  <p>I already have the following sudo rule in place </p>
  
  <pre><code>Cmnd_Alias DRIVE_AUTOMATION=/apptio/scripts/diskauto.py
  </code></pre>