Correct an issue in the Podman export (date not serializable)

pull/2378/head
nicolargo 2023-05-08 09:26:04 +02:00
parent 8782908b9c
commit e3a1a774ca
9 changed files with 38 additions and 1435 deletions

BIN
docs/_static/containers.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View File

@ -1,25 +1,25 @@
.. _docker:
.. _containers:
Docker
======
Containers
==========
If you use ``Docker``, Glances can help you to monitor your containers.
Glances uses the Docker API through the `docker-py`_ library.
If you use ``containers``, Glances can help you to monitor your Docker or Podman containers.
Glances uses the containers API through the `docker-py`_ and `podman-py`_ libraries.
You can install this dependency using:
.. code-block:: console
pip install glances[docker]
pip install glances[containers]
.. image:: ../_static/docker.png
.. image:: ../_static/containers.png
It is possible to define limits and actions from the configuration file
under the ``[docker]`` section:
under the ``[containers]`` section:
.. code-block:: ini
[docker]
[containers]
disable=False
# Only show specific containers (comma separated list of container name or regular expression)
show=thiscontainer,andthisone,andthoseones.*
@ -27,7 +27,7 @@ under the ``[docker]`` section:
hide=donotshowthisone,andthose.*
# Show only specific containers (comma separated list of container name or regular expression)
#show=showthisone,andthose.*
# Define the maximum docker size name (default is 20 chars)
# Define the maximum containers size name (default is 20 chars)
max_name_size=20
# Global containers' thresholds for CPU and MEM (in %)
cpu_careful=50
@ -44,12 +44,15 @@ under the ``[docker]`` section:
# By default, Glances only display running containers
# Set the following key to True to display all containers
all=False
# Define Podman sock
#podman_sock=unix:///run/user/1000/podman/podman.sock
You can use all the variables ({{foo}}) available in the Docker plugin.
You can use all the variables ({{foo}}) available in the containers plugin.
Filtering (for hide or show) is based on regular expression. Please be sure that your regular
expression works as expected. You can use an online tool like `regex101`_ in
order to test your regular expression.
.. _regex101: https://regex101.com/
.. _docker-py: https://github.com/docker/docker-py
.. _docker-py: https://github.com/containers/containers-py
.. _podman-py: https://github.com/containers/podman-py

View File

@ -40,8 +40,7 @@ Legend:
sensors
hddtemp
ps
monitor
containers
amps
events
docker
actions

View File

@ -1,8 +0,0 @@
.. _monitor:
Monitored Processes List
========================
.. warning::
The monitored processes list feature has been removed. Use the new
Application Monitoring Process (AMP) instead.

File diff suppressed because it is too large Load Diff

View File

@ -316,7 +316,7 @@ class DockerContainersExtension:
stats['Command'] = None
if stats['Status'] in self.CONTAINER_ACTIVE_STATUS:
stats['StartedAt'] = container.attrs['State']['StartedAt']
started_at = container.attrs['State']['StartedAt']
stats_fetcher = self.stats_fetchers[container.id]
activity_stats = stats_fetcher.activity_stats
stats.update(activity_stats)
@ -331,7 +331,7 @@ class DockerContainersExtension:
stats['network_rx'] = stats['network'].get('rx')
stats['network_tx'] = stats['network'].get('tx')
stats['Uptime'] = pretty_date(
parser.parse(stats['StartedAt']).astimezone(tz.tzlocal()).replace(tzinfo=None)
parser.parse(started_at).astimezone(tz.tzlocal()).replace(tzinfo=None)
)
else:
stats['io'] = {}

View File

@ -322,7 +322,7 @@ class PodmanContainersExtension:
}
if stats['Status'] in self.CONTAINER_ACTIVE_STATUS:
stats['StartedAt'] = datetime.fromtimestamp(container.attrs['StartedAt'])
started_at = datetime.fromtimestamp(container.attrs['StartedAt'])
stats_fetcher = self.container_stats_fetchers[container.id]
activity_stats = stats_fetcher.activity_stats
stats.update(activity_stats)
@ -336,7 +336,7 @@ class PodmanContainersExtension:
stats['io_w'] = stats['io'].get('iow')
stats['network_rx'] = stats['network'].get('rx')
stats['network_tx'] = stats['network'].get('tx')
stats['Uptime'] = pretty_date(stats['StartedAt'])
stats['Uptime'] = pretty_date(started_at)
else:
stats['io'] = {}
stats['cpu'] = {}

View File

@ -63,7 +63,7 @@ def get_install_extras_require():
'action': ['chevron'],
'browser': ['zeroconf==0.62.0' if PY2 else 'zeroconf>=0.19.1'],
'cloud': ['requests'],
'docker': ['docker>=2.0.0', 'python-dateutil', 'six'],
'containers': ['docker>=6.1.1', 'python-dateutil', 'six'],
'export': ['bernhard', 'cassandra-driver', 'couchdb', 'elasticsearch',
'graphitesender', 'influxdb>=1.0.0', 'kafka-python',
'pika', 'paho-mqtt', 'potsdb', 'prometheus_client', 'pyzmq',