Reactive limits for sensors

This commit is contained in:
Nicolargo 2014-05-26 12:56:40 +02:00
parent 87258ebf95
commit 5961a947db
3 changed files with 42 additions and 24 deletions

View File

@ -63,19 +63,21 @@ careful=50
warning=70
critical=90
[temperature]
# Temperatures in °C for sensors
[sensors]
# Sensors core limits
# Default values if not defined: 60/70/80
careful=60
warning=70
critical=80
[hddtemperature]
temperature_core_careful=60
temperature_core_warning=70
temperature_core_critical=80
# Temperatures in °C for hddtemp
# Default values if not defined: 45/52/60
careful=45
warning=52
critical=60
temperature_hdd_careful=45
temperature_hdd_warning=52
temperature_hdd_critical=60
# Batterie % limits
batterie_careful=80
batterie_warning=90
batterie_critical=95
[processlist]
# Limit values for CPU/MEM per process in %

View File

@ -63,19 +63,21 @@ careful=50
warning=70
critical=90
[temperature]
# Temperatures in °C for sensors
[sensors]
# Sensors core limits
# Default values if not defined: 60/70/80
careful=60
warning=70
critical=80
[hddtemperature]
temperature_core_careful=60
temperature_core_warning=70
temperature_core_critical=80
# Temperatures in °C for hddtemp
# Default values if not defined: 45/52/60
careful=45
warning=52
critical=60
temperature_hdd_careful=45
temperature_hdd_warning=52
temperature_hdd_critical=60
# Batterie % limits
batterie_careful=80
batterie_warning=90
batterie_critical=95
[processlist]
# Limit values for CPU/MEM per process in %

View File

@ -80,12 +80,12 @@ class Plugin(GlancesPlugin):
if self.get_input() == 'local':
# Update stats using the standard system lib
self.stats = self.glancesgrabsensors.get()
self.stats = self.__set_type(self.glancesgrabsensors.get(), 'temperature_core')
# Append HDD temperature
hddtemp = self.hddtemp_plugin.update()
hddtemp = self.__set_type(self.hddtemp_plugin.update(), 'temperature_hdd')
self.stats.extend(hddtemp)
# Append Batteries %
batpercent = self.batpercent_plugin.update()
batpercent = self.__set_type(self.batpercent_plugin.update(), 'batterie')
self.stats.extend(batpercent)
elif self.get_input() == 'snmp':
# Update stats using SNMP
@ -94,6 +94,17 @@ class Plugin(GlancesPlugin):
return self.stats
def __set_type(self, stats, sensor_type):
"""
3 types of stats is possible in the Sensors plugins:
- Core temperature
- HDD temperature
- Batterie capacity
"""
for i in stats:
i.update({ 'type': sensor_type })
return stats
def msg_curse(self, args=None):
"""
Return the dict to display in the curse interface
@ -121,7 +132,10 @@ class Plugin(GlancesPlugin):
msg = "{0:18}".format(item['label'][:18])
ret.append(self.curse_add_line(msg))
msg = "{0:>5}".format(item['value'])
ret.append(self.curse_add_line(msg))
if item['type'] == 'batterie':
ret.append(self.curse_add_line(msg, self.get_alert(100 - item['value'], header=item['type'])))
else:
ret.append(self.curse_add_line(msg, self.get_alert(item['value'], header=item['type'])))
return ret