mirror of https://github.com/nicolargo/glances.git
parent
ab2936bcc8
commit
56a7622d14
9
NEWS.rst
9
NEWS.rst
|
|
@ -10,7 +10,14 @@ Under development: https://github.com/nicolargo/glances/issues?q=is%3Aopen+is%3A
|
|||
|
||||
**BREAKING CHANGES:**
|
||||
|
||||
* The Glances API version 3 is replaced by the version 4. So Restfull API URL is now /api/4/.
|
||||
* The Glances API version 3 is replaced by the version 4. So Restfull API URL is now /api/4/ #2610
|
||||
* Alias definition change in the configuration file #1735
|
||||
Glances version 3.x and lower:
|
||||
sda1_alias=InternalDisk
|
||||
sdb1_alias=ExternalDisk
|
||||
Glances version 4.x and higher:
|
||||
alias=sda1:InternalDisk,sdb1:ExternalDisk
|
||||
* Alias can now be used to redefine FS name #1735
|
||||
|
||||
===============
|
||||
Version 3.4.0.3
|
||||
|
|
|
|||
|
|
@ -167,8 +167,6 @@ tx_critical=90
|
|||
#hide=docker.*,lo
|
||||
# Define the list of wireless network interfaces to be show (comma-separated)
|
||||
#show=docker.*
|
||||
# WLAN 0 alias
|
||||
#wlan0_alias=Wireless
|
||||
# It is possible to overwrite the bitrate thresholds per interface
|
||||
# WLAN 0 Default limits (in bits per second aka bps) for interface bitrate
|
||||
#wlan0_rx_careful=4000000
|
||||
|
|
@ -179,6 +177,8 @@ tx_critical=90
|
|||
#wlan0_tx_warning=900000
|
||||
#wlan0_tx_critical=1000000
|
||||
#wlan0_tx_log=True
|
||||
# Alias for network interface name
|
||||
alias=wlp2s0:WIFI
|
||||
|
||||
[ip]
|
||||
disable=False
|
||||
|
|
@ -218,8 +218,8 @@ disable=False
|
|||
hide=loop.*,/dev/loop.*
|
||||
# Define the list of disks to be show (comma-separated)
|
||||
#show=sda.*
|
||||
# Alias for sda1
|
||||
#sda1_alias=InternalDisk
|
||||
# Alias for sda1 and sdb1
|
||||
alias=sda1:InternalDisk,sdb1:ExternalDisk
|
||||
|
||||
[fs]
|
||||
disable=False
|
||||
|
|
@ -236,6 +236,8 @@ warning=70
|
|||
critical=90
|
||||
# Allow additional file system types (comma-separated FS type)
|
||||
#allow=shm
|
||||
# Alias for root file system
|
||||
alias=/:Root
|
||||
|
||||
[irq]
|
||||
# Documentation: https://glances.readthedocs.io/en/latest/aoa/irq.html
|
||||
|
|
@ -307,13 +309,7 @@ battery_careful=80
|
|||
battery_warning=90
|
||||
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
|
||||
#alias=core 0:CPU Core 0,core 1:CPU Core 1
|
||||
|
||||
[processcount]
|
||||
disable=False
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
</div>
|
||||
<div class="table-row" v-for="(fs, fsId) in fileSystems" :key="fsId">
|
||||
<div class="table-cell text-left">
|
||||
{{ fs.shortMountPoint }}
|
||||
<span v-if="fs.shortMountPoint.length <= 12" class="visible-lg-inline">
|
||||
{{ $filters.minSize(fs.alias ? fs.alias : fs.mountPoint, 36) }}
|
||||
<span v-if="(fs.alias ? fs.alias : fs.mountPoint).length + fs.name.length <= 34" class="visible-lg-inline">
|
||||
({{ fs.name }})
|
||||
</span>
|
||||
</div>
|
||||
|
|
@ -55,18 +55,14 @@ export default {
|
|||
},
|
||||
fileSystems() {
|
||||
const fileSystems = this.stats.map((fsData) => {
|
||||
let shortMountPoint = fsData['mnt_point'];
|
||||
if (shortMountPoint.length > 22) {
|
||||
shortMountPoint = '_' + fsData['mnt_point'].slice(-21);
|
||||
}
|
||||
return {
|
||||
name: fsData['device_name'],
|
||||
mountPoint: fsData['mnt_point'],
|
||||
shortMountPoint: shortMountPoint,
|
||||
percent: fsData['percent'],
|
||||
size: fsData['size'],
|
||||
used: fsData['used'],
|
||||
free: fsData['free']
|
||||
free: fsData['free'],
|
||||
alias: fsData['alias'] !== undefined ? fsData['alias'] : null
|
||||
};
|
||||
});
|
||||
return orderBy(fileSystems, ['mnt_point']);
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -10,6 +10,7 @@
|
|||
"""Disk I/O plugin."""
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from glances.logger import logger
|
||||
from glances.globals import nativestr
|
||||
from glances.timer import getTimeSinceLastUpdate
|
||||
from glances.plugins.plugin.model import GlancesPluginModel
|
||||
|
|
@ -186,12 +187,12 @@ class PluginModel(GlancesPluginModel):
|
|||
if all([self.get_views(item=i[self.get_key()], key=f, option='hidden') for f in self.hide_zero_fields]):
|
||||
continue
|
||||
# Is there an alias for the disk name ?
|
||||
disk_name = self.has_alias(i['disk_name']) if self.has_alias(i['disk_name']) else i['disk_name']
|
||||
disk_name = i['alias'] if 'alias' in i else i['disk_name']
|
||||
# New line
|
||||
ret.append(self.curse_new_line())
|
||||
if len(disk_name) > name_max_width:
|
||||
# Cut disk name if it is too long
|
||||
disk_name = '_' + disk_name[-name_max_width + 1 :]
|
||||
disk_name = disk_name[:name_max_width] + '_'
|
||||
msg = '{:{width}}'.format(nativestr(disk_name), width=name_max_width + 1)
|
||||
ret.append(self.curse_add_line(msg))
|
||||
if args.diskio_iops:
|
||||
|
|
|
|||
|
|
@ -147,6 +147,10 @@ class PluginModel(GlancesPluginModel):
|
|||
if not self.is_display(fs_current['device_name']):
|
||||
continue
|
||||
|
||||
# Add alias if exist (define in the configuration file)
|
||||
if self.has_alias(fs_current['mnt_point']) is not None:
|
||||
fs_current['alias'] = self.has_alias(fs_current['mnt_point'])
|
||||
|
||||
stats.append(fs_current)
|
||||
|
||||
elif self.input_method == 'snmp':
|
||||
|
|
@ -225,16 +229,16 @@ class PluginModel(GlancesPluginModel):
|
|||
return ret
|
||||
|
||||
# Max size for the interface name
|
||||
name_max_width = max_width - 12
|
||||
name_max_width = max_width - 13
|
||||
|
||||
# Build the string message
|
||||
# Header
|
||||
msg = '{:{width}}'.format('FILE SYS', width=name_max_width)
|
||||
ret.append(self.curse_add_line(msg, "TITLE"))
|
||||
if args.fs_free_space:
|
||||
msg = '{:>7}'.format('Free')
|
||||
msg = '{:>8}'.format('Free')
|
||||
else:
|
||||
msg = '{:>7}'.format('Used')
|
||||
msg = '{:>8}'.format('Used')
|
||||
ret.append(self.curse_add_line(msg))
|
||||
msg = '{:>7}'.format('Total')
|
||||
ret.append(self.curse_add_line(msg))
|
||||
|
|
@ -243,17 +247,13 @@ class PluginModel(GlancesPluginModel):
|
|||
for i in sorted(self.stats, key=operator.itemgetter(self.get_key())):
|
||||
# New line
|
||||
ret.append(self.curse_new_line())
|
||||
if i['device_name'] == '' or i['device_name'] == 'none':
|
||||
mnt_point = i['mnt_point'][-name_max_width + 1 :]
|
||||
elif len(i['mnt_point']) + len(i['device_name'].split('/')[-1]) <= name_max_width - 3:
|
||||
mnt_point = i['alias'] if 'alias' in i else i['mnt_point']
|
||||
if len(mnt_point) + len(i['device_name'].split('/')[-1]) <= name_max_width - 3:
|
||||
# If possible concatenate mode info... Glances touch inside :)
|
||||
mnt_point = i['mnt_point'] + ' (' + i['device_name'].split('/')[-1] + ')'
|
||||
elif len(i['mnt_point']) > name_max_width:
|
||||
# Cut mount point name if it is too long
|
||||
mnt_point = '_' + i['mnt_point'][-name_max_width + 1 :]
|
||||
else:
|
||||
mnt_point = i['mnt_point']
|
||||
msg = '{:{width}}'.format(nativestr(mnt_point), width=name_max_width)
|
||||
elif len(mnt_point) > name_max_width:
|
||||
mnt_point = mnt_point[:name_max_width] + '_'
|
||||
msg = '{:{width}}'.format(nativestr(mnt_point), width=name_max_width + 1)
|
||||
ret.append(self.curse_add_line(msg))
|
||||
if args.fs_free_space:
|
||||
msg = '{:>7}'.format(self.auto_unit(i['free']))
|
||||
|
|
|
|||
|
|
@ -98,6 +98,9 @@ class GlancesPluginModel(object):
|
|||
logger.debug('Load section {} in {}'.format(self.plugin_name, config.config_file_paths()))
|
||||
self.load_limits(config=config)
|
||||
|
||||
# Init the alias (dictionnary)
|
||||
self.alias = self.read_alias()
|
||||
|
||||
# Init the actions
|
||||
self.actions = GlancesActions(args=args)
|
||||
|
||||
|
|
@ -633,7 +636,7 @@ class GlancesPluginModel(object):
|
|||
return self.stats
|
||||
|
||||
def get_stat_name(self, header=""):
|
||||
""" "Return the stat name with an optional header"""
|
||||
"""Return the stat name with an optional header"""
|
||||
ret = self.plugin_name
|
||||
if header != "":
|
||||
ret += '_' + header
|
||||
|
|
@ -875,14 +878,15 @@ class GlancesPluginModel(object):
|
|||
else:
|
||||
return not self.is_hide(value, header=header)
|
||||
|
||||
def read_alias(self):
|
||||
if self.plugin_name + '_' + 'alias' in self._limits:
|
||||
return {i.split(':')[0]: i.split(':')[1] for i in self._limits[self.plugin_name + '_' + 'alias'][0].split(',')}
|
||||
else:
|
||||
return dict()
|
||||
|
||||
def has_alias(self, header):
|
||||
"""Return the alias name for the relative header it it exists otherwise None."""
|
||||
try:
|
||||
# Force to lower case (issue #1126)
|
||||
return self._limits[self.plugin_name + '_' + header.lower() + '_' + 'alias'][0]
|
||||
except (KeyError, IndexError):
|
||||
# logger.debug("No alias found for {}".format(header))
|
||||
return None
|
||||
return self.alias.get(header, None)
|
||||
|
||||
def msg_curse(self, args=None, max_width=None):
|
||||
"""Return default string to display in the curse interface."""
|
||||
|
|
|
|||
Loading…
Reference in New Issue