mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-23 01:01:31 +03:00
FreeBSD: If oid 'hw.acpi.battery' not present, Glances wont start #1055
This commit is contained in:
parent
f568daa3cc
commit
686dda1121
@ -224,23 +224,28 @@ class GlancesGrabSensors(object):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""Init sensors stats."""
|
"""Init sensors stats."""
|
||||||
# Temperatures
|
# Temperatures
|
||||||
|
self.initok = False
|
||||||
|
self.stemps = {}
|
||||||
try:
|
try:
|
||||||
# psutil>=5.1.0 is required
|
# psutil>=5.1.0 is required
|
||||||
self.stemps = psutil.sensors_temperatures()
|
self.stemps = psutil.sensors_temperatures()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
logger.warning("PsUtil 5.1.0 or higher is needed to grab temperatures sensors")
|
logger.warning("PsUtil 5.1.0 or higher is needed to grab temperatures sensors")
|
||||||
self.initok = False
|
except OSError as e:
|
||||||
self.stemps = {}
|
# FreeBSD: If oid 'hw.acpi.battery' not present, Glances wont start #1055
|
||||||
|
logger.error("Can not grab temperatures sensors ({})".format(e))
|
||||||
else:
|
else:
|
||||||
self.initok = True
|
self.initok = True
|
||||||
|
|
||||||
# Fans
|
# Fans
|
||||||
|
self.sfans = {}
|
||||||
try:
|
try:
|
||||||
# psutil>=5.2.0 is required
|
# psutil>=5.2.0 is required
|
||||||
self.sfans = psutil.sensors_fans()
|
self.sfans = psutil.sensors_fans()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
logger.warning("PsUtil 5.2.0 or higher is needed to grab fans sensors")
|
logger.warning("PsUtil 5.2.0 or higher is needed to grab fans sensors")
|
||||||
self.sfans = {}
|
except OSError as e:
|
||||||
|
logger.error("Can not grab fans sensors ({})".format(e))
|
||||||
|
|
||||||
# Init the stats
|
# Init the stats
|
||||||
self.reset()
|
self.reset()
|
||||||
|
Loading…
Reference in New Issue
Block a user