title: Python script to verify disk space output from Linux
body: <p>I am beginner in the python, I am writing a python script to verify the utilization of each mount point is above the threshold or not. I am able invoke the shell command and save the output to a variable. But I am not able to use the variable to split the fields, check the utilization is above the threshold  and report the fault </p>
  
  <pre><code>/dev/mapper/system-root     20G   18G  1.4G  93% /
  udev                       3.9G  248K  3.9G   1% /dev
  tmpfs                      3.9G   68K  3.9G   1% /dev/shm
  /dev/sda1                  251M   71M  167M  30% /boot
  /dev/mapper/system-oracle  128G   43G   79G  36% /opt/app/oracle
  /dev/mapper/system-tmp     5.5G  677M  4.5G  13% /tmp
  /dev/mapper/system-log     3.0G  140M  2.7G   5% /var/log
  /dev/mapper/system-varsog   20G  654M   19G   4% /var/sog
  /dev/mapper/system-backup   50G   24G   24G  50% /var/sog/backups
  </code></pre>
  
  <p>I want to store field 5 and field 6 in an associative array and validate the Field 5 with threshold and report if it is above the threshold value.</p>
  
  <p>I used below script to store the shell command output and now I need to process by splitting its Fields but I am not able to store it in array as it is multidimensional, So should I need to use For Loop to store in different array.</p>
  
  <p>It is very easy to do in shell ,awk and perl but it seems to be very difficult python.</p>
  
  <pre><code>&gt;&gt;&gt; import sys, os, time, threading, subprocess,datetime
  &gt;&gt;&gt; diskinfo_raw = subprocess.Popen("df -h", shell=True,stdout=subprocess.PIPE)
  &gt;&gt;&gt; output = diskinfo_raw.communicate()[0]
  &gt;&gt;&gt; print output
  </code></pre>
  
  <p>Please help me with an idea or reference please. I have explored option with <code>loadtxt</code> option but I don't want to store the values in the file and again read it. </p>