File tree Expand file tree Collapse file tree 3 files changed +23
-23
lines changed
Expand file tree Collapse file tree 3 files changed +23
-23
lines changed Original file line number Diff line number Diff line change @@ -39,22 +39,22 @@ def device(self):
3939 def usedSpace (self ):
4040 capacity = self .capacity
4141 free = self .freeSpace ()
42- if capacity is None or free is None :
43- return None
44- return capacity - free
42+ if capacity is not None and free is not None :
43+ return capacity - free
44+ return None
4545
46- def freeSpace (self ):
47- free = self .cacheRRDValue ('diskFreeSpace' )
48- if free is None or isnan (free ):
49- return None
50- return long ( free )
46+ def freeSpace (self , default = None ):
47+ free = self .cacheRRDValue ('diskFreeSpace' , default )
48+ if free is not None and free != 'Unknown' and not isnan (free ):
49+ return long ( free )
50+ return None
5151
5252 def usedPercent (self ):
5353 capacity = self .capacity
5454 used = self .usedSpace ()
55- if capacity is None or used is None :
56- return 'Unknown'
57- return round ( 100.0 * used / capacity )
55+ if capacity is not None and used is not None :
56+ return round ( 100.0 * used / capacity )
57+ return 'Unknown'
5858
5959InitializeClass (ESXiDatastore )
6060
Original file line number Diff line number Diff line change @@ -38,17 +38,17 @@ class ESXiVM(DeviceComponent, ManagedEntity):
3838 def device (self ):
3939 return self .esxiHost ()
4040
41- def adminStatus (self ):
42- status = self .cacheRRDValue ('adminStatus' )
43- if status is None or isnan (status ):
44- return None
45- return int ( status )
46-
47- def operStatus (self ):
48- status = self .cacheRRDValue ('operStatus' )
49- if status is None or isnan (status ):
50- return None
51- return int ( status )
41+ def adminStatus (self , default = None ):
42+ status = self .cacheRRDValue ('adminStatus' , default )
43+ if status is not None and status != 'Unknown' and not isnan (status ):
44+ return int ( status )
45+ return None
46+
47+ def operStatus (self , default = None ):
48+ status = self .cacheRRDValue ('operStatus' , default )
49+ if status is not None and status != 'Unknown' and not isnan (status ):
50+ return int ( status )
51+ return None
5252
5353InitializeClass (ESXiVM )
5454
Original file line number Diff line number Diff line change 33# or saved. Do not modify them directly here.
44# NB: PACKAGES is deprecated
55NAME = "ZenPacks.community.VMwareESXiMonitor"
6- VERSION = "2.0.4 "
6+ VERSION = "2.0.5 "
77AUTHOR = "Eric Enns, Matthias Kittl"
88LICENSE = ""
99NAMESPACE_PACKAGES = ['ZenPacks' , 'ZenPacks.community' ]
You can’t perform that action at this time.
0 commit comments