mirror of
https://github.com/nicolargo/glances.git
synced 2024-11-28 14:12:21 +03:00
Merge develop conflict
This commit is contained in:
commit
f68915265a
@ -573,8 +573,9 @@ countmax=20
|
||||
|
||||
[amp_conntrack]
|
||||
# Use comma separated for multiple commands (no space around the comma)
|
||||
# If the regex key is not defined, the AMP will be executed every refresh second
|
||||
# and the process count will not be displayed (countmin and countmax will be ignore)
|
||||
enable=false
|
||||
regex=\/sbin\/init
|
||||
refresh=30
|
||||
one_line=false
|
||||
command=sysctl net.netfilter.nf_conntrack_count;sysctl net.netfilter.nf_conntrack_max
|
||||
|
@ -49,6 +49,20 @@ less than countmin):
|
||||
|
||||
.. image:: ../_static/amp-python-warning.png
|
||||
|
||||
If the regex option is not defined, the AMP will be executed every refresh
|
||||
time and the process count will not be displayed (countmin and countmax will
|
||||
be ignored).
|
||||
|
||||
For example:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
[amp_conntrack]
|
||||
enable=false
|
||||
refresh=30
|
||||
one_line=false
|
||||
command=sysctl net.netfilter.nf_conntrack_count;sysctl net.netfilter.nf_conntrack_max
|
||||
|
||||
User defined AMP
|
||||
----------------
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.TH "GLANCES" "1" "Jul 20, 2020" "3.1.5_DEVELOP" "Glances"
|
||||
.TH "GLANCES" "1" "Jul 21, 2020" "3.1.5_DEVELOP" "Glances"
|
||||
.SH NAME
|
||||
glances \- An eye on your system
|
||||
.
|
||||
|
@ -99,12 +99,11 @@ class GlancesAmp(object):
|
||||
logger.debug("AMP - {}: Can not find section {} in the configuration file".format(self.NAME, self.amp_name))
|
||||
return False
|
||||
|
||||
# enable, regex and refresh are mandatories
|
||||
# if not configured then AMP is disabled
|
||||
if self.enable():
|
||||
for k in ['regex', 'refresh']:
|
||||
# Refresh option is mandatory
|
||||
for k in ['refresh']:
|
||||
if k not in self.configs:
|
||||
logger.warning("AMP - {}: Can not find configuration key {} in section {}".format(self.NAME, k, self.amp_name))
|
||||
logger.warning("AMP - {}: Can not find configuration key {} in section {} (the AMP will be disabled)".format(self.NAME, k, self.amp_name))
|
||||
self.configs['enable'] = 'false'
|
||||
else:
|
||||
logger.debug("AMP - {} is disabled".format(self.NAME))
|
||||
|
@ -2,7 +2,7 @@
|
||||
#
|
||||
# This file is part of Glances.
|
||||
#
|
||||
# Copyright (C) 2019 Nicolargo <nicolas@nicolargo.com>
|
||||
# Copyright (C) 2020 Nicolargo <nicolas@nicolargo.com>
|
||||
#
|
||||
# Glances is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published by
|
||||
@ -112,6 +112,14 @@ class AmpsList(object):
|
||||
if not v.enable():
|
||||
# Do not update if the enable tag is set
|
||||
continue
|
||||
|
||||
if v.regex() is None:
|
||||
# If there is no regex, execute anyway (see issue #1690)
|
||||
v.set_count(0)
|
||||
# Call the AMP update method
|
||||
thread = threading.Thread(target=v.update_wrapper, args=[[]])
|
||||
thread.start()
|
||||
continue
|
||||
|
||||
amps_list = self._build_amps_list(v, processlist)
|
||||
|
||||
@ -145,6 +153,9 @@ class AmpsList(object):
|
||||
if (re.search(amp_value.regex(), p['name']) is not None):
|
||||
add_it = True
|
||||
else:
|
||||
if p['cmdline'] is None:
|
||||
# See issue #1689 (thanks to @darylkell)
|
||||
continue
|
||||
for c in p['cmdline']:
|
||||
if (re.search(amp_value.regex(), c) is not None):
|
||||
add_it = True
|
||||
|
@ -209,10 +209,23 @@ class GlancesAutoDiscoverClient(object):
|
||||
address_family = socket.getaddrinfo(zeroconf_bind_address, args.port)[0][0]
|
||||
|
||||
# Start the zeroconf service
|
||||
self.info = ServiceInfo(
|
||||
zeroconf_type, '{}:{}.{}'.format(hostname, args.port, zeroconf_type),
|
||||
address=socket.inet_pton(address_family, zeroconf_bind_address),
|
||||
port=args.port, weight=0, priority=0, properties={}, server=hostname)
|
||||
try:
|
||||
self.info = ServiceInfo(
|
||||
zeroconf_type, '{}:{}.{}'.format(
|
||||
hostname, args.port, zeroconf_type),
|
||||
address=socket.inet_pton(
|
||||
address_family, zeroconf_bind_address),
|
||||
port=args.port, weight=0, priority=0, properties={}, server=hostname)
|
||||
except TypeError:
|
||||
# Manage issue 1663 with breaking change on ServiceInfo method
|
||||
# address (only one address) is replaced by addresses (list of addresses)
|
||||
self.info = ServiceInfo(
|
||||
zeroconf_type, '{}:{}.{}'.format(
|
||||
hostname, args.port, zeroconf_type),
|
||||
addresses=[socket.inet_pton(
|
||||
address_family, zeroconf_bind_address)],
|
||||
port=args.port, weight=0, priority=0, properties={}, server=hostname)
|
||||
|
||||
try:
|
||||
self.zeroconf.register_service(self.info)
|
||||
except socket.error as e:
|
||||
|
@ -961,12 +961,16 @@ class _GlancesCurses(object):
|
||||
y = display_y
|
||||
for m in plugin_stats['msgdict']:
|
||||
# New line
|
||||
if m['msg'].startswith('\n'):
|
||||
# Go to the next line
|
||||
y += 1
|
||||
# Return to the first column
|
||||
x = display_x
|
||||
continue
|
||||
try:
|
||||
if m['msg'].startswith('\n'):
|
||||
# Go to the next line
|
||||
y += 1
|
||||
# Return to the first column
|
||||
x = display_x
|
||||
continue
|
||||
except:
|
||||
# Avoid exception (see issue #1692)
|
||||
pass
|
||||
# Do not display outside the screen
|
||||
if x < 0:
|
||||
continue
|
||||
|
@ -19,6 +19,7 @@ export default function GlancesPluginDockerController($scope, GlancesStats) {
|
||||
'status': containerData.Status,
|
||||
'cpu': containerData.cpu.total,
|
||||
'memory': containerData.memory.usage != undefined ? containerData.memory.usage : '?',
|
||||
'rss': containerData.memory.rss != undefined ? containerData.memory.usage: '?',
|
||||
'ior': containerData.io.ior != undefined ? containerData.io.ior : '?',
|
||||
'iow': containerData.io.iow != undefined ? containerData.io.iow : '?',
|
||||
'io_time_since_update': containerData.io.time_since_update,
|
||||
|
@ -7,6 +7,7 @@
|
||||
<div class="table-cell">Status</div>
|
||||
<div class="table-cell">CPU%</div>
|
||||
<div class="table-cell">MEM</div>
|
||||
<div class="table-cell">RSS</div>
|
||||
<div class="table-cell">IOR/s</div>
|
||||
<div class="table-cell">IOW/s</div>
|
||||
<div class="table-cell">RX/s</div>
|
||||
@ -19,6 +20,7 @@
|
||||
</div>
|
||||
<div class="table-cell">{{ container.cpu | number:1 }}</div>
|
||||
<div class="table-cell">{{ container.memory | bytes }}</div>
|
||||
<div class="table-cell">{{ container.rss | bytes }}</div>
|
||||
<div class="table-cell">{{ container.ior / container.io_time_since_update | bits }}</div>
|
||||
<div class="table-cell">{{ container.iow / container.io_time_since_update | bits }}</div>
|
||||
<div class="table-cell">{{ container.rx / container.net_time_since_update | bits }}</div>
|
||||
|
@ -57,7 +57,9 @@ class Plugin(GlancesPlugin):
|
||||
'timer': v.time_until_refresh(),
|
||||
'count': v.count(),
|
||||
'countmin': v.count_min(),
|
||||
'countmax': v.count_max()})
|
||||
'countmax': v.count_max(),
|
||||
'regex': v.regex() is not None},
|
||||
)
|
||||
else:
|
||||
# Not available in SNMP mode
|
||||
pass
|
||||
@ -103,7 +105,7 @@ class Plugin(GlancesPlugin):
|
||||
# Display AMP
|
||||
first_column = '{}'.format(m['name'])
|
||||
first_column_style = self.get_alert(m['count'], m['countmin'], m['countmax'])
|
||||
second_column = '{}'.format(m['count'])
|
||||
second_column = '{}'.format(m['count'] if m['regex'] else '')
|
||||
for l in m['result'].split('\n'):
|
||||
# Display first column with the process name...
|
||||
msg = '{:<16} '.format(first_column)
|
||||
|
@ -319,9 +319,8 @@ class Plugin(GlancesPlugin):
|
||||
ret = {}
|
||||
# Read the stats
|
||||
try:
|
||||
# Do not exist anymore with Docker 1.11 (issue #848)
|
||||
# ret['rss'] = all_stats['memory_stats']['stats']['rss']
|
||||
# ret['cache'] = all_stats['memory_stats']['stats']['cache']
|
||||
ret['rss'] = all_stats['memory_stats']['stats']['rss']
|
||||
ret['cache'] = all_stats['memory_stats']['stats']['cache']
|
||||
ret['usage'] = all_stats['memory_stats']['usage']
|
||||
ret['limit'] = all_stats['memory_stats']['limit']
|
||||
ret['max_usage'] = all_stats['memory_stats']['max_usage']
|
||||
|
@ -761,7 +761,9 @@ class GlancesPlugin(object):
|
||||
hide=sda2,sda5,loop.*
|
||||
"""
|
||||
# TODO: possible optimisation: create a re.compile list
|
||||
return not all(j is None for j in [re.match(i, value.lower()) for i in self.get_conf_value('hide', header=header)])
|
||||
# Old version (see issue #1691)
|
||||
#return not all(j is None for j in [re.match(i, value.lower()) for i in self.get_conf_value('hide', header=header)])
|
||||
return any(j for j in [re.match(i, value) for i in self.get_conf_value('hide', header=header)])
|
||||
|
||||
def has_alias(self, header):
|
||||
"""Return the alias name for the relative header or None if nonexist."""
|
||||
|
@ -2,7 +2,7 @@
|
||||
#
|
||||
# This file is part of Glances.
|
||||
#
|
||||
# Copyright (C) 2019 Nicolargo <nicolas@nicolargo.com>
|
||||
# Copyright (C) 2020 Nicolargo <nicolas@nicolargo.com>
|
||||
#
|
||||
# Glances is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published by
|
||||
@ -14,8 +14,8 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# 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/>.
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
|
||||
"""Quicklook plugin."""
|
||||
|
||||
@ -92,7 +92,11 @@ class Plugin(GlancesPlugin):
|
||||
cpu_info = cpuinfo.get_cpu_info()
|
||||
# Check cpu_info (issue #881)
|
||||
if cpu_info is not None:
|
||||
stats['cpu_name'] = cpu_info.get('brand', 'CPU')
|
||||
# Use brand_raw if the key exist (issue #1685)
|
||||
if cpu_info.get('brand_raw') is not None:
|
||||
stats['cpu_name'] = cpu_info.get('brand_raw', 'CPU')
|
||||
else:
|
||||
stats['cpu_name'] = cpu_info.get('brand', 'CPU')
|
||||
if 'hz_actual_raw' in cpu_info:
|
||||
stats['cpu_hz_current'] = cpu_info['hz_actual_raw'][0]
|
||||
if 'hz_advertised_raw' in cpu_info:
|
||||
|
Loading…
Reference in New Issue
Block a user