mirror of https://github.com/nicolargo/glances
batterie -> battery
Remove unused variables No whitespace inside parentheses Add missing whitespace around arithmetic operator Fix indentation Remove trailing whitespacespull/353/merge
parent
21b5a27ed6
commit
950b12cfcf
|
@ -81,10 +81,10 @@ temperature_core_critical=80
|
||||||
temperature_hdd_careful=45
|
temperature_hdd_careful=45
|
||||||
temperature_hdd_warning=52
|
temperature_hdd_warning=52
|
||||||
temperature_hdd_critical=60
|
temperature_hdd_critical=60
|
||||||
# Batterie % limits
|
# Battery % limits
|
||||||
batterie_careful=80
|
battery_careful=80
|
||||||
batterie_warning=90
|
battery_warning=90
|
||||||
batterie_critical=95
|
battery_critical=95
|
||||||
|
|
||||||
[processlist]
|
[processlist]
|
||||||
# Limit values for CPU/MEM per process in %
|
# Limit values for CPU/MEM per process in %
|
||||||
|
|
|
@ -81,10 +81,10 @@ temperature_core_critical=80
|
||||||
temperature_hdd_careful=45
|
temperature_hdd_careful=45
|
||||||
temperature_hdd_warning=52
|
temperature_hdd_warning=52
|
||||||
temperature_hdd_critical=60
|
temperature_hdd_critical=60
|
||||||
# Batterie % limits
|
# Battery % limits
|
||||||
batterie_careful=80
|
battery_careful=80
|
||||||
batterie_warning=90
|
battery_warning=90
|
||||||
batterie_critical=95
|
battery_critical=95
|
||||||
|
|
||||||
[processlist]
|
[processlist]
|
||||||
# Limit values for CPU/MEM per process in %
|
# Limit values for CPU/MEM per process in %
|
||||||
|
|
|
@ -17,9 +17,9 @@
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import time
|
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
|
import time
|
||||||
|
|
||||||
import msvcrt
|
import msvcrt
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -32,7 +32,7 @@ from glances.plugins.glances_plugin import GlancesPlugin
|
||||||
|
|
||||||
class Plugin(GlancesPlugin):
|
class Plugin(GlancesPlugin):
|
||||||
"""
|
"""
|
||||||
Glances's batterie capacity Plugin
|
Glances battery capacity plugin
|
||||||
|
|
||||||
stats is a list
|
stats is a list
|
||||||
"""
|
"""
|
||||||
|
@ -59,7 +59,7 @@ class Plugin(GlancesPlugin):
|
||||||
def update(self):
|
def update(self):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Update batterie capacity stats using the input method
|
Update battery capacity stats using the input method
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Reset stats
|
# Reset stats
|
||||||
|
@ -77,9 +77,10 @@ class Plugin(GlancesPlugin):
|
||||||
|
|
||||||
return self.stats
|
return self.stats
|
||||||
|
|
||||||
|
|
||||||
class glancesGrabBat:
|
class glancesGrabBat:
|
||||||
"""
|
"""
|
||||||
Get batteries stats using the Batinfo librairie
|
Get batteries stats using the Batinfo library
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -91,11 +92,10 @@ class glancesGrabBat:
|
||||||
self.initok = True
|
self.initok = True
|
||||||
self.bat_list = []
|
self.bat_list = []
|
||||||
self.update()
|
self.update()
|
||||||
except Exception as e:
|
except Exception:
|
||||||
# print(_("Warning: Can not grab batterie sensor. Missing BatInfo lib (%s).") % e)
|
# print(_("Warning: Cannot grab battery sensor. Missing BatInfo library."))
|
||||||
self.initok = False
|
self.initok = False
|
||||||
|
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""
|
"""
|
||||||
Update the stats
|
Update the stats
|
||||||
|
@ -103,13 +103,13 @@ class glancesGrabBat:
|
||||||
if self.initok:
|
if self.initok:
|
||||||
try:
|
try:
|
||||||
self.bat.update()
|
self.bat.update()
|
||||||
except Exception as e:
|
except Exception:
|
||||||
self.bat_list = []
|
self.bat_list = []
|
||||||
else:
|
else:
|
||||||
self.bat_list = []
|
self.bat_list = []
|
||||||
new_item = { 'label': _("Batterie (%)"),
|
new_item = {'label': _("Battery (%)"),
|
||||||
'value': self.getcapacitypercent() }
|
'value': self.getcapacitypercent()}
|
||||||
self.bat_list.append(new_item)
|
self.bat_list.append(new_item)
|
||||||
else:
|
else:
|
||||||
self.bat_list = []
|
self.bat_list = []
|
||||||
|
|
||||||
|
|
|
@ -228,7 +228,7 @@ class Plugin(GlancesPlugin):
|
||||||
sx = self.auto_unit(int(i['rx'] // i['time_since_update'])
|
sx = self.auto_unit(int(i['rx'] // i['time_since_update'])
|
||||||
+ int(i['tx'] // i['time_since_update']))
|
+ int(i['tx'] // i['time_since_update']))
|
||||||
else:
|
else:
|
||||||
# Bits per second (for real network administrator | Default)
|
# Bits per second (for real network administrator | Default)
|
||||||
if args.network_cumul:
|
if args.network_cumul:
|
||||||
rx = self.auto_unit(int(i['cumulative_rx'] * 8)) + "b"
|
rx = self.auto_unit(int(i['cumulative_rx'] * 8)) + "b"
|
||||||
tx = self.auto_unit(int(i['cumulative_tx'] * 8)) + "b"
|
tx = self.auto_unit(int(i['cumulative_tx'] * 8)) + "b"
|
||||||
|
@ -248,12 +248,12 @@ class Plugin(GlancesPlugin):
|
||||||
ret.append(self.curse_add_line(msg))
|
ret.append(self.curse_add_line(msg))
|
||||||
else:
|
else:
|
||||||
msg = "{0:>7}".format(rx)
|
msg = "{0:>7}".format(rx)
|
||||||
ret.append(self.curse_add_line(msg,
|
ret.append(self.curse_add_line(
|
||||||
self.get_alert(int(i['rx'] // i['time_since_update'] * 8),
|
msg, self.get_alert(int(i['rx'] // i['time_since_update'] * 8),
|
||||||
header=ifname+'_rx')))
|
header=ifname + '_rx')))
|
||||||
msg = "{0:>7}".format(tx)
|
msg = "{0:>7}".format(tx)
|
||||||
ret.append(self.curse_add_line(msg,
|
ret.append(self.curse_add_line(
|
||||||
self.get_alert(int(i['tx'] // i['time_since_update'] * 8),
|
msg, self.get_alert(int(i['tx'] // i['time_since_update'] * 8),
|
||||||
header=ifname+'_tx')))
|
header=ifname + '_tx')))
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
|
@ -26,9 +26,9 @@ except ImportError:
|
||||||
|
|
||||||
# Import Glances lib
|
# Import Glances lib
|
||||||
from glances.core.glances_globals import is_py3
|
from glances.core.glances_globals import is_py3
|
||||||
from glances.plugins.glances_plugin import GlancesPlugin
|
|
||||||
from glances.plugins.glances_hddtemp import Plugin as HddTempPlugin
|
|
||||||
from glances.plugins.glances_batpercent import Plugin as BatPercentPlugin
|
from glances.plugins.glances_batpercent import Plugin as BatPercentPlugin
|
||||||
|
from glances.plugins.glances_hddtemp import Plugin as HddTempPlugin
|
||||||
|
from glances.plugins.glances_plugin import GlancesPlugin
|
||||||
|
|
||||||
|
|
||||||
class Plugin(GlancesPlugin):
|
class Plugin(GlancesPlugin):
|
||||||
|
@ -85,8 +85,8 @@ class Plugin(GlancesPlugin):
|
||||||
hddtemp = self.__set_type(self.hddtemp_plugin.update(), 'temperature_hdd')
|
hddtemp = self.__set_type(self.hddtemp_plugin.update(), 'temperature_hdd')
|
||||||
self.stats.extend(hddtemp)
|
self.stats.extend(hddtemp)
|
||||||
# Append Batteries %
|
# Append Batteries %
|
||||||
batpercent = self.__set_type(self.batpercent_plugin.update(), 'batterie')
|
batpercent = self.__set_type(self.batpercent_plugin.update(), 'battery')
|
||||||
self.stats.extend(batpercent)
|
self.stats.extend(batpercent)
|
||||||
elif self.get_input() == 'snmp':
|
elif self.get_input() == 'snmp':
|
||||||
# Update stats using SNMP
|
# Update stats using SNMP
|
||||||
# No standard: http://www.net-snmp.org/wiki/index.php/Net-SNMP_and_lm-sensors_on_Ubuntu_10.04
|
# No standard: http://www.net-snmp.org/wiki/index.php/Net-SNMP_and_lm-sensors_on_Ubuntu_10.04
|
||||||
|
@ -99,10 +99,10 @@ class Plugin(GlancesPlugin):
|
||||||
3 types of stats is possible in the Sensors plugins:
|
3 types of stats is possible in the Sensors plugins:
|
||||||
- Core temperature
|
- Core temperature
|
||||||
- HDD temperature
|
- HDD temperature
|
||||||
- Batterie capacity
|
- Battery capacity
|
||||||
"""
|
"""
|
||||||
for i in stats:
|
for i in stats:
|
||||||
i.update({ 'type': sensor_type })
|
i.update({'type': sensor_type})
|
||||||
return stats
|
return stats
|
||||||
|
|
||||||
def msg_curse(self, args=None):
|
def msg_curse(self, args=None):
|
||||||
|
@ -132,7 +132,7 @@ class Plugin(GlancesPlugin):
|
||||||
msg = "{0:18}".format(item['label'][:18])
|
msg = "{0:18}".format(item['label'][:18])
|
||||||
ret.append(self.curse_add_line(msg))
|
ret.append(self.curse_add_line(msg))
|
||||||
msg = "{0:>5}".format(item['value'])
|
msg = "{0:>5}".format(item['value'])
|
||||||
if item['type'] == 'batterie':
|
if item['type'] == 'battery':
|
||||||
ret.append(self.curse_add_line(msg, self.get_alert(100 - item['value'], header=item['type'])))
|
ret.append(self.curse_add_line(msg, self.get_alert(100 - item['value'], header=item['type'])))
|
||||||
else:
|
else:
|
||||||
ret.append(self.curse_add_line(msg, self.get_alert(item['value'], header=item['type'])))
|
ret.append(self.curse_add_line(msg, self.get_alert(item['value'], header=item['type'])))
|
||||||
|
|
Loading…
Reference in New Issue