Merge branch 'develop' into glancesv4

This commit is contained in:
nicolargo 2022-09-09 18:23:43 +02:00
commit 0a39988a5a
9 changed files with 1445 additions and 1395 deletions

View File

@ -18,7 +18,7 @@ venv-dev: venv-python ## Install Python 3 dev dependencies
./venv/bin/pip install -r dev-requirements.txt
./venv/bin/pip install -r doc-requirements.txt
venv-dev-upgrade: venv-dev ## Upgrade Python 3 dev dependencies
venv-dev-upgrade: ## Upgrade Python 3 dev dependencies
./venv/bin/pip install --upgrade pip
./venv/bin/pip install --upgrade -r dev-requirements.txt
./venv/bin/pip install --upgrade -r doc-requirements.txt
@ -27,8 +27,7 @@ venv: venv-python ## Install Python 3 run-time dependencies
./venv/bin/pip install -r requirements.txt
./venv/bin/pip install -r optional-requirements.txt
venv-upgrade: venv ## Upgrade Python 3 run-time dependencies
./venv/bin/pip install --upgrade -r dev-requirements.txt
venv-upgrade: ## Upgrade Python 3 run-time dependencies
./venv/bin/pip install --upgrade -r requirements.txt
./venv/bin/pip install --upgrade -r optional-requirements.txt
@ -36,7 +35,14 @@ venv-upgrade: venv ## Upgrade Python 3 run-time dependencies
# Tests
# ===================================================================
test: venv-upgrade venv-dev-upgrade ## Run unit tests
test: ## Run unit tests
./venv/bin/python ./unitest.py
./venv/bin/python ./unitest-restful.py
./venv/bin/python ./unitest-xmlrpc.py
./venv/bin/python -m black ./glances --check --exclude outputs/static
./venv/bin/pyright glances
test-with-upgrade: venv-upgrade venv-dev-upgrade ## Run unit tests
./venv/bin/python ./unitest.py
./venv/bin/python ./unitest-restful.py
./venv/bin/python ./unitest-xmlrpc.py

View File

@ -301,8 +301,10 @@ battery_critical=95
# Sensors alias
#temp1_alias=Motherboard 0
#temp2_alias=Motherboard 1
#core 0_temperature_core_alias=CPU Core 0 temp
#core 0_fans_speed_alias=CPU Core 0 fan
#or
#core 0_alias=CPU Core 0
#core 1_alias=CPU Core 1
[processcount]
disable=False

View File

@ -23,3 +23,9 @@ There is no alert on this information.
The support for multiple batteries is only available if
you have the batinfo Python lib installed on your system
because for the moment PSUtil only support one battery.
.. note 3::
If a sensors has temperature and fan speed with the same name unit,
it is possible to alias it using:
unitname_temperature_core_alias=Alias for temp
unitname_fan_speed_alias=Alias for fan speed

View File

@ -20,10 +20,6 @@ body {
text-align: right;
}
.row {
margin-right: 0px;
}
.top-plugin {
margin-bottom: 20px;
}

View File

@ -18,11 +18,11 @@
<glances-plugin-uptime :data="data"></glances-plugin-uptime>
</div>
</div>
<div class="row">
<div class="col-sm-24">
<div class="pull-left">
<glances-plugin-cloud :data="data"></glances-plugin-cloud>
</div>
</div>
<div class="row">
<div class="col-sm-24">
<div class="pull-left">
<glances-plugin-cloud :data="data"></glances-plugin-cloud>
</div>
</div>
</div>
@ -43,9 +43,10 @@
<div class="col-sm-6 col-md-4 col-lg-3" v-if="!args.disable_mem">
<glances-plugin-mem :data="data"></glances-plugin-mem>
</div>
<!-- NOTE: display if MEM enabled and GPU disabled -->
<div
class="col-sm-6 col-md-4 col-lg-3"
v-if="!args.disable_mem && !(!args.disable_gpu && hasGpu)"
class="hidden-xs hidden-sm col-md-4 col-lg-3"
>
<glances-plugin-mem-more :data="data"></glances-plugin-mem-more>
</div>

View File

@ -8,7 +8,7 @@
<div class="table-row" v-for="(folder, folderId) in folders" :key="folderId">
<div class="table-cell text-left">{{ folder.path }}</div>
<div class="table-cell"></div>
<div class="table-cell" :class="vm.getDecoration(folder)">
<div class="table-cell" :class="getDecoration(folder)">
{{ $filters.bytes(folder.size) }}
</div>
</div>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -20,7 +20,10 @@ from glances.plugins.sensors.sensor.glances_hddtemp import PluginModel as HddTem
from glances.outputs.glances_unicode import unicode_message
from glances.plugins.plugin.model import GlancesPluginModel
SENSOR_TEMP_TYPE = 'temperature_core'
SENSOR_TEMP_UNIT = 'C'
SENSOR_FAN_TYPE = 'fan_speed'
SENSOR_FAN_UNIT = 'R'
@ -79,7 +82,7 @@ class PluginModel(GlancesPluginModel):
stats = []
# Get the temperature
try:
temperature = self.__set_type(self.glances_grab_sensors.get('temperature_core'), 'temperature_core')
temperature = self.__set_type(self.glances_grab_sensors.get(SENSOR_TEMP_TYPE), SENSOR_TEMP_TYPE)
except Exception as e:
logger.error("Cannot grab sensors temperatures (%s)" % e)
else:
@ -87,7 +90,7 @@ class PluginModel(GlancesPluginModel):
stats.extend(temperature)
# Get the FAN speed
try:
fan_speed = self.__set_type(self.glances_grab_sensors.get('fan_speed'), 'fan_speed')
fan_speed = self.__set_type(self.glances_grab_sensors.get(SENSOR_FAN_TYPE), SENSOR_FAN_TYPE)
except Exception as e:
logger.error("Cannot grab FAN speed (%s)" % e)
else:
@ -123,20 +126,31 @@ class PluginModel(GlancesPluginModel):
if not self.is_display(stat["label"].lower()):
continue
# Set the alias for each stat
alias = self.has_alias(stat["label"].lower())
if alias:
stat["label"] = alias
# alias = self.has_alias(stat["label"].lower())
# if alias:
# stat["label"] = alias
stat["label"] = self.__get_alias(stat)
# Update the stats
self.stats.append(stat)
return self.stats
def __get_alias(self, stats):
"""Return the alias of the sensor."""
# Get the alias for each stat
if self.has_alias(stats["label"].lower()):
return self.has_alias(stats["label"].lower())
elif self.has_alias("{}_{}".format(stats["label"], stats["type"]).lower()):
return self.has_alias("{}_{}".format(stats["label"], stats["type"]).lower())
else:
return stats["label"]
def __set_type(self, stats, sensor_type):
"""Set the plugin type.
4 types of stats is possible in the sensors plugin:
- Core temperature: 'temperature_core'
- Fan speed: 'fan_speed'
- Core temperature: SENSOR_TEMP_TYPE
- Fan speed: SENSOR_FAN_TYPE
- HDD temperature: 'temperature_hdd'
- Battery capacity: 'battery'
"""
@ -159,7 +173,7 @@ class PluginModel(GlancesPluginModel):
if not i['value']:
continue
# Alert processing
if i['type'] == 'temperature_core':
if i['type'] == SENSOR_TEMP_TYPE:
if self.is_limit('critical', stat_name='sensors_temperature_' + i['label']):
# By default use the thresholds confiured in the glances.conf file (see #2058)
alert = self.get_alert(current=i['value'], header='temperature_' + i['label'])
@ -225,7 +239,7 @@ class PluginModel(GlancesPluginModel):
self.curse_add_line(msg, self.get_views(item=i[self.get_key()], key='value', option='decoration'))
)
else:
if args.fahrenheit and i['type'] != 'battery' and i['type'] != 'fan_speed':
if args.fahrenheit and i['type'] != 'battery' and i['type'] != SENSOR_FAN_TYPE:
trend = ''
value = to_fahrenheit(i['value'])
unit = 'F'
@ -337,12 +351,12 @@ class GlancesGrabSensors(object):
i += 1
return ret
def get(self, sensor_type='temperature_core'):
def get(self, sensor_type=SENSOR_TEMP_TYPE):
"""Get sensors list."""
self.__update__()
if sensor_type == 'temperature_core':
if sensor_type == SENSOR_TEMP_TYPE:
ret = [s for s in self.sensors_list if s['unit'] == SENSOR_TEMP_UNIT]
elif sensor_type == 'fan_speed':
elif sensor_type == SENSOR_FAN_TYPE:
ret = [s for s in self.sensors_list if s['unit'] == SENSOR_FAN_UNIT]
else:
# Unknown type