Commit Graph

5971 Commits

Author SHA1 Message Date
Nicolas Hennion
504cf0613f
Merge pull request #2919 from ariel-anieli/refactor-plugin-model-msg-curse
Refactorized `glances.plugins.containers.PluginModel.msg_curse()`
2024-08-18 09:36:25 +02:00
Ariel Otilibili
fa6d46c0c1 Refactorized glances.plugins.containers.PluginModel.msg_curse()
Part of #2801. Broken down in:

* `build_title`
* `build_header`
* on each container, `build_data_line` calls `build_container_data`.

`build_container_data` does for a container:

* `maybe_add_engine_name_or_pod_name`
* `build_container_name`
* `build_status_name`
* `build_uptime_line`
* `build_cpu_line`
* `build_memory_line`
* `build_io_line`
* `build_net_line`
* `build_cmd_line`.

Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-08-17 23:53:46 +02:00
nicolargo
c9525b8a5a Manage the all option (in the Vms plugin) 2024-08-16 09:49:11 +02:00
nicolargo
8e4b9d9215 Only display VMs with a running status (in the Vms plugin) 2024-08-16 09:43:26 +02:00
nicolargo
6fa969adf4 api/4/vms returns a dict, thus breaking make test-restful #2918 2024-08-16 09:25:37 +02:00
nicolargo
fbca700562 Disable Webui audit fix in the CI, 2024-08-11 18:45:21 +02:00
Nicolas Hennion
c0aa754ebc
Merge pull request #2917 from ariel-anieli/makefile
Used patterns for rules targetting `venv`, `venv-python`, `venv-upgrade`
2024-08-11 18:28:09 +02:00
Nicolas Hennion
fcbee3518c
Merge pull request #2915 from ariel-anieli/refactor-process-thread
Reduced complexity of `PluginModel.__msg_curse_extended_process_thread()`
2024-08-11 18:27:06 +02:00
Ariel Otilibili
13079a606b Used patterns rules in venv, venv-python, & venv-python
* `venv-*-python` relies on the pattern `venv-%-python`
* `venv-(full|min|dev)` & `venv-*-upgrade` on `venv-%`
* macros `UPGRADE`, `PRE_COMMIT`, `VIRTUAL_ENV`, & `REQS` are rule switches
* `VIRTUAL_ENV` being evaluated at runtime from `DEFINE_VARS_FOR_TYPE`
* `make help` is unchanged.

```
$ make venv -n
virtualenv -p /usr/bin/python3 venv
virtualenv -p /usr/bin/python3 venv-min
virtualenv -p /usr/bin/python3 venv-dev
venv/bin/pip install  -r requirements.txt;  venv/bin/pip install  -r optional-requirements.txt;
venv-min/bin/pip install  -r requirements.txt;
venv-dev/bin/pip install  -r dev-requirements.txt;  venv-dev/bin/pip install  -r doc-requirements.txt;
venv-dev/bin/pre-commit install --hook-type pre-commit

$ make venv-python -n
virtualenv -p /usr/bin/python3 venv
virtualenv -p /usr/bin/python3 venv-min
virtualenv -p /usr/bin/python3 venv-dev

$ make venv-upgrade -n
venv/bin/install install --upgrade pip
venv/bin/pip install --upgrade -r requirements.txt;  venv/bin/pip install --upgrade -r optional-requirements.txt;
venv-min/bin/install install --upgrade pip
venv-min/bin/pip install --upgrade -r requirements.txt;
venv-dev/bin/install install --upgrade pip
venv-dev/bin/pip install --upgrade -r dev-requirements.txt;  venv-dev/bin/pip install --upgrade -r doc-requirements.txt;
```

Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-08-11 17:45:21 +02:00
Ariel Otilibili
feac10a84d Renamed macros in Makefile
* `s/VENV/venv_full/; s/VENV_MIN/venv_min/; s/VENV_DEV/venv_dev/;`
* useful in subsequent changes

Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-08-11 17:40:27 +02:00
Ariel Otilibili
916aabcfd9 Reduced complexity of PluginModel.__msg_curse_extended_process_thread()
Part of #2801. `ret` goes through these steps:

* `add_title_line`
* `add_cpu_line`
* `maybe_add_cpu_affinity_line`
* `maybe_add_ionice_line`
* `add_memory_line`
* `add_io_and_network_lines`
* `append_newlines`

Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-08-11 12:23:41 +02:00
nicolargo
9c09d6b4a4 url_prefix do not work in Glances < 4.2.0 - Correct issue with mount #2912 2024-08-10 14:58:59 +02:00
Nicolas Hennion
7f049669fb
Merge pull request #2913 from ariel-anieli/makefile
Renamed variables in `Makefile`; rules targetting `docker-*` are now built at runtime
2024-08-10 11:32:28 +02:00
nicolargo
0003768bb8 url_prefix do not work in Glances < 4.2.0 #2912 2024-08-10 10:18:49 +02:00
Ariel Otilibili
a37010929d Rules targetting docker-* are now built at runtime
* removed the macros `DOCKERFILE`, `TARGET`, & `DOCKER_TAG`
* introduced the macro `MAKE_DOCKER_BUILD_RULES`
* at runtime, `docker-*` are built from the `DISTROS` list: done using `eval` [1]
* `make help` is unchanged:

```
$ make | grep '\sdocker-'
make docker-alpine                                       Generate local docker images (Alpine)
make docker-alpine-dev                                   Generate local docker image (Alpine dev)
make docker-alpine-full                                  Generate local docker image (Alpine full)
make docker-alpine-minimal                               Generate local docker image (Alpine minimal)
make docker-ubuntu                                       Generate local docker images (Ubuntu)
make docker-ubuntu-dev                                   Generate local docker image (Ubuntu dev)
make docker-ubuntu-full                                  Generate local docker image (Ubuntu full)
make docker-ubuntu-minimal                               Generate local docker image (Ubuntu minimal)

$ make docker -n
docker buildx build --target full -f docker-files/alpine.Dockerfile -t glances:local-alpine-full .
docker buildx build --target minimal -f docker-files/alpine.Dockerfile -t glances:local-alpine-minimal .
docker buildx build --target dev -f docker-files/alpine.Dockerfile -t glances:local-alpine-dev .
docker buildx build --target full -f docker-files/ubuntu.Dockerfile -t glances:local-ubuntu-full .
docker buildx build --target minimal -f docker-files/ubuntu.Dockerfile -t glances:local-ubuntu-minimal .
docker buildx build --target dev -f docker-files/ubuntu.Dockerfile -t glances:local-ubuntu-dev .
```

[1] https://www.gnu.org/software/make/manual/html_node/Eval-Function.html

Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-08-10 09:23:37 +02:00
Ariel Otilibili
ddfcf46dee Renamed variables in Makefile; introduced the variable DISTROS
* needed for subsequent changes in `Makefile`
* `s/ALPINE_IMAGES/alpine_images/; s/UBUNTU_IMAGES/ubuntu_images/`

Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-08-10 09:17:30 +02:00
Nicolas Hennion
69290ee405
Merge pull request #2910 from ariel-anieli/makefile
Refactorized `Makefile` by using pattern rules
2024-08-09 17:21:50 +02:00
Nicolas Hennion
e40aa05e8a
Merge pull request #2900 from ariel-anieli/issue-2801-catch-key
Reduced complexity of `_GlancesCurses.__catch_key()`
2024-08-09 17:15:53 +02:00
Ariel Otilibili
f5c2d8ce36 Used pattern for rules targetting run-docker-*
`make help` & `make run-docker-*` are unchanged:

```
$ make | grep run-docker
make run-docker-alpine-dev                               Start Glances Alpine Docker dev in console mode
make run-docker-alpine-full                              Start Glances Alpine Docker full in console mode
make run-docker-alpine-minimal                           Start Glances Alpine Docker minimal in console mode
make run-docker-ubuntu-dev                               Start Glances Ubuntu Docker dev in console mode
make run-docker-ubuntu-full                              Start Glances Ubuntu Docker full in console mode
make run-docker-ubuntu-minimal                           Start Glances Ubuntu Docker minimal in console mode

$ make run-docker-alpine-minimal -n
docker run --rm -e TZ="" -e GLANCES_OPT="" --pid host --network host -v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro -v /var/run/docker.sock:/var/run/docker.sock:ro -it glances:local-alpine-minimal

$ make run-docker-alpine-full -n
docker run --rm -e TZ="" -e GLANCES_OPT="" --pid host --network host -v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro -v /var/run/docker.sock:/var/run/docker.sock:ro -it glances:local-alpine-full

$ make run-docker-alpine-dev -n
docker run --rm -e TZ="" -e GLANCES_OPT="" --pid host --network host -v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro -v /var/run/docker.sock:/var/run/docker.sock:ro -it glances:local-alpine-dev

$ make run-docker-ubuntu-dev -n
docker run --rm -e TZ="" -e GLANCES_OPT="" --pid host --network host -v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro -v /var/run/docker.sock:/var/run/docker.sock:ro -it glances:local-ubuntu-dev

$ make run-docker-ubuntu-full -n
docker run --rm -e TZ="" -e GLANCES_OPT="" --pid host --network host -v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro -v /var/run/docker.sock:/var/run/docker.sock:ro -it glances:local-ubuntu-full

$ make run-docker-ubuntu-minimal -n
docker run --rm -e TZ="" -e GLANCES_OPT="" --pid host --network host -v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro -v /var/run/docker.sock:/var/run/docker.sock:ro -it glances:local-ubuntu-minimal
```

Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-08-08 12:28:58 +02:00
Ariel Otilibili
516c99e496 Used pattern for rules targetting docker-*
`make help` & `make docker-*` are unchanged:

```
$ make | grep -P '\sdocker-'
make docker-alpine                                       Generate local docker images (Alpine)
make docker-alpine-dev                                   Generate local docker image (Alpine dev)
make docker-alpine-full                                  Generate local docker image (Alpine full)
make docker-alpine-minimal                               Generate local docker image (Alpine minimal)
make docker-ubuntu                                       Generate local docker images (Ubuntu)
make docker-ubuntu-dev                                   Generate local docker image (Ubuntu dev)
make docker-ubuntu-full                                  Generate local docker image (Ubuntu full)
make docker-ubuntu-minimal                               Generate local docker image (Ubuntu minimal)

$ make docker-alpine -n
docker buildx build --target full -f docker-files/alpine.Dockerfile -t glances:local-alpine-full .
docker buildx build --target minimal -f docker-files/alpine.Dockerfile -t glances:local-alpine-minimal .
docker buildx build --target dev -f docker-files/alpine.Dockerfile -t glances:local-alpine-dev .

$ make docker-ubuntu -n
docker buildx build --target full -f docker-files/ubuntu.Dockerfile -t glances:local-ubuntu-full .
docker buildx build --target minimal -f docker-files/ubuntu.Dockerfile -t glances:local-ubuntu-minimal .
docker buildx build --target dev -f docker-files/ubuntu.Dockerfile -t glances:local-ubuntu-dev .
```

Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-08-08 12:28:58 +02:00
Ariel Otilibili
1fef2594d2 Used pattern for rules targetting test-*
`make help` & `make test-*` are unchanged:

```
$ make | grep test
make test                                                Run unit tests
make test-core                                           Run core unit tests
make test-min                                            Run core unit tests in minimal environment
make test-min-with-upgrade                               Upgrade deps and run unit tests in minimal environment
make test-restful                                        Run Restful unit tests
make test-with-upgrade                                   Upgrade deps and run unit tests
make test-xmlrpc                                         Run XMLRPC unit tests

$ make test -n
venv/bin/python unittest-core.py
venv/bin/python unittest-restful.py
venv/bin/python unittest-xmlrpc.py
```

Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-08-08 12:28:51 +02:00
RazCrimson
c5f06b3847
Merge pull request #2911 from nicolargo/2908-raid-plugin-breaks-with-inactive-raid0-arrays
fix: plugin (raid) - Show degradation only when stats are available
2024-08-08 07:58:57 +05:30
Bharath Vignesh J K
16e5bb2023 fix: plugin (raid) - Show degradation only when stats are available
fixes #2908
2024-08-08 07:58:17 +05:30
RazCrimson
69f4a5fe24
Merge pull request #2907 from ariel-anieli/refactorize-makefile
Refactorize `Makefile`
2024-08-07 18:40:39 +05:30
Ariel Otilibili
0804d06c0b Refactorized make flatpak
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-08-07 07:37:48 +02:00
Ariel Otilibili
b03ea17a5f Refactorized the rules targetting docker-*
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-08-07 07:37:48 +02:00
Ariel Otilibili
6910e61bde Refactorized make semgrep
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-08-07 07:37:48 +02:00
Ariel Otilibili
a6fdc098b9 Refactorized the rules targetting docs-*
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-08-07 07:37:48 +02:00
Ariel Otilibili
313612333c Refactorized trace-malloc and the rules targetting memory-*
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-08-07 07:37:48 +02:00
Ariel Otilibili
cad29145f1 Refactorized the rules targetting profiling-*
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-08-07 07:37:48 +02:00
Ariel Otilibili
4dba2f13ad Refactorized format, lint, & codespell rules
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-08-07 07:37:48 +02:00
Ariel Otilibili
c171d7604e Refactorized the rules targetting test*
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-08-07 07:37:48 +02:00
Ariel Otilibili
658e318fd7 Refactorized the rules targetting venv-*
Addressed `venv-full-*`, `venv-min-*`, & `venv-dev-*`.

Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-08-07 07:37:48 +02:00
Ariel Otilibili
76cd7e63e2 Refactorized make help
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-08-07 07:37:48 +02:00
Ariel Otilibili
020fe7a0b2 Placed phony targets under the same rule
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-08-07 07:37:48 +02:00
Ariel Otilibili
c96c778883 Refactorized the rules targetting run*
* refactorized the rules targetting `run*`
* set up variables for subsequent refactorizations.

Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-08-07 07:37:48 +02:00
Bharath Vignesh J K
4dd732b4d1 chg: deps - cap pysnmp-lextudio ro 6.1.* until migration to async API
Issue tracked at #2874
2024-08-07 07:42:44 +05:30
Bharath Vignesh J K
a7402b1e94 Revert "chg: curses - change colors for some LOG styles"
This reverts commit 5ef7238298.
2024-08-07 07:33:58 +05:30
Ariel Otilibili
7c45563991 Fixed typo in API documentation
Found with `make codespell`.

Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-08-06 20:47:32 +02:00
RazCrimson
99ba0d0a84
Merge pull request #2903 from nicolargo/2882-make-fields-labelled-in-green-easier-to-see
chg: curses - change colors for some LOG styles
2024-07-30 23:51:56 +05:30
Bharath Vignesh J K
5ef7238298 chg: curses - change colors for some LOG styles
fix #2882
2024-07-30 23:50:27 +05:30
Ariel Otilibili
1b199ada75 Reduced complexity of _GlancesCurses.__catch_key()
Part of #2801. Broken down `__catch_key` in two parts:

* `catch_actions_from_hotkey`
* `catch_other_actions_maybe_return_to_browser`.

Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-07-27 16:49:31 +02:00
nicolargo
e03632459b Add VMs to unittest 2024-07-27 08:21:43 +02:00
Ariel Otilibili
98e8e32457 Reduced complexity of unittest-core.TestGlances._common_plugin_tests()
Part of #2801. Common tests follows the flow:

* `reset_stats_history_and_views`
* `do_checks_before_update`
* add first element with `update_stats`
* `check_stats`
* `filter_stats`
* add second element `update_stats`
* `chk_hist_maybe_add_third_elem`
* `check_views`.

Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-07-27 02:09:49 +02:00
nicolargo
81a529dbad Crash when terminal is resized #2872 2024-07-26 11:30:53 +02:00
nicolargo
52a129a3e8 Migration to Alpine 3.20 and Python 3.12 for Alpine Docker 2024-07-26 11:03:38 +02:00
nicolargo
aacc12df45 Correct linter issue https://github.com/nicolargo/glances/actions/runs/10108117146/job/27953472522 - Related to PR #2891 2024-07-26 10:46:04 +02:00
nicolargo
2b30c9986f Add VMs section (disabled by default) in the Docker glances.conf file 2024-07-26 10:20:47 +02:00
Nicolas Hennion
fbd0eee5c4
Merge pull request #2891 from ariel-anieli/issue-2801-plugin-msg-curse
Reduced complexity of `glances.plugins.percpu.PluginModel.msg_curse()`
2024-07-26 10:18:24 +02:00
Ariel Otilibili
6059b9ab42 Reduced complexity of glances.plugins.percpu.PluginModel.msg_curse()
Part of #2801. Broken `msg_curse`: if no stats returns empty list, else:

1. `define_headers_from_os`
2. `maybe_build_string_msg`
3. `display_cpu_stats_per_line`
4. `manage_max_cpu_to_display`
5. Then, for CPU:
   * `display_cpu_header_in_columns`
   * `display_cpu_stats_in_columns`
6. Hence, `summarize_all_cpus_not_displayed`

Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-07-25 00:14:48 +02:00