mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-25 18:23:41 +03:00
Adding a specific entry in conf to deal with hdd temperatures' limits
This commit is contained in:
parent
3253ee7815
commit
6f4b6d6ed8
@ -43,12 +43,19 @@ warning=70
|
||||
critical=90
|
||||
|
||||
[temperature]
|
||||
# Temperatures in °C for sensors/hddtemp
|
||||
# Temperatures in °C for sensors
|
||||
# Defaults values if not defined: 60/70/80
|
||||
careful=60
|
||||
warning=70
|
||||
critical=80
|
||||
|
||||
[hddtemperature]
|
||||
# Temperatures in °C for hddtemp
|
||||
# Defaults values if not defined: 45/52/60
|
||||
careful=45
|
||||
warning=52
|
||||
critical=60
|
||||
|
||||
[filesystem]
|
||||
# Defaults limits for free filesytem space in %
|
||||
# Defaults values if not defined: 50/70/90
|
||||
|
@ -255,7 +255,8 @@ class glancesLimits:
|
||||
STD is for defaults limits (CPU/MEM/SWAP/FS)
|
||||
CPU_IOWAIT limits (iowait in %)
|
||||
LOAD is for LOAD limits (5 min/15 min)
|
||||
TEMP is for sensors/hddtemp limits (temperature in °C)
|
||||
TEMP is for sensors limits (temperature in °C)
|
||||
HDDTEMP is for hddtemp limits (temperature in °C)
|
||||
"""
|
||||
__limits_list = {'STD': [50, 70, 90],
|
||||
'CPU_USER': [50, 70, 90],
|
||||
@ -265,6 +266,7 @@ class glancesLimits:
|
||||
'MEM': [50, 70, 90],
|
||||
'SWAP': [50, 70, 90],
|
||||
'TEMP': [60, 70, 80],
|
||||
'HDDTEMP': [45, 52, 60],
|
||||
'FS': [50, 70, 90],
|
||||
'PROCESS_CPU': [50, 70, 90],
|
||||
'PROCESS_MEM': [50, 70, 90]}
|
||||
@ -307,6 +309,11 @@ class glancesLimits:
|
||||
self.__setLimits('TEMP', 'temperature', 'careful')
|
||||
self.__setLimits('TEMP', 'temperature', 'warning')
|
||||
self.__setLimits('TEMP', 'temperature', 'critical')
|
||||
if config.has_section('hddtemperature'):
|
||||
# Read HDDTEMP limits
|
||||
self.__setLimits('HDDTEMP', 'hddtemperature', 'careful')
|
||||
self.__setLimits('HDDTEMP', 'hddtemperature', 'warning')
|
||||
self.__setLimits('HDDTEMP', 'hddtemperature', 'critical')
|
||||
if config.has_section('filesystem'):
|
||||
# Read FS limits
|
||||
self.__setLimits('FS', 'filesystem', 'careful')
|
||||
@ -409,6 +416,15 @@ class glancesLimits:
|
||||
def getTEMPCritical(self):
|
||||
return self.getCritical('TEMP')
|
||||
|
||||
def getHDDTEMPCareful(self):
|
||||
return self.getCareful('HDDTEMP')
|
||||
|
||||
def getHDDTEMPWarning(self):
|
||||
return self.getWarning('HDDTEMP')
|
||||
|
||||
def getHDDTEMPCritical(self):
|
||||
return self.getCritical('HDDTEMP')
|
||||
|
||||
def getFSCareful(self):
|
||||
return self.getCareful('FS')
|
||||
|
||||
@ -1730,6 +1746,35 @@ class glancesScreen:
|
||||
"""
|
||||
return self.__colors_list2[self.__getSensorsAlert(current)]
|
||||
|
||||
def __getHDDTempAlert(self, current=0):
|
||||
# Alert for HDDTemp (temperature in degre)
|
||||
# If current < CAREFUL then alert = OK
|
||||
# If current > CAREFUL then alert = CAREFUL
|
||||
# If current > WARNING then alert = WARNING
|
||||
# If current > CRITICALthen alert = CRITICAL
|
||||
|
||||
if current > limits.getHDDTEMPCritical():
|
||||
return 'CRITICAL'
|
||||
elif current > limits.getHDDTEMPWarning():
|
||||
return 'WARNING'
|
||||
elif current > limits.getHDDTEMPCareful():
|
||||
return 'CAREFUL'
|
||||
|
||||
return 'OK'
|
||||
|
||||
def __getHDDTempColor(self, current=0):
|
||||
"""
|
||||
Return color for HDDTemp temperature
|
||||
"""
|
||||
return self.__colors_list[self.__getHDDTempAlert(current)]
|
||||
|
||||
def __getHDDTempColor2(self, current=0):
|
||||
"""
|
||||
Return color for HDDTemp temperature
|
||||
"""
|
||||
return self.__colors_list2[self.__getHDDTempAlert(current)]
|
||||
|
||||
|
||||
def __getProcessAlert(self, current=0, max=100, stat='', core=1):
|
||||
# If current < CAREFUL of max then alert = OK
|
||||
# If current > CAREFUL of max then alert = CAREFUL
|
||||
@ -2458,7 +2503,7 @@ class glancesScreen:
|
||||
self.term_window.addnstr(
|
||||
self.hddtemp_y + 1 + i, self.hddtemp_x + 20,
|
||||
format(hddtemp[i]['value'], '>3'), 3,
|
||||
self.__getSensorsColor(hddtemp[i]['value']))
|
||||
self.__getHDDTempColor(hddtemp[i]['value']))
|
||||
ret = ret + 1
|
||||
return ret
|
||||
return 0
|
||||
@ -2969,8 +3014,9 @@ class glancesScreen:
|
||||
stat_labels = [_("CPU user %"), _("CPU system %"),
|
||||
_("CPU iowait %"), _("Load"),
|
||||
_("RAM memory %"), _("Swap memory %"),
|
||||
_("Temp °C"), _("Filesystem %"),
|
||||
_("CPU process %"), _("MEM process %")]
|
||||
_("Temp °C"), _("HDD Temp °C"),
|
||||
_("Filesystem %"), _("CPU process %"),
|
||||
_("MEM process %")]
|
||||
|
||||
width = 8
|
||||
limits_table_x = self.help_x + 2
|
||||
@ -3002,6 +3048,9 @@ class glancesScreen:
|
||||
[0, limits.getTEMPCareful(),
|
||||
limits.getTEMPWarning(),
|
||||
limits.getTEMPCritical()],
|
||||
[0, limits.getHDDTEMPCareful(),
|
||||
limits.getHDDTEMPWarning(),
|
||||
limits.getHDDTEMPCritical()],
|
||||
[0, limits.getFSCareful(),
|
||||
limits.getFSWarning(),
|
||||
limits.getFSCritical()],
|
||||
|
Loading…
Reference in New Issue
Block a user