Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ericenns/ZenPacks.community.VMwareESXiMonitor
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.0.1
Choose a base ref
...
head repository: ericenns/ZenPacks.community.VMwareESXiMonitor
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 12 commits
  • 10 files changed
  • 4 contributors

Commits on Nov 16, 2014

  1. Copy the full SHA
    c1e17fe View commit details

Commits on Dec 1, 2014

  1. Merge pull request #2 from Mattikin/master

    Renamed esxi_interfaceinfo perl script
    ericenns committed Dec 1, 2014
    Copy the full SHA
    82db217 View commit details

Commits on Jan 28, 2015

  1. esxi_monitor.pl: check for datastructure to be non-empty before acces…

    …s, otherwise get_info() fails silently on empty values
    turingmachine committed Jan 28, 2015
    Copy the full SHA
    ee515de View commit details

Commits on Jan 29, 2015

  1. Copy the full SHA
    7262f67 View commit details
  2. Merge pull request #4 from turingmachine/master

    esxi_monitor.pl: check for datastructure to be non-empty before access, ...
    ericenns committed Jan 29, 2015
    Copy the full SHA
    ce5f2fe View commit details

Commits on Mar 28, 2015

  1. Copy the full SHA
    ec30ac4 View commit details
  2. Merge remote-tracking branch 'upstream/master'

    Conflicts:
    	setup.py
    Mattikin committed Mar 28, 2015
    Copy the full SHA
    d180036 View commit details
  3. Merge pull request #6 from Mattikin/master

    Added performance metrics for ESXi Host, added thresholds for CPU and Memory usage
    Mattikin committed Mar 28, 2015
    Copy the full SHA
    6769e2e View commit details

Commits on Apr 17, 2015

  1. Fixed TypeError

    Mattikin committed Apr 17, 2015
    Copy the full SHA
    645febb View commit details
  2. Merge pull request #7 from Mattikin/master

    Fixed TypeError
    Mattikin committed Apr 17, 2015
    Copy the full SHA
    7bd58a6 View commit details

Commits on May 7, 2015

  1. Copy the full SHA
    4221332 View commit details
  2. Merge pull request #9 from Mattikin/master

    Fixed TypeError: not enough arguments for format string
    Mattikin committed May 7, 2015
    Copy the full SHA
    1e2a2ff View commit details
6 changes: 3 additions & 3 deletions ZenPacks/community/VMwareESXiMonitor/ESXiDatastore.py
Original file line number Diff line number Diff line change
@@ -43,9 +43,9 @@ def usedSpace(self):
return capacity - free
return None

def freeSpace(self):
free = self.cacheRRDValue('diskFreeSpace')
if free is not None and not isnan(free):
def freeSpace(self, default = None):
free = self.cacheRRDValue('diskFreeSpace', default)
if free is not None and free != 'Unknown' and not isnan(free):
return long(free)
return None

12 changes: 6 additions & 6 deletions ZenPacks/community/VMwareESXiMonitor/ESXiVM.py
Original file line number Diff line number Diff line change
@@ -38,15 +38,15 @@ class ESXiVM(DeviceComponent, ManagedEntity):
def device(self):
return self.esxiHost()

def adminStatus(self):
status = self.cacheRRDValue('adminStatus')
if status is not None and not isnan(status):
def adminStatus(self, default = None):
status = self.cacheRRDValue('adminStatus', default)
if status is not None and status != 'Unknown' and not isnan(status):
return int(status)
return None

def operStatus(self):
status = self.cacheRRDValue('operStatus')
if status is not None and not isnan(status):
def operStatus(self, default = None):
status = self.cacheRRDValue('operStatus', default)
if status is not None and status != 'Unknown' and not isnan(status):
return int(status)
return None

Original file line number Diff line number Diff line change
@@ -28,7 +28,6 @@ class VMwareDataSource(ZenPackPersistence, RRDDataSource.SimpleRRDDataSource):

sourcetype = 'VMware'
eventClass = Cmd_Fail
parser = 'ZenPacks.community.VMwareESXiMonitor.parsers.vmware'
performanceSource = ''
instance = ''

@@ -70,7 +69,7 @@ def useZenCommand(self):
def addDataPoints(self):
datastore = ['diskFreeSpace','connectionStatus']
guest = ['memUsage','memOverhead','memConsumed','diskUsage','cpuUsageMin','cpuUsageMax','cpuUsageAvg','cpuUsage','adminStatus','operStatus']
host = ['sysUpTime','memSwapused','memGranted','memActive','diskUsage','cpuUsagemhz','cpuUsage','cpuReservedcapacity','netReceived','netTransmitted','netPacketsRx','netPacketsTx','netDroppedRx','netDroppedTx']
host = ['sysUpTime','memUsage','memSwapused','memGranted','memActive','diskUsage','cpuUsageMin','cpuUsageMax','cpuUsageAvg','cpuUsage','cpuReservedcapacity','netReceived','netTransmitted','netPacketsRx','netPacketsTx','netDroppedRx','netDroppedTx']

if self.id == "VMwareDatastore":
self.performanceSource = "VMwareDatastore"
43 changes: 23 additions & 20 deletions ZenPacks/community/VMwareESXiMonitor/libexec/esxi_monitor.pl
Original file line number Diff line number Diff line change
@@ -66,14 +66,14 @@
}
else {
my $perfmgr_view = Vim::get_view(mo_ref => Vim::get_service_content()->perfManager, properties => [ 'perfCounter' ]);
my $memUsage = get_info($vm_view, $perfmgr_view, 'mem', 'usage', 'minimum');
my $memOverhead = get_info($vm_view, $perfmgr_view, 'mem', 'overhead', 'minimum');
my $memConsumed = get_info($vm_view, $perfmgr_view, 'mem', 'consumed', 'minimum');
my $diskUsage = get_info($vm_view, $perfmgr_view, 'disk', 'usage', 'average');
my $cpuUsageMin = get_info($vm_view, $perfmgr_view, 'cpu', 'usage', 'minimum');
my $cpuUsageMax = get_info($vm_view, $perfmgr_view, 'cpu', 'usage', 'maximum');
my $cpuUsageAvg = get_info($vm_view, $perfmgr_view, 'cpu', 'usage', 'average');
my $cpuUsage = get_info($vm_view, $perfmgr_view, 'cpu', 'usagemhz', 'average');
my $memUsage = get_info($vm_view, $perfmgr_view, 'mem', 'usage', 'minimum') / 100;
my $memOverhead = get_info($vm_view, $perfmgr_view, 'mem', 'overhead', 'minimum') * 1024;
my $memConsumed = get_info($vm_view, $perfmgr_view, 'mem', 'consumed', 'minimum') * 1024;
my $diskUsage = get_info($vm_view, $perfmgr_view, 'disk', 'usage', 'average') * 1024;
my $cpuUsageMin = get_info($vm_view, $perfmgr_view, 'cpu', 'usage', 'minimum') / 100;
my $cpuUsageMax = get_info($vm_view, $perfmgr_view, 'cpu', 'usage', 'maximum') / 100;
my $cpuUsageAvg = get_info($vm_view, $perfmgr_view, 'cpu', 'usage', 'average') / 100;
my $cpuUsage = get_info($vm_view, $perfmgr_view, 'cpu', 'usagemhz', 'average') * 1000000;

my $overallStatus = $$vm_view[0]->get_property('summary.overallStatus')->val;
my $operStatus = 0;
@@ -99,26 +99,29 @@
die "Runtime error\n" if (!defined($host_view));
die "Host \"" . $$host_name{"name"} . "\" does not exist\n" if (!@$host_view);
if (uc($$host_view[0]->get_property('runtime.inMaintenanceMode')) eq "TRUE") {
print "hostperf|sysUpTime= memSwapused= memGranted= memActive= diskUsage= cpuUsagemhz= cpuUsage= cpuReservedcapacity= netReceived= netTransmitted= netPacketsRx= netPacketsTx= netDroppedRx= netDroppedTx=\n";
print "hostperf|sysUpTime= memUsage= memSwapused= memGranted= memActive= diskUsage= cpuUsageMin= cpuUsageMax= cpuUsageAvg= cpuUsage= cpuReservedcapacity= netReceived= netTransmitted= netPacketsRx= netPacketsTx= netDroppedRx= netDroppedTx=\n";
}
else {
my $perfmgr_view = Vim::get_view(mo_ref => Vim::get_service_content()->perfManager, properties => [ 'perfCounter' ]);
my $sysUpTime = get_info($host_view, $perfmgr_view, 'sys', 'uptime', 'latest') * 100;
my $memSwapused = get_info($host_view, $perfmgr_view, 'mem', 'swapused', 'maximum');
my $memGranted = get_info($host_view, $perfmgr_view, 'mem', 'granted', 'maximum');
my $memActive = get_info($host_view, $perfmgr_view, 'mem', 'active', 'maximum');
my $diskUsage = get_info($host_view, $perfmgr_view, 'disk', 'usage', 'average');
my $cpuUsagemhz = get_info($host_view, $perfmgr_view, 'cpu', 'usagemhz', 'average');
my $cpuUsage = get_info($host_view, $perfmgr_view, 'cpu', 'usage', 'average');
my $cpuReservedcapacity = get_info($host_view, $perfmgr_view, 'cpu', 'reservedCapacity', 'average');
my $netReceived = get_info($host_view, $perfmgr_view, 'net', 'received', 'average');
my $netTransmitted = get_info($host_view, $perfmgr_view, 'net', 'transmitted', 'average');
my $memUsage = get_info($host_view, $perfmgr_view, 'mem', 'usage', 'minimum') / 100;
my $memSwapused = get_info($host_view, $perfmgr_view, 'mem', 'swapused', 'maximum') * 1024;
my $memGranted = get_info($host_view, $perfmgr_view, 'mem', 'granted', 'maximum') * 1024;
my $memActive = get_info($host_view, $perfmgr_view, 'mem', 'active', 'maximum') * 1024;
my $diskUsage = get_info($host_view, $perfmgr_view, 'disk', 'usage', 'average') * 1024;
my $cpuUsageMin = get_info($host_view, $perfmgr_view, 'cpu', 'usage', 'minimum') / 100;
my $cpuUsageMax = get_info($host_view, $perfmgr_view, 'cpu', 'usage', 'maximum') / 100;
my $cpuUsageAvg = get_info($host_view, $perfmgr_view, 'cpu', 'usage', 'average') / 100;
my $cpuUsage = get_info($host_view, $perfmgr_view, 'cpu', 'usagemhz', 'average') * 1000000;
my $cpuReservedcapacity = get_info($host_view, $perfmgr_view, 'cpu', 'reservedCapacity', 'average') * 1000000;
my $netReceived = get_info($host_view, $perfmgr_view, 'net', 'received', 'average') * 8192;
my $netTransmitted = get_info($host_view, $perfmgr_view, 'net', 'transmitted', 'average') * 8192;
my $netPacketsRx = get_info($host_view, $perfmgr_view, 'net', 'packetsRx', 'summation');
my $netPacketsTx = get_info($host_view, $perfmgr_view, 'net', 'packetsTx', 'summation');
my $netDroppedRx = get_info($host_view, $perfmgr_view, 'net', 'droppedRx', 'summation');
my $netDroppedTx = get_info($host_view, $perfmgr_view, 'net', 'droppedTx', 'summation');

print "hostperf|sysUpTime=".$sysUpTime." memSwapused=".$memSwapused." memGranted=".$memGranted." memActive=".$memActive." diskUsage=".$diskUsage." cpuUsagemhz=".$cpuUsagemhz." cpuUsage=".$cpuUsage." cpuReservedcapacity=".$cpuReservedcapacity." netReceived=".$netReceived." netTransmitted=".$netTransmitted." netPacketsRx=".$netPacketsRx." netPacketsTx=".$netPacketsTx." netDroppedRx=".$netDroppedRx." netDroppedTx=".$netDroppedTx."\n";
print "hostperf|sysUpTime=".$sysUpTime." memUsage=".$memUsage." memSwapused=".$memSwapused." memGranted=".$memGranted." memActive=".$memActive." diskUsage=".$diskUsage." cpuUsageMin=".$cpuUsageMin." cpuUsageMax=".$cpuUsageMax." cpuUsageAvg=".$cpuUsageAvg." cpuUsage=".$cpuUsage." cpuReservedcapacity=".$cpuReservedcapacity." netReceived=".$netReceived." netTransmitted=".$netTransmitted." netPacketsRx=".$netPacketsRx." netPacketsTx=".$netPacketsTx." netDroppedRx=".$netDroppedRx." netDroppedTx=".$netDroppedTx."\n";
}
}
};
@@ -183,7 +186,7 @@ sub get_info {
my $values;
$values = get_performance_values($views, $perfmgr_view, $group_type, ($counter.".".$rollup_type));

if (defined($values)) {
if (defined($values) && exists $$values[0][0]->{value}) {
my ( $t ) = split(/,/, $$values[0][0]->value);
return $t;
}
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ def process(self, device, results, log):
elif re.search(';', line):
name, type, capacity, accessible = line.split(';')
if not int(accessible) == 1:
log.warning('Datastore %s of device %s is not accessible' % name, device.id)
log.warning('Datastore %s of device %s is not accessible' % (name, device.id))
continue
rm.append(self.objectMap({
'id': self.prepId(name),
Loading