安装sigar的python模块
[root@test ~]# wget ftp://195.220.108.108/linux/Mandriva/devel/cooker/x86_64/media/contrib/release/python-sigar-1.6.3.20100329-3mdv2011.0.x86_64.rpm
[root@test ~]# rpm2cpio python-sigar-1.6.3.20100329-3mdv2011.0.x86_64.rpm | cpio -ivd
[root@test ~]# cp usr/lib64/python2.7/site-packages/sigar.py usr/lib64/python2.7/site-packages/_sigar.so /usr/local/python/lib/python2.7/site-packages/
测试
[root@test ~]# git clone git://github.com/hyperic/sigar.git sigar
[root@test ~]# cd sigar/bindings/python/examples
[root@test examples]# python df.py
Filesystem Size Used Avail Use% Mounted on Type
/dev/sda2 31G 9.2G 21G 31.0 / ext4 / local
proc 0 0 0 - /proc proc / none
sysfs 0 0 0 - /sys sysfs / none
devpts 0 0 0 - /dev/pts devpts / none
tmpfs 1.9G 0 1.9G - /dev/shm tmpfs / none
none 0 0 0 - /proc/sys/fs/binfmt_misc binfmt_misc / none
[root@test examples]# python free.py
Total Used Free
Mem: 3924452 2702096 1222356
Swap: 8388600 0 8388600
RAM: 3832 MB