Disk Space Script

mostro713 at gmail.com mostro713 at gmail.com
Sat Nov 24 12:46:32 EST 2007


Hello all,

I would like to write a script in Python to email me when disk space
gets below a certain value.

My first question (I'm sure of many) is how do get this output into a
dictionary or list to index the values?

import os
os.system("df -x cifs -x iso9660 | grep -E ^/dev | awk '{ print
$1,$4 }'")

[What the output looks like]

/dev/sda3 15866012
/dev/sda4 26126712

I would like to write code that compares /dev/sda* to a number (ex.
2000000 -> "2GB") and sends an alert if the indexed value is below it.

I'm a noob so keep it simple.

Thanks in advance.



More information about the Python-list mailing list