summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--conf/glances.conf5
-rw-r--r--dev-requirements.txt1
-rw-r--r--docker-compose/Dockerfile2
-rw-r--r--docker-compose/docker-compose-with-traefik.yml29
-rw-r--r--docker-compose/docker-compose.yml4
-rw-r--r--glances/amps_list.py17
-rw-r--r--glances/password.py14
-rw-r--r--glances/plugins/glances_fs.py8
9 files changed, 65 insertions, 18 deletions
diff --git a/Makefile b/Makefile
index cfe95595..dc25c1b3 100644
--- a/Makefile
+++ b/Makefile
@@ -61,6 +61,9 @@ format: venv-dev-upgrade ## Format the code
flake8: venv-dev-upgrade ## Run flake8 linter.
@git ls-files '*.py' | xargs ./venv/bin/python -m flake8 --config=.flake8
+codespell: venv-dev-upgrade ## Run codespell to fix common misspellings in text files
+ ./venv/bin/codespell -S .git,./docs/_build,./Glances.egg-info,./venv,./glances/outputs,*.svg -L hart,bu,te,statics
+
profiling: ## How to start the profiling of the Glances software
@echo "Please complete and run: sudo ./venv/bin/py-spy record -o ./docs/_static/glances-flame.svg -d 60 -s --pid <GLANCES PID>"
diff --git a/conf/glances.conf b/conf/glances.conf
index 86c2b92a..986b523a 100644
--- a/conf/glances.conf
+++ b/conf/glances.conf
@@ -432,13 +432,16 @@ disable=False
#server_4_port=61237
[passwords]
-# Define the passwords list
+# Define the passwords list related to the [serverlist] section
# Syntax: host=password
# Where: host is the hostname
# password is the clear password
# Additionally (and optionally) a default password could be defined
#localhost=abc
#default=defaultpassword
+#
+# Define the path of the local '.pwd' file (default is system one)
+#local_password_path=~/.config/glances
##############################################################################
# Exports
diff --git a/dev-requirements.txt b/dev-requirements.txt
index db1cbe5b..30fbb37a 100644
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -5,3 +5,4 @@ requirements-parser
flake8
autopep8
autoflake
+codespell
diff --git a/docker-compose/Dockerfile b/docker-compose/Dockerfile
index 6d434159..9d2426a1 100644
--- a/docker-compose/Dockerfile
+++ b/docker-compose/Dockerfile
@@ -1,3 +1,3 @@
-FROM nicolargo/glances:dev
+FROM nicolargo/glances:alpine-dev
COPY glances.conf /glances/conf/glances.conf
CMD python -m glances -C /glances/conf/glances.conf $GLANCES_OPT
diff --git a/docker-compose/docker-compose-with-traefik.yml b/docker-compose/docker-compose-with-traefik.yml
new file mode 100644
index 00000000..91a1d551
--- /dev/null
+++ b/docker-compose/docker-compose-with-traefik.yml
@@ -0,0 +1,29 @@
+version: "3.9"
+services:
+ reverse-proxy:
+ image: traefik
+ command: --api --docker
+ ports:
+ - "80:80"
+ - "8080:8080"
+ volumes:
+ - /var/run/docker.sock:/var/run/docker.sock
+
+ whoami:
+ image: emilevauge/whoami
+ labels:
+ - "traefik.frontend.rule=Host:whoami.docker.localhost"
+
+ monitoring:
+ image: nicolargo/glances:alpine-dev
+ restart: unless-stopped
+ pid: host
+ privileged: true
+ network_mode: "host"
+ volumes:
+ - /var/run/docker.sock:/var/run/docker.sock
+ environment:
+ - "GLANCES_OPT=-w"
+ labels:
+ - "traefik.port=61208"
+ - "traefik.frontend.rule=Host:glances.docker.localhost"
diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml
index 522a8b09..ee50dc4b 100644
--- a/docker-compose/docker-compose.yml
+++ b/docker-compose/docker-compose.yml
@@ -1,4 +1,4 @@
-version: '3.7'
+version: '3.9'
services:
glances:
build:
@@ -13,3 +13,5 @@ services:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./glances.conf:/glances/conf/glances.conf"
pid: "host"
+ privileged: true
+ network_mode: "host"
diff --git a/glances/amps_list.py b/glances/amps_list.py
index b2a4fee0..1622dd32 100644
--- a/glances/amps_list.py
+++ b/glances/amps_list.py
@@ -139,18 +139,11 @@ class AmpsList(object):
try:
# Search in both cmdline and name (for kernel thread, see #1261)
for p in processlist:
- add_it = False
- 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
- break
- if add_it:
+ if (re.search(amp_value.regex(), p['name']) is not None) or (
+ p['cmdline'] is not None
+ and p['cmdline'] != []
+ and re.search(amp_value.regex(), ' '.join(p['cmdline'])) is not None
+ ):
ret.append(
{'pid': p['pid'], 'cpu_percent': p['cpu_percent'], 'memory_percent': p['memory_percent']}
)
diff --git a/glances/password.py b/glances/password.py
index e3b1a8d9..26919ca6 100644
--- a/glances/password.py
+++ b/glances/password.py
@@ -26,12 +26,22 @@ class GlancesPassword(object):
"""This class contains all the methods relating to password."""
- def __init__(self, username='glances'):
+ def __init__(self, username='glances', config=None):
self.username = username
- self.password_dir = user_config_dir()
+
+ self.config = config
+ self.password_dir = self.local_password_path()
self.password_filename = self.username + '.pwd'
self.password_file = os.path.join(self.password_dir, self.password_filename)
+ def local_password_path(self):
+ """Return the local password path.
+ Related toissue: Password files in same configuration dir in effect #2143
+ """
+ return self.config.get_value('passwords',
+ 'local_password_path',
+ default=user_config_dir())
+
def sha256_hash(self, plain_password):
"""Return the SHA-256 of the given password."""
return hashlib.sha256(b(plain_password)).hexdigest()
diff --git a/glances/plugins/glances_fs.py b/glances/plugins/glances_fs.py
index 6697628a..56431d48 100644
--- a/glances/plugins/glances_fs.py
+++ b/glances/plugins/glances_fs.py
@@ -106,7 +106,7 @@ class Plugin(GlancesPlugin):
# Loop over fs
for fs in fs_stat:
- # Shall we display the stats ?
+ # Hide the stats if the mount point is in the exclude list
if not self.is_display(fs.mountpoint):
continue
@@ -128,6 +128,12 @@ class Plugin(GlancesPlugin):
'percent': fs_usage.percent,
'key': self.get_key(),
}
+
+ # Hide the stats if the device name is in the exclude list
+ # Correct issue: glances.conf FS hide not applying #1666
+ if not self.is_display(fs_current['device_name']):
+ continue
+
stats.append(fs_current)
elif self.input_method == 'snmp':