跨平台 获取系统信息的python库 http://support.hyperic.com/disp
跨平台 获取系统信息的python库 http://support.hyperic.com/disp - 张沈鹏,在路上... - ITeye技术网站
跨平台 获取系统信息的python库 http://support.hyperic.com/disp
博客分类:Python
PythonGitLinuxOSWindowsThe Sigar API provides a portable interface for gathering system information such as:* System memory, swap, cpu, load average, uptime, logins
* Per-process memory, cpu, credential info, state, arguments, environment, open files
* File system detection and metrics
* Network interface detection, configuration info and metrics
* Network route and connection tables
Linux Windows 都可以用
内存检测的库 http://support.hyperic.com/display/SIGAR/Home
git clone git://github.com/hyperic/sigar.git sigar.git
./autogen.sh
./configure
make
make install
cd bindings/python/
python setup.py install
xxx@xxxx~/hypertable/sigar.git/bindings/python/examples $ cat free.py
import os, sigar;
sg = sigar.open()
mem = sg.mem()
swap = sg.swap()
sg.close()
print "\tTotal\tUsed\tFree"
print "Mem:\t",\
(mem.total() / 1024), \
(mem.used() / 1024), \
(mem.free() / 1024)
print "Swap:\t", \
(swap.total() / 1024), \
(swap.used() / 1024), \
(swap.free() / 1024)
print "RAM:\t", mem.ram(), "MB"
xxx@xxxx~/hypertable/sigar.git/bindings/python/examples $ python free.py
Total Used Free
Mem: 33018784 20918484 12100300
Swap: 0 0 0
RAM: 32248 MB
xxx@xxxx~/hypertable/sigar.git/bindings/python/examples $ cat df.py
import os, sigar;
sg = sigar.open()
fslist = sg.file_system_list()
def format_size(size):
return sigar.format_size(size * 1024)
print 'Filesystem\tSize\tUsed\tAvail\tUse%\tMounted on\tType\n'
for fs in fslist:
dir_name = fs.dir_name()
usage = sg.file_system_usage(dir_name)
total = usage.total()
used = total - usage.free()
avail = usage.avail()
pct = usage.use_percent() * 100
if pct == 0.0:
pct = '-'
print fs.dev_name(), format_size(total), format_size(used), format_size(avail),\
pct, dir_name, fs.sys_type_name(), '/', fs.type_name()
xxx@xxxx~/hypertable/sigar.git/bindings/python/examples $ python df.py
Filesystem Size Used Avail Use% Mounted on Type
/dev/md/2 37G 26G 12G 69.0 / reiserfs / local
proc 0 0 0 - /proc proc / none
sysfs 0 0 0 - /sys sysfs / none
udev 10M 208K 9.8M - /dev tmpfs / none
devpts 0 0 0 - /dev/pts devpts / none
/dev/sda4 391G 321G 70G 83.0 /log2 reiserfs / local
/dev/sdd1 931G 281G 650G 31.0 /mp4 reiserfs / local
/dev/sde1 1.4T 1.3T 75G 95.0 /backup1 xfs / local
/dev/sdf1 1.4T 157G 1.2T 12.0 /backup2 xfs / local
shm 16G 0 16G - /dev/shm tmpfs / none
tmpfs 40M 0 40M - /tmplog tmpfs / none
usbfs 0 0 0 - /proc/bus/usb usbfs / none
/dev/sdb1 1.4T 566G 831G 41.0 /mp5 vfat / local
/dev/sdc1 200G 82G 118G 41.0 /mp3 reiserfs / local
跨平台 获取系统信息的python库 http://support.hyperic.com/disp相关推荐
- python iot平台,antares-http-简化与Antares IoT平台连接的Python库-Antares Support Team Installation...
作者:Antares Support Team ### 作者邮箱:support@antares.id ### 首页:https://github.com/antaresdocumentation/a ...
- PennyLane | 用于量子计算机可微分编程的跨平台Python库
PennyLane简介 A cross-platform Python library for differentiable programming of quantum computers. Tra ...
- 获取顶级域名与一级域名的python库-tld
可以参考:https://pypi.org/project/tld/ 获得顶级域名与一级域名的python库.get_tld与get_fld from tld import get_tld url = ...
- 通过siger获取系统信息
一.简单介绍 Sigar(System Information Gatherer And Reporter),是一个开源的工具,提供了跨平台的系统信息收集的API,核心由C语言实现的. 可以被以下语音 ...
- 利用Sigar获取系统信息
地址 Hyperic-hq官方网站:http://www.hyperic.com Sigar.jar下载地址:http://sourceforge.net/projects/sigar/files/ ...
- 一分钟了解几个非常实用的Python库
Python一直被自称"batteries included",就是因为内置了许多非常有用的模块,无需额外安装和配置,即可直接使用. 除了内建的模块外,Python还有大量的第三方 ...
- Python库全部整理出来了,非常全面
库名称简介 Chardet 字符编码探测器,可以自动检测文本.网页.xml的编码. colorama 主要用来给文本添加各种颜色,并且非常简单易用. Prettytable 主要用于在终端或浏览器端构 ...
- 1000+ 常用 Python 库一览
点击上方"视学算法",选择加"星标"或"置顶" 重磅干货,第一时间送达 来源 | 法纳斯特 这次给大家总结整理了1000+常用Python库 ...
- 送你38个常用的Python库,数值计算、可视化、机器学习等8大领域都有了
来源:大数据DT(ID:bigdatadt) 作者:李明江 张良均 周东平 张尚佳 内容摘编自<Python3智能数据分析快速入门> 本文约5200字,建议阅读10分钟. 本文为你总结了常 ...
最新文章
- centos中执行apt-get命令提示apt-get command not found
- yii2-Ueditor百度编辑器
- R-error: 错误: nul character not allowed (line 1)
- 将代码从windows移动linux上出现^M错误的解决方法
- 《视频直播技术详解》系列之七:现代播放器原理
- VS(C++)配置Halcon(一次配置,永久使用)
- apache是干嘛用的_同学,其实用免费版的IDEA来创建SpringBoot项目挺方便的...
- mybatis mysql 注解_Mybatis注解的使用
- LiteIDE简单使用
- TRIZ创新方法——因果链分析
- 如何下载哔哩哔哩里的视频
- 泰拉瑞亚 阿里云服务器搭建记录
- Final Cut pro快捷键大全
- Git教程及常用命令
- java StringUtil之String工具类
- 服务器端测试经验分享
- 汇编语言--逻辑指令
- 备忘录怎么用红笔标注_如何高效的使用苹果产品的备忘录、提醒事项、日历?...
- SQL学习之check约束
- 在Win10平台上搭建AI训练(英伟达GPU加速)环境
热门文章
- vsflexgrid单元格换行后自动使用行高_「Excel技巧」Excel关于换行的技巧,你懂多少?...
- access 查找工龄大于30_同济大学大学计算机access作业答案
- oracle中rac是什么意思,Oracle中HA、RAC、Datagurad区别
- 网页设计简约_简约设计指南
- 笔记-项目人力资源管理-复习要点
- Openlayers中设置定时绘制和清理直线图层
- 鸿蒙基于JS搭建HelloWorld并修改国际化文件
- MyBatis中动态sql实现时间范围比较的查询
- AndroidStudio更新时报错:Connection Error,Temp directory inside installation
- C#中对文件File常用操作方法的工具类