UnixAgent icon indicating copy to clipboard operation
UnixAgent copied to clipboard

Possible Improvements in Docker Container Inventarization

Open tilmanKranz opened this issue 2 years ago • 1 comments

General informations

Operating system : Ubuntu 20.04 (but also generally) Perl version : 5.30 (but also older)

OCS Inventory informations

Unix agent version : 2.4.2-3 (but also latest)

Problem's description

We inventarize Docker containers (Miscellaneous -> Virtual Machines -> Operating system VM "Docker Container").

The field "Name VM" is acquired from the content of "Hostname" in the output of docker inspect < CONTAINER ID >. We find the information not very useful and would prefer, as "Name VM" for a "Docker Container" to have the name of the container (either random-generated or explicitly set with docker container run --name < NAME > ...). We currently maintain an (inhouse) patch to Docker.pm that accomplishes this.

We interpret the content of "Name" in the output of docker inspect < CONTAINER ID > using JSON:PP because there are multiple "Name" properties in the output.

Additionally, we also inventarize non-running containers. This is accomplished by iterating docker ps -a instead of docker ps.

Questions:

  1. Is it acceptable to introduce JSON:PP (pure-Perl implementation of JSON parsing) as additional mandatory dependency?

  2. Is it acceptable to inventarize the "Name" instead of "Hostname" of Docker containers as "VM Name"?

  3. Is it acceptable to inventarize non-running containers ("Statut VM" would be, for example, "exited"), too?

If all anwers are "yes", then i would gladly prepare and submit a PR that implements this.

As a perspective, we could also propose several cleanups/improvements to other fieds such as "UUID" and "Type VM", all production-based, as they are used by our teams.

tilmanKranz avatar Jun 30 '22 10:06 tilmanKranz

Hello Yes for all.

fbomj avatar Jul 11 '22 06:07 fbomj