OCSInventory-NG / UnixAgent

This is the OCS unified agent for Unix operating systems
http://www.ocsinventory-ng.org/en/
GNU General Public License v2.0
89 stars 83 forks source link

Possible Improvements in Docker Container Inventarization #413

Closed tilmanKranz closed 1 year ago

tilmanKranz commented 2 years ago

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.

fbomj commented 2 years ago

Hello Yes for all.

charleneauger commented 1 year ago

Hi @tilmanKranz ,

We are always open to suggestions for improvement. If you do a PR, we will test it and give you feedback :)

Best regards, Charlene

charleneauger commented 1 year ago

Hi,

Since there was no answer, I'll close this issue now.

Regards, Charlene