Pandaspowered系统监控软件包
pdsys的Python项目详细描述
pdsys公司
系统监控用熊猫动力组件
安装
pip install pdsys
基本用法
^{pr2}$要在本地获取系统利用率报告(如数据帧):
df=pdsys.report()
pdsys默认返回psutil进程迭代器中的所有进程属性信息:
df.columns.tolist()>>>['cmdline','connections','cpu_affinity','cpu_num','cpu_percent','cpu_times.children_system','cpu_times.children_user','cpu_times.system','cpu_times.user','create_time','cwd','environ','exe','gids.effective','gids.real','gids.saved','hostname','io_counters','io_counters.read_bytes','io_counters.read_chars','io_counters.read_count','io_counters.write_bytes','io_counters.write_chars','io_counters.write_count','ionice.value','memory_full_info','memory_full_info.data','memory_full_info.dirty','memory_full_info.lib','memory_full_info.pss','memory_full_info.rss','memory_full_info.shared','memory_full_info.swap','memory_full_info.text','memory_full_info.uss','memory_full_info.vms','memory_info.data','memory_info.dirty','memory_info.lib','memory_info.rss','memory_info.shared','memory_info.text','memory_info.vms','memory_maps','memory_percent','name','nice','num_ctx_switches.involuntary','num_ctx_switches.voluntary','num_fds','num_threads','open_files','pid','ppid','status','terminal','threads','uids.effective','uids.real','uids.saved','username']
您可以查询输出数据帧以获取有关系统的更多信息:
# getting top 5 processes sorted by memory utilizationdf.sort_values(by='memory_percent',ascending=False)[['name','memory_percent']].head(5)
name | memory_percent | |
---|---|---|
104 | systemd-journald | 20.865 |
76 | gunicorn | 4.06886 |
75 | gunicorn | 4.05697 |
77 | gunicorn | 4.01536 |
74 | gunicorn | 1.92189 |
另外,pdsys可以通过提供主机列表从远程系统运行报告:
df=pdsys.report(hosts=['user@host1','user@host2'])df[df.memory_percent>0.9].groupby(['hostname','name']).agg({'memory_percent':'sum','pid':'count','num_threads':'sum','memory_info.rss':lambdax:sum(x)/1e6})^{tb2}$
- 项目
标签: