提交 39807301 编写于 作者: N Nicolargo

First try for ESXi

上级 0e7685ff
......@@ -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):
......
......@@ -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()]
......
......@@ -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.
先完成此消息的编辑!
想要评论请 注册