Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蜕变的菜鸟
glances
提交
39807301
G
glances
项目概览
蜕变的菜鸟
/
glances
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
glances
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
39807301
编写于
6月 27, 2014
作者:
N
Nicolargo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
First try for ESXi
上级
0e7685ff
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
17 addition
and
10 deletion
+17
-10
glances/core/glances_stats.py
glances/core/glances_stats.py
+3
-2
glances/plugins/glances_cpu.py
glances/plugins/glances_cpu.py
+4
-3
glances/plugins/glances_mem.py
glances/plugins/glances_mem.py
+10
-5
未找到文件。
glances/core/glances_stats.py
浏览文件 @
39807301
...
...
@@ -28,10 +28,11 @@ from glances.core.glances_globals import plugins_path, sys_path
# SNMP OID regexp pattern to short system name dict
oid_to_short_system_name
=
{
'.*Linux.*'
:
'linux'
,
'.*BSD.*'
:
'bsd'
,
'.*Darwin.*'
:
'mac'
,
'.*BSD.*'
:
'bsd'
,
'.*Windows.*'
:
'windows'
,
'.*Cisco.*'
:
'cisco'
}
'.*Cisco.*'
:
'cisco'
,
'.*VMware ESXi.*'
:
'esxi'
}
class
GlancesStats
(
object
):
...
...
glances/plugins/glances_cpu.py
浏览文件 @
39807301
...
...
@@ -30,7 +30,8 @@ import psutil
snmp_oid
=
{
'default'
:
{
'user'
:
'1.3.6.1.4.1.2021.11.9.0'
,
'system'
:
'1.3.6.1.4.1.2021.11.10.0'
,
'idle'
:
'1.3.6.1.4.1.2021.11.11.0'
},
'windows'
:
{
'percent'
:
'1.3.6.1.2.1.25.3.3.1.2'
}}
'windows'
:
{
'percent'
:
'1.3.6.1.2.1.25.3.3.1.2'
},
'esxi'
:
{
'percent'
:
'1.3.6.1.2.1.25.3.3.1.2'
}}
class
Plugin
(
GlancesPlugin
):
...
...
@@ -92,8 +93,8 @@ class Plugin(GlancesPlugin):
elif
self
.
get_input
()
==
'snmp'
:
# Update stats using SNMP
if
self
.
get_short_system_name
()
==
'windows'
:
# Windows
if
self
.
get_short_system_name
()
in
(
'windows'
,
'esxi'
)
:
# Windows
or VMWare ESXi
# You can find the CPU utilization of windows system by querying the oid
# Give also the number of core (number of element in the table)
# print snmp_oid[self.get_short_system_name()]
...
...
glances/plugins/glances_mem.py
浏览文件 @
39807301
...
...
@@ -39,7 +39,11 @@ snmp_oid = {'default': {'total': '1.3.6.1.4.1.2021.4.5.0',
'windows'
:
{
'mnt_point'
:
'1.3.6.1.2.1.25.2.3.1.3'
,
'alloc_unit'
:
'1.3.6.1.2.1.25.2.3.1.4'
,
'size'
:
'1.3.6.1.2.1.25.2.3.1.5'
,
'used'
:
'1.3.6.1.2.1.25.2.3.1.6'
}}
'used'
:
'1.3.6.1.2.1.25.2.3.1.6'
},
'esxi'
:
{
'mnt_point'
:
'1.3.6.1.2.1.25.2.3.1.3'
,
'alloc_unit'
:
'1.3.6.1.2.1.25.2.3.1.4'
,
'size'
:
'1.3.6.1.2.1.25.2.3.1.5'
,
'used'
:
'1.3.6.1.2.1.25.2.3.1.6'
}}
class
Plugin
(
GlancesPlugin
):
...
...
@@ -109,8 +113,8 @@ class Plugin(GlancesPlugin):
self
.
stats
[
'used'
]
=
self
.
stats
[
'total'
]
-
self
.
stats
[
'free'
]
elif
self
.
get_input
()
==
'snmp'
:
# Update stats using SNMP
if
self
.
get_short_system_name
()
==
'windows'
:
# Mem stats for Windows
OS
are stored in the FS table
if
self
.
get_short_system_name
()
in
(
'windows'
,
'esxi'
)
:
# Mem stats for Windows
|Vmware Esxi
are stored in the FS table
try
:
fs_stat
=
self
.
set_stats_snmp
(
snmp_oid
=
snmp_oid
[
self
.
get_short_system_name
()],
bulk
=
True
)
...
...
@@ -118,8 +122,9 @@ class Plugin(GlancesPlugin):
self
.
reset
()
else
:
for
fs
in
fs_stat
:
# The Physical Memory gives statistics on RAM usage and availability.
if
fs
==
'Physical Memory'
:
# The Physical Memory (Windows) or Real Memory (VmWare)
# gives statistics on RAM usage and availability.
if
fs
in
(
'Physical Memory'
,
'Real Memory'
):
self
.
stats
[
'total'
]
=
int
(
fs_stat
[
fs
][
'size'
])
*
int
(
fs_stat
[
fs
][
'alloc_unit'
])
self
.
stats
[
'used'
]
=
int
(
fs_stat
[
fs
][
'used'
])
*
int
(
fs_stat
[
fs
][
'alloc_unit'
])
self
.
stats
[
'percent'
]
=
float
(
self
.
stats
[
'used'
]
*
100
/
self
.
stats
[
'total'
])
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录