glpi-project / glpi-agent

GLPI Agent
GNU General Public License v2.0
251 stars 62 forks source link

Support for Systemd-nspawn Containers in GLPI agent #130

Closed alexmicontini closed 2 years ago

alexmicontini commented 2 years ago

Hi, in my organization we work with Linux containers of type Systemd-nspawn. Is the GLPI agent compatible with this type of container or only with LXC? If the agent is installed on the host, the host does not detect the containers or software they contain. For example in a virtual machine there are 2 containers of type systemd-nspawn, one has an Apache web server and another a MariaDB database. The only solution we see right now is to install the agent on containers as well. Thank you.

g-bougard commented 2 years ago

Hi @alexmicontini

actually this is not supported. And honestly I thought about adding that support since I noticed such kind of containers can exist. But I didn't have time to investigate and you're the first I know who is using such containers.

So if you would like to help, I can quickly implement such support as this would benefit to all.

To help, can you share few commands output so I can create some unittests ? I don't even know right now what commands... but if you still know what standard commands can be run to make such inventory, feel free to share ;-). If you have also a simple process to create a container, I would be happy to try it by myself.

alexmicontini commented 2 years ago

Hi @g-bougard,

Thank you very much, I just needed to know if they were compatible. Honestly, it is not worth the development to make the glpi agent compatible with this type of container because we are going to change to docker, although it will take a while.

As an alternative, do you propose to install the agent on the containers, remote inventory,...? Would it be necessary to modify the import rules of computers that come by default?

Greetings

g-bougard commented 2 years ago

Honestly, as systemd becomes a standard and as it supports its own container format, I really would like to implement such virtualization inventory. Even if you migrate to docker, supporting it would still be interesting.

If you want to inventory the container content, of course you'll need to run the agent inside the container, and eventually via remoteinventory. If you want to try remoteinventory, you'll have to enable the sshd service inside the container anyway.

Indeed, running the agent in the container host will only provide the host inventory and (if supported) available containers. When containers list is reported, this permits to keep a link between the container and the container host in GLPI under the "virtualization" tab.

alexmicontini commented 2 years ago

Hi @g-bougard , If compatibility is implemented it would be great. If not, we will either use the remote inventory task or install the agent on each container. Thank you very much. Greetings

alexmicontini commented 2 years ago

Hi, For machines that have LXC containers, what container information is obtained from GLPI? Is it necessary to install the agent to know the software and hardware of the container? All the best

g-bougard commented 2 years ago

Here is a sample of what is reported from the host:

         {
            "mac": "00:16:3e:ec:95:69",
            "memory": 2048,
            "name": "glpi-10-rc1",
            "status": "off",
            "uuid": "487dfdb542a4bfb23670b8d4e76d8b6886c2ed35",
            "vcpu": 2,
            "vmtype": "lxc"
         },

If you need to know installed softwares, you'll have to run the agent inside the container. The UUID will help to link the container with its host in GLPI.

alexmicontini commented 2 years ago

ok, thank you very much @g-bougard .

alexmicontini commented 2 years ago

Hi @g-bougard , what information does the remote inventory task provide? Are you able to provide installed software with remote inventory task? All the best

g-bougard commented 2 years ago

Hi @alexmicontini yes, the inventory generated by RemoteInventory task should be really closed to the expected one when run locally. About the sotfware inventory part, it should be exactly the same.

alexmicontini commented 2 years ago

OK @g-bougard , thank you very much. Is there a part in GLPI where remote computers are managed or is it all in console mode?

g-bougard commented 2 years ago

This is actually only in console mode, but this will change in a near future.

alexmicontini commented 2 years ago

ok @g-bougard

Thank you very much.

g-bougard commented 2 years ago

Hi @alexmicontini

if you want anyway to try systemd-nspawn support from #136, you can do the following:

On host, you can check the result with a partial inventory running:

glpi-inventory --partial virtualmachine

I still would be happy to have your feedback.

g-bougard commented 2 years ago

I forgot to say the inventory won't probably not be imported unless you edit the ./vendor/glpi-project/inventory_format/inventory.schema.json file in you GLPI to remove or update the line 2070 which contains:

"pattern": "^(physical|xen|virtualbox|virtual machine|vmware|qemu|solaris ?zones?|vserver|openvz|bsdjail|parallels|hyperv|aix_lpar|docker|libvirt|lxd|lxc|virtuozzo|kvm|hpvm|wsl[12])$"

You may just update the regexp to include |systemd-nspawn toward the end. If you remove the all line, you need to remove the comma on the previous line too to respect JSON format.

alexmicontini commented 2 years ago

Hello @g-bougard ,

thank you very much for developing support for systemd-nspawn containers.

I have not yet been able to test the changes, as soon as I can I will inform you of the results.

Doubts: What is the host side and the container side? There can be several containers on a host, each of which is accessed through a different port.

In the host or VM the agent is installed, in the containers it is not installed.

From GLPI the inventory is executed.

I can't find in GLPI the path of ./vendor/glpi-project/inventory_format/inventory.schema.json.

Thank you very much.

g-bougard commented 2 years ago

Hi @alexmicontini by "host side", I mean the agent is run on server which hosts containers. By "container side", I mean the agent is run in the container but of course this can only useful when running a distro in which you may want to know which packages have been installed. Of course, you won't run the agent in container just securely running a process from the local host. The "host side" won't run anything inside a running container.

About the vendor/glpi-project/inventory_format/inventory.schema.json, this only concern GLPI 10. If you are still using an older version, you're not concerned.

alexmicontini commented 2 years ago

Hi @g-bougard ,

I understood the host side thing. Regarding the container side, we do want to know what packages have been installed but we are not going to install the agent in the container since there are hundreds of hosts and each host can have several containers. The idea to execute is a remote inventory task to know the installed software.

We currently have GLPI version 9.5.7 installed, waiting for a stable version of the Formcreator plugin for GLPI 10.

Is the change you've made to the agent compatible with GlPI 9.5.7, could you tell what containers are on the host?

What should be put in virtualmachine, the name of the container or the host?

glpi-inventory --partial virtual machine

g-bougard commented 2 years ago

Yes, the change I made is compatible with GLPI 9.5.7 + FusionInventory plugin. The agent will list all containers it detects. Even if you have multiple container type, you'll obtain all we recognize (like docker, lxc or virtuozzo). For each container, the host will try to report few informations like an UUID (so it can be linked in GLPI if agent is also run in the container), a name, a status and few other infos if possible like memory or vcpu. In my experience, I think the name of the container should be used in virtualmachine. If the agent run in the container and find a different name than the container one, this may be a source of confusion in few GLPI places. But this is up to you.

glpi-inventory --partial virtualmachine provides a json inventory which is not supported by GLPI 9.5.6+FI but it's handy to share here the only interesting result.

alexmicontini commented 2 years ago

I have GLPI 9.5.7 + FusionInventory plugin installed.

The list of containers can be obtained with the command

image

On the host that contains the containers I have copied the SystemdNspawn.pm file to the /usr/share/glpi-agent/lib/GLPI/Agent/Task/Inventory/Virtualization directory

As we have not installed the agent in the container I have not replaced the Vmsystem.pm file in the /usr/share/glpi-agent/lib/GLPI/Agent/Task/Inventory directory.

As we do not have GLPI 10 we have not edited the pattern in the ./vendor/glpi-project/inventory_format/inventory.schema.json file.

I have run the glpi-inventory --partial virtualmachine command on the host but it has not detected the containers, only the host itself.

image

I have not run the command in the container because we are not going to install the agent in the container.

g-bougard commented 2 years ago

You made the right update. As you should have noticed, you have a warning saying "You should execute this task as super-user", so try better sudo glpi-inventory --partial virtualmachine.

A point, the agent is not using machinectl as this command only report running containers. The agent checks machinectl ans systemctl are available in the path to enable the module but it uses systemctl --system --all -q --plain list-units systemd-nspawn@* command to report all installed containers, even stopped ones.

alexmicontini commented 2 years ago

Hi,

Ah well thought, list all containers, not just the ones that are running.

The problem is that the execution of the command on the host is not listing the containers:

sudo glpi-inventory --partial virtual machine

g-bougard commented 2 years ago

Have you an output when running systemctl --system --all -q --plain list-units systemd-nspawn@* as root ? Otherwise, add --debug --debug and check the full command output for any problem:

sudo glpi-inventory --partial virtualmachine --debug --debug
alexmicontini commented 2 years ago

Hi @g-bougard ,

I put the generated outputs:

image

sudo systemctl --system --all -q --plain list-unit-files

image

image

sudo glpi-inventory --partial virtualmachine --debug --debug

[info] New inventory from GLPIpre-2022-06-08-18-02-42 for local0 [debug2] module GLPI::Agent::Task::Inventory::AIX disabled [debug2] GLPI::Agent::Task::Inventory::AIX::Bios disabled: implicit dependency GLPI::Agent::Task::Inventory::AIX not enabled [debug2] GLPI::Agent::Task::Inventory::AIX::CPU disabled: implicit dependency GLPI::Agent::Task::Inventory::AIX not enabled [debug2] GLPI::Agent::Task::Inventory::AIX::Controllers disabled: implicit dependency GLPI::Agent::Task::Inventory::AIX not enabled [debug2] GLPI::Agent::Task::Inventory::AIX::Drives disabled: implicit dependency GLPI::Agent::Task::Inventory::AIX not enabled [debug2] GLPI::Agent::Task::Inventory::AIX::Hardware disabled: implicit dependency GLPI::Agent::Task::Inventory::AIX not enabled [debug2] GLPI::Agent::Task::Inventory::AIX::LVM disabled: implicit dependency GLPI::Agent::Task::Inventory::AIX not enabled [debug2] GLPI::Agent::Task::Inventory::AIX::Memory disabled: implicit dependency GLPI::Agent::Task::Inventory::AIX not enabled [debug2] GLPI::Agent::Task::Inventory::AIX::Modems disabled: implicit dependency GLPI::Agent::Task::Inventory::AIX not enabled [debug2] GLPI::Agent::Task::Inventory::AIX::Networks disabled: implicit dependency GLPI::Agent::Task::Inventory::AIX not enabled [debug2] GLPI::Agent::Task::Inventory::AIX::OS disabled: implicit dependency GLPI::Agent::Task::Inventory::AIX not enabled [debug2] GLPI::Agent::Task::Inventory::AIX::Slots disabled: implicit dependency GLPI::Agent::Task::Inventory::AIX not enabled [debug2] GLPI::Agent::Task::Inventory::AIX::Softwares disabled: implicit dependency GLPI::Agent::Task::Inventory::AIX not enabled [debug2] GLPI::Agent::Task::Inventory::AIX::Sounds disabled: implicit dependency GLPI::Agent::Task::Inventory::AIX not enabled [debug2] GLPI::Agent::Task::Inventory::AIX::Storages disabled: implicit dependency GLPI::Agent::Task::Inventory::AIX not enabled [debug2] GLPI::Agent::Task::Inventory::AIX::Videos disabled: implicit dependency GLPI::Agent::Task::Inventory::AIX not enabled [debug2] module GLPI::Agent::Task::Inventory::AccessLog disabled: 'accesslog' category disabled [debug2] module GLPI::Agent::Task::Inventory::BSD disabled [debug2] GLPI::Agent::Task::Inventory::BSD::Alpha disabled: implicit dependency GLPI::Agent::Task::Inventory::BSD not enabled [debug2] GLPI::Agent::Task::Inventory::BSD::CPU disabled: implicit dependency GLPI::Agent::Task::Inventory::BSD not enabled [debug2] GLPI::Agent::Task::Inventory::BSD::Drives disabled: implicit dependency GLPI::Agent::Task::Inventory::BSD not enabled [debug2] GLPI::Agent::Task::Inventory::BSD::MIPS disabled: implicit dependency GLPI::Agent::Task::Inventory::BSD not enabled [debug2] GLPI::Agent::Task::Inventory::BSD::Memory disabled: implicit dependency GLPI::Agent::Task::Inventory::BSD not enabled [debug2] GLPI::Agent::Task::Inventory::BSD::Networks disabled: implicit dependency GLPI::Agent::Task::Inventory::BSD not enabled [debug2] GLPI::Agent::Task::Inventory::BSD::OS disabled: implicit dependency GLPI::Agent::Task::Inventory::BSD not enabled [debug2] GLPI::Agent::Task::Inventory::BSD::SPARC disabled: implicit dependency GLPI::Agent::Task::Inventory::BSD not enabled [debug2] GLPI::Agent::Task::Inventory::BSD::Softwares disabled: implicit dependency GLPI::Agent::Task::Inventory::BSD not enabled [debug2] GLPI::Agent::Task::Inventory::BSD::Storages disabled: implicit dependency GLPI::Agent::Task::Inventory::BSD not enabled [debug2] GLPI::Agent::Task::Inventory::BSD::Storages::Megaraid disabled: implicit dependency GLPI::Agent::Task::Inventory::BSD::Storages not enabled [debug2] GLPI::Agent::Task::Inventory::BSD::Uptime disabled: implicit dependency GLPI::Agent::Task::Inventory::BSD not enabled [debug2] GLPI::Agent::Task::Inventory::BSD::i386 disabled: implicit dependency GLPI::Agent::Task::Inventory::BSD not enabled [debug2] module GLPI::Agent::Task::Inventory::Generic::Arch disabled: 'os' category disabled [debug2] module GLPI::Agent::Task::Inventory::Generic::Batteries disabled: 'battery' category disabled [debug2] GLPI::Agent::Task::Inventory::Generic::Batteries::Acpiconf disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Batteries not enabled [debug2] GLPI::Agent::Task::Inventory::Generic::Batteries::SysClass disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Batteries not enabled [debug2] GLPI::Agent::Task::Inventory::Generic::Batteries::Upower disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Batteries not enabled [debug2] module GLPI::Agent::Task::Inventory::Generic::Databases disabled: 'database' category disabled [debug2] GLPI::Agent::Task::Inventory::Generic::Databases::DB2 disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Databases not enabled [debug2] GLPI::Agent::Task::Inventory::Generic::Databases::MSSQL disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Databases not enabled [debug2] GLPI::Agent::Task::Inventory::Generic::Databases::MongoDB disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Databases not enabled [debug2] GLPI::Agent::Task::Inventory::Generic::Databases::MySQL disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Databases not enabled [debug2] GLPI::Agent::Task::Inventory::Generic::Databases::Oracle disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Databases not enabled [debug2] GLPI::Agent::Task::Inventory::Generic::Databases::PostgreSQL disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Databases not enabled [debug2] module GLPI::Agent::Task::Inventory::Generic::Dmidecode::Battery disabled: 'battery' category disabled [debug2] module GLPI::Agent::Task::Inventory::Generic::Dmidecode::Memory disabled: 'memory' category disabled [debug2] module GLPI::Agent::Task::Inventory::Generic::Dmidecode::Ports disabled: 'port' category disabled [debug2] module GLPI::Agent::Task::Inventory::Generic::Dmidecode::Psu disabled: 'psu' category disabled [debug2] module GLPI::Agent::Task::Inventory::Generic::Dmidecode::Slots disabled: 'slot' category disabled [debug2] module GLPI::Agent::Task::Inventory::Generic::Drives disabled: 'drive' category disabled [debug2] GLPI::Agent::Task::Inventory::Generic::Drives::ASM disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Drives not enabled [debug2] module GLPI::Agent::Task::Inventory::Generic::Environment disabled: 'environment' category disabled [debug2] module GLPI::Agent::Task::Inventory::Generic::Firewall disabled: 'firewall' category disabled [debug2] GLPI::Agent::Task::Inventory::Generic::Firewall::Systemd disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Firewall not enabled [debug2] GLPI::Agent::Task::Inventory::Generic::Firewall::Ufw disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Firewall not enabled [debug2] module GLPI::Agent::Task::Inventory::Generic::Ipmi disabled [debug2] GLPI::Agent::Task::Inventory::Generic::Ipmi::Fru disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Ipmi not enabled [debug2] GLPI::Agent::Task::Inventory::Generic::Ipmi::Fru::Controllers disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Ipmi::Fru not enabled [debug2] GLPI::Agent::Task::Inventory::Generic::Ipmi::Fru::Memory disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Ipmi::Fru not enabled [debug2] GLPI::Agent::Task::Inventory::Generic::Ipmi::Fru::Psu disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Ipmi::Fru not enabled [debug2] GLPI::Agent::Task::Inventory::Generic::Ipmi::Lan disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Ipmi not enabled [debug2] module GLPI::Agent::Task::Inventory::Generic::Networks disabled: 'network' category disabled [debug2] GLPI::Agent::Task::Inventory::Generic::Networks::iLO disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Networks not enabled [debug2] module GLPI::Agent::Task::Inventory::Generic::OS disabled: 'os' category disabled [debug2] module GLPI::Agent::Task::Inventory::Generic::PCI::Controllers disabled: 'controller' category disabled [debug2] module GLPI::Agent::Task::Inventory::Generic::PCI::Modems disabled: 'modem' category disabled [debug2] module GLPI::Agent::Task::Inventory::Generic::PCI::Sounds disabled: 'sound' category disabled [debug2] module GLPI::Agent::Task::Inventory::Generic::PCI::Videos disabled: 'video' category disabled [debug2] module GLPI::Agent::Task::Inventory::Generic::Printers disabled: 'printer' category disabled [debug2] module GLPI::Agent::Task::Inventory::Generic::Processes disabled: 'process' category disabled [debug2] module GLPI::Agent::Task::Inventory::Generic::Remote_Mgmt disabled: 'remote_mgmt' category disabled [debug2] GLPI::Agent::Task::Inventory::Generic::Remote_Mgmt::AnyDesk disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Remote_Mgmt not enabled [debug2] GLPI::Agent::Task::Inventory::Generic::Remote_Mgmt::LiteManager disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Remote_Mgmt not enabled [debug2] GLPI::Agent::Task::Inventory::Generic::Remote_Mgmt::TeamViewer disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Remote_Mgmt not enabled [debug2] module GLPI::Agent::Task::Inventory::Generic::Rudder disabled: 'rudder' category disabled [debug2] module GLPI::Agent::Task::Inventory::Generic::SSH disabled: 'os' category disabled [debug2] module GLPI::Agent::Task::Inventory::Generic::Screen disabled: 'monitor' category disabled [debug2] module GLPI::Agent::Task::Inventory::Generic::Softwares disabled: 'software' category disabled [debug2] GLPI::Agent::Task::Inventory::Generic::Softwares::Deb disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Softwares not enabled [debug2] GLPI::Agent::Task::Inventory::Generic::Softwares::Flatpak disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Softwares not enabled [debug2] GLPI::Agent::Task::Inventory::Generic::Softwares::Gentoo disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Softwares not enabled [debug2] GLPI::Agent::Task::Inventory::Generic::Softwares::Nix disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Softwares not enabled [debug2] GLPI::Agent::Task::Inventory::Generic::Softwares::Pacman disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Softwares not enabled [debug2] GLPI::Agent::Task::Inventory::Generic::Softwares::RPM disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Softwares not enabled [debug2] GLPI::Agent::Task::Inventory::Generic::Softwares::Slackware disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Softwares not enabled [debug2] GLPI::Agent::Task::Inventory::Generic::Softwares::Snap disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Softwares not enabled [debug2] module GLPI::Agent::Task::Inventory::Generic::Storages disabled: 'storage' category disabled [debug2] GLPI::Agent::Task::Inventory::Generic::Storages::3ware disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Storages not enabled [debug2] GLPI::Agent::Task::Inventory::Generic::Storages::HP disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Storages not enabled [debug2] GLPI::Agent::Task::Inventory::Generic::Storages::HpWithSmartctl disabled: implicit dependency GLPI::Agent::Task::Inventory::Generic::Storages not enabled [debug2] module GLPI::Agent::Task::Inventory::Generic::Timezone disabled: 'os' category disabled [debug2] module GLPI::Agent::Task::Inventory::Generic::USB disabled: 'usb' category disabled [debug2] module GLPI::Agent::Task::Inventory::Generic::Users disabled: 'user' category disabled [debug2] module GLPI::Agent::Task::Inventory::HPUX disabled [debug2] GLPI::Agent::Task::Inventory::HPUX::Bios disabled: implicit dependency GLPI::Agent::Task::Inventory::HPUX not enabled [debug2] GLPI::Agent::Task::Inventory::HPUX::CPU disabled: implicit dependency GLPI::Agent::Task::Inventory::HPUX not enabled [debug2] GLPI::Agent::Task::Inventory::HPUX::Controllers disabled: implicit dependency GLPI::Agent::Task::Inventory::HPUX not enabled [debug2] GLPI::Agent::Task::Inventory::HPUX::Drives disabled: implicit dependency GLPI::Agent::Task::Inventory::HPUX not enabled [debug2] GLPI::Agent::Task::Inventory::HPUX::Hardware disabled: implicit dependency GLPI::Agent::Task::Inventory::HPUX not enabled [debug2] GLPI::Agent::Task::Inventory::HPUX::MP disabled: implicit dependency GLPI::Agent::Task::Inventory::HPUX not enabled [debug2] GLPI::Agent::Task::Inventory::HPUX::Memory disabled: implicit dependency GLPI::Agent::Task::Inventory::HPUX not enabled [debug2] GLPI::Agent::Task::Inventory::HPUX::Networks disabled: implicit dependency GLPI::Agent::Task::Inventory::HPUX not enabled [debug2] GLPI::Agent::Task::Inventory::HPUX::OS disabled: implicit dependency GLPI::Agent::Task::Inventory::HPUX not enabled [debug2] GLPI::Agent::Task::Inventory::HPUX::Slots disabled: implicit dependency GLPI::Agent::Task::Inventory::HPUX not enabled [debug2] GLPI::Agent::Task::Inventory::HPUX::Softwares disabled: implicit dependency GLPI::Agent::Task::Inventory::HPUX not enabled [debug2] GLPI::Agent::Task::Inventory::HPUX::Storages disabled: implicit dependency GLPI::Agent::Task::Inventory::HPUX not enabled [debug2] GLPI::Agent::Task::Inventory::HPUX::Uptime disabled: implicit dependency GLPI::Agent::Task::Inventory::HPUX not enabled [debug2] module GLPI::Agent::Task::Inventory::Linux::ARM disabled [debug2] GLPI::Agent::Task::Inventory::Linux::ARM::Board disabled: implicit dependency GLPI::Agent::Task::Inventory::Linux::ARM not enabled [debug2] GLPI::Agent::Task::Inventory::Linux::ARM::CPU disabled: implicit dependency GLPI::Agent::Task::Inventory::Linux::ARM not enabled [debug2] module GLPI::Agent::Task::Inventory::Linux::Alpha disabled [debug2] GLPI::Agent::Task::Inventory::Linux::Alpha::CPU disabled: implicit dependency GLPI::Agent::Task::Inventory::Linux::Alpha not enabled [debug2] module GLPI::Agent::Task::Inventory::Linux::Distro disabled: 'os' category disabled [debug2] GLPI::Agent::Task::Inventory::Linux::Distro::NonLSB disabled: implicit dependency GLPI::Agent::Task::Inventory::Linux::Distro not enabled [debug2] GLPI::Agent::Task::Inventory::Linux::Distro::OSRelease disabled: implicit dependency GLPI::Agent::Task::Inventory::Linux::Distro not enabled [debug2] module GLPI::Agent::Task::Inventory::Linux::Drives disabled: 'drive' category disabled [debug2] module GLPI::Agent::Task::Inventory::Linux::Inputs disabled: 'input' category disabled [debug2] module GLPI::Agent::Task::Inventory::Linux::LVM disabled: 'lvm' category disabled [debug2] module GLPI::Agent::Task::Inventory::Linux::MIPS disabled [debug2] GLPI::Agent::Task::Inventory::Linux::MIPS::CPU disabled: implicit dependency GLPI::Agent::Task::Inventory::Linux::MIPS not enabled [debug2] module GLPI::Agent::Task::Inventory::Linux::Memory disabled: 'memory' category disabled [debug2] module GLPI::Agent::Task::Inventory::Linux::Networks disabled: 'network' category disabled [debug2] GLPI::Agent::Task::Inventory::Linux::Networks::DockerMacvlan disabled: implicit dependency GLPI::Agent::Task::Inventory::Linux::Networks not enabled [debug2] GLPI::Agent::Task::Inventory::Linux::Networks::FibreChannel disabled: implicit dependency GLPI::Agent::Task::Inventory::Linux::Networks not enabled [debug2] module GLPI::Agent::Task::Inventory::Linux::OS disabled: 'os' category disabled [debug2] module GLPI::Agent::Task::Inventory::Linux::PowerPC disabled [debug2] GLPI::Agent::Task::Inventory::Linux::PowerPC::Bios disabled: implicit dependency GLPI::Agent::Task::Inventory::Linux::PowerPC not enabled [debug2] GLPI::Agent::Task::Inventory::Linux::PowerPC::CPU disabled: implicit dependency GLPI::Agent::Task::Inventory::Linux::PowerPC not enabled [debug2] module GLPI::Agent::Task::Inventory::Linux::SPARC disabled [debug2] GLPI::Agent::Task::Inventory::Linux::SPARC::CPU disabled: implicit dependency GLPI::Agent::Task::Inventory::Linux::SPARC not enabled [debug2] module GLPI::Agent::Task::Inventory::Linux::Storages disabled: 'storage' category disabled [debug2] GLPI::Agent::Task::Inventory::Linux::Storages::Adaptec disabled: implicit dependency GLPI::Agent::Task::Inventory::Linux::Storages not enabled [debug2] GLPI::Agent::Task::Inventory::Linux::Storages::Lsilogic disabled: implicit dependency GLPI::Agent::Task::Inventory::Linux::Storages not enabled [debug2] GLPI::Agent::Task::Inventory::Linux::Storages::Megacli disabled: implicit dependency GLPI::Agent::Task::Inventory::Linux::Storages not enabled [debug2] GLPI::Agent::Task::Inventory::Linux::Storages::MegacliWithSmartctl disabled: implicit dependency GLPI::Agent::Task::Inventory::Linux::Storages not enabled [debug2] GLPI::Agent::Task::Inventory::Linux::Storages::Megaraid disabled: implicit dependency GLPI::Agent::Task::Inventory::Linux::Storages not enabled [debug2] GLPI::Agent::Task::Inventory::Linux::Storages::ServeRaid disabled: implicit dependency GLPI::Agent::Task::Inventory::Linux::Storages not enabled [debug2] module GLPI::Agent::Task::Inventory::Linux::Uptime disabled: 'os' category disabled [debug2] module GLPI::Agent::Task::Inventory::Linux::Videos disabled: 'video' category disabled [debug2] module GLPI::Agent::Task::Inventory::Linux::i386::CPU disabled: 'cpu' category disabled [debug2] module GLPI::Agent::Task::Inventory::Linux::m68k disabled [debug2] GLPI::Agent::Task::Inventory::Linux::m68k::CPU disabled: implicit dependency GLPI::Agent::Task::Inventory::Linux::m68k not enabled [debug2] module GLPI::Agent::Task::Inventory::MacOS disabled [debug2] GLPI::Agent::Task::Inventory::MacOS::Batteries disabled: implicit dependency GLPI::Agent::Task::Inventory::MacOS not enabled [debug2] GLPI::Agent::Task::Inventory::MacOS::Bios disabled: implicit dependency GLPI::Agent::Task::Inventory::MacOS not enabled [debug2] GLPI::Agent::Task::Inventory::MacOS::CPU disabled: implicit dependency GLPI::Agent::Task::Inventory::MacOS not enabled [debug2] GLPI::Agent::Task::Inventory::MacOS::Drives disabled: implicit dependency GLPI::Agent::Task::Inventory::MacOS not enabled [debug2] GLPI::Agent::Task::Inventory::MacOS::Firewall disabled: implicit dependency GLPI::Agent::Task::Inventory::MacOS not enabled [debug2] GLPI::Agent::Task::Inventory::MacOS::Hardware disabled: implicit dependency GLPI::Agent::Task::Inventory::MacOS not enabled [debug2] GLPI::Agent::Task::Inventory::MacOS::Hostname disabled: implicit dependency GLPI::Agent::Task::Inventory::MacOS not enabled [debug2] GLPI::Agent::Task::Inventory::MacOS::License disabled: implicit dependency GLPI::Agent::Task::Inventory::MacOS not enabled [debug2] GLPI::Agent::Task::Inventory::MacOS::Memory disabled: implicit dependency GLPI::Agent::Task::Inventory::MacOS not enabled [debug2] GLPI::Agent::Task::Inventory::MacOS::Networks disabled: implicit dependency GLPI::Agent::Task::Inventory::MacOS not enabled [debug2] GLPI::Agent::Task::Inventory::MacOS::OS disabled: implicit dependency GLPI::Agent::Task::Inventory::MacOS not enabled [debug2] GLPI::Agent::Task::Inventory::MacOS::Printers disabled: implicit dependency GLPI::Agent::Task::Inventory::MacOS not enabled [debug2] GLPI::Agent::Task::Inventory::MacOS::Psu disabled: implicit dependency GLPI::Agent::Task::Inventory::MacOS not enabled [debug2] GLPI::Agent::Task::Inventory::MacOS::Softwares disabled: implicit dependency GLPI::Agent::Task::Inventory::MacOS not enabled [debug2] GLPI::Agent::Task::Inventory::MacOS::Sound disabled: implicit dependency GLPI::Agent::Task::Inventory::MacOS not enabled [debug2] GLPI::Agent::Task::Inventory::MacOS::Storages disabled: implicit dependency GLPI::Agent::Task::Inventory::MacOS not enabled [debug2] GLPI::Agent::Task::Inventory::MacOS::USB disabled: implicit dependency GLPI::Agent::Task::Inventory::MacOS not enabled [debug2] GLPI::Agent::Task::Inventory::MacOS::Uptime disabled: implicit dependency GLPI::Agent::Task::Inventory::MacOS not enabled [debug2] GLPI::Agent::Task::Inventory::MacOS::Videos disabled: implicit dependency GLPI::Agent::Task::Inventory::MacOS not enabled [debug2] module GLPI::Agent::Task::Inventory::Provider disabled: 'provider' category disabled [debug2] module GLPI::Agent::Task::Inventory::Solaris disabled [debug2] GLPI::Agent::Task::Inventory::Solaris::Bios disabled: implicit dependency GLPI::Agent::Task::Inventory::Solaris not enabled [debug2] GLPI::Agent::Task::Inventory::Solaris::CPU disabled: implicit dependency GLPI::Agent::Task::Inventory::Solaris not enabled [debug2] GLPI::Agent::Task::Inventory::Solaris::Controllers disabled: implicit dependency GLPI::Agent::Task::Inventory::Solaris not enabled [debug2] GLPI::Agent::Task::Inventory::Solaris::Drives disabled: implicit dependency GLPI::Agent::Task::Inventory::Solaris not enabled [debug2] GLPI::Agent::Task::Inventory::Solaris::Hardware disabled: implicit dependency GLPI::Agent::Task::Inventory::Solaris not enabled [debug2] GLPI::Agent::Task::Inventory::Solaris::Memory disabled: implicit dependency GLPI::Agent::Task::Inventory::Solaris not enabled [debug2] GLPI::Agent::Task::Inventory::Solaris::Networks disabled: implicit dependency GLPI::Agent::Task::Inventory::Solaris not enabled [debug2] GLPI::Agent::Task::Inventory::Solaris::OS disabled: implicit dependency GLPI::Agent::Task::Inventory::Solaris not enabled [debug2] GLPI::Agent::Task::Inventory::Solaris::Slots disabled: implicit dependency GLPI::Agent::Task::Inventory::Solaris not enabled [debug2] GLPI::Agent::Task::Inventory::Solaris::Softwares disabled: implicit dependency GLPI::Agent::Task::Inventory::Solaris not enabled [debug2] GLPI::Agent::Task::Inventory::Solaris::Storages disabled: implicit dependency GLPI::Agent::Task::Inventory::Solaris not enabled [debug2] module GLPI::Agent::Task::Inventory::Virtualization::Docker disabled [debug2] module GLPI::Agent::Task::Inventory::Virtualization::Hpvm disabled [debug2] module GLPI::Agent::Task::Inventory::Virtualization::HyperV disabled [debug2] module GLPI::Agent::Task::Inventory::Virtualization::Jails disabled [debug2] module GLPI::Agent::Task::Inventory::Virtualization::Libvirt disabled [debug2] module GLPI::Agent::Task::Inventory::Virtualization::Lxc disabled [debug2] module GLPI::Agent::Task::Inventory::Virtualization::Lxd disabled [debug2] module GLPI::Agent::Task::Inventory::Virtualization::Parallels disabled [debug2] module GLPI::Agent::Task::Inventory::Virtualization::Qemu disabled [debug2] module GLPI::Agent::Task::Inventory::Virtualization::SolarisZones disabled [debug2] module GLPI::Agent::Task::Inventory::Virtualization::VirtualBox disabled [debug2] module GLPI::Agent::Task::Inventory::Virtualization::Virtuozzo disabled [debug2] module GLPI::Agent::Task::Inventory::Virtualization::VmWareDesktop disabled [debug2] module GLPI::Agent::Task::Inventory::Virtualization::VmWareESX disabled [debug2] module GLPI::Agent::Task::Inventory::Virtualization::Vserver disabled [debug2] module GLPI::Agent::Task::Inventory::Virtualization::Wsl disabled [debug2] module GLPI::Agent::Task::Inventory::Virtualization::Xen disabled [debug2] module GLPI::Agent::Task::Inventory::Virtualization::XenCitrixServer disabled [debug2] module GLPI::Agent::Task::Inventory::Win32 disabled [debug2] GLPI::Agent::Task::Inventory::Win32::AntiVirus disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32 not enabled [debug2] GLPI::Agent::Task::Inventory::Win32::Bios disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32 not enabled [debug2] GLPI::Agent::Task::Inventory::Win32::CPU disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32 not enabled [debug2] GLPI::Agent::Task::Inventory::Win32::Chassis disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32 not enabled [debug2] GLPI::Agent::Task::Inventory::Win32::Controllers disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32 not enabled [debug2] GLPI::Agent::Task::Inventory::Win32::Drives disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32 not enabled [debug2] GLPI::Agent::Task::Inventory::Win32::Environment disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32 not enabled [debug2] GLPI::Agent::Task::Inventory::Win32::Firewall disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32 not enabled [debug2] GLPI::Agent::Task::Inventory::Win32::Hardware disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32 not enabled [debug2] GLPI::Agent::Task::Inventory::Win32::Inputs disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32 not enabled [debug2] GLPI::Agent::Task::Inventory::Win32::License disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32 not enabled [debug2] GLPI::Agent::Task::Inventory::Win32::Memory disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32 not enabled [debug2] GLPI::Agent::Task::Inventory::Win32::Modems disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32 not enabled [debug2] GLPI::Agent::Task::Inventory::Win32::Networks disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32 not enabled [debug2] GLPI::Agent::Task::Inventory::Win32::OS disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32 not enabled [debug2] GLPI::Agent::Task::Inventory::Win32::Ports disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32 not enabled [debug2] GLPI::Agent::Task::Inventory::Win32::Printers disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32 not enabled [debug2] GLPI::Agent::Task::Inventory::Win32::Registry disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32 not enabled [debug2] GLPI::Agent::Task::Inventory::Win32::Slots disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32 not enabled [debug2] GLPI::Agent::Task::Inventory::Win32::Softwares disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32 not enabled [debug2] GLPI::Agent::Task::Inventory::Win32::Sounds disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32 not enabled [debug2] GLPI::Agent::Task::Inventory::Win32::Storages disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32 not enabled [debug2] GLPI::Agent::Task::Inventory::Win32::Storages::HP disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32::Storages not enabled [debug2] GLPI::Agent::Task::Inventory::Win32::USB disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32 not enabled [debug2] GLPI::Agent::Task::Inventory::Win32::Users disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32 not enabled [debug2] GLPI::Agent::Task::Inventory::Win32::Videos disabled: implicit dependency GLPI::Agent::Task::Inventory::Win32 not enabled [debug] module GLPI::Agent::Task::Inventory::Linux::Bios disabled because of GLPI::Agent::Task::Inventory::Generic::Dmidecode::Bios [debug] Running GLPI::Agent::Task::Inventory::Generic [debug] Running GLPI::Agent::Task::Inventory::Generic::Dmidecode [debug] Running GLPI::Agent::Task::Inventory::Generic::Dmidecode::Bios [debug2] executing dmidecode [debug] Running GLPI::Agent::Task::Inventory::Generic::Dmidecode::Hardware [debug] Running GLPI::Agent::Task::Inventory::Generic::Domains [debug] Running GLPI::Agent::Task::Inventory::Generic::Hostname [debug] Running GLPI::Agent::Task::Inventory::Generic::PCI [debug] Running GLPI::Agent::Task::Inventory::Linux [debug] Running GLPI::Agent::Task::Inventory::Linux::Hardware [debug] Running GLPI::Agent::Task::Inventory::Linux::i386 [debug] Running GLPI::Agent::Task::Inventory::Virtualization [debug] Running GLPI::Agent::Task::Inventory::Virtualization::SystemdNspawn [debug2] executing systemctl --system --all -q --plain list-units systemd-nspawn@* [debug] Running GLPI::Agent::Task::Inventory::Vmsystem [debug2] inventory format: server is a beta version Be sure to use latest GLPI Agent nightly build. If the server rejects the inventory, please, report an issue on glpi-agent github project. { "action": "inventory", "content": { "bios": { "bdate": "2018-12-12", "bmanufacturer": "Phoenix Technologies LTD", "bversion": "6.00", "mmanufacturer": "Intel Corporation", "mmodel": "440BX Desktop Reference Platform", "smanufacturer": "VMware, Inc.", "smodel": "VMware Virtual Platform", "ssn": "VMware-42 07 17 a6 4e 5e 30 86-5d 23 54 a0 e1 ec 86 15" }, "hardware": { "chassis_type": "Other", "dns": "192.168.1.6/192.168.1.7", "name": "GLPIpre", "uuid": "a6170742-5e4e-8630-5d23-54a0e1ec8615", "vmsystem": "VMware", "workgroup": "xxxxxx.com" }, "versionclient": "GLPI-Inventory_v1.2-1" }, "deviceid": "GLPIpre-2022-06-08-18-02-42", "itemtype": "Computer" }

g-bougard commented 2 years ago

Well indeed, systemctl version is handy if you register your containers with systemd facility. I guess I should fallback on machinectl output if systemctl returns an empty list. The only pitfall here is we can't inventory powered off containers. A point, memory allocation and "vcpu" equivalent are set via systemd parameter and I think you need to register to catch them. If you don't use such feature, don't worry anyway.

alexmicontini commented 2 years ago

Hi @g-bougard,

So for the results command to register the containers with systemd facility?

In case we do not register them and systemctl returns an empty list, we have to replace the command

"systemctl --system --all -q --plain list-units systemd-nspawn@*"

by "machinectl list" in the SystemdNspawn.pm script to make it work?

OK, I will investigate how to set the memory allocation and "vcpu" through the systemd parameter because we are interested in capturing them

g-bougard commented 2 years ago

As the output is different, I need to adapt the code to support the machinectl list case. Wait a moment.

g-bougard commented 2 years ago

I updated the file. Can you try now with this module: SystemdNspawn.pm ?

alexmicontini commented 2 years ago

wow it worked!! Thank you very much indeed, excellent work.

image

image

The only but is that the information obtained from the container is minimal, for example it does not indicate the container's Operating System when the machinectl list command does.

image

Could the script provide more information, such as the Operating System or memory?

I agree that to know the software you have to install the agent or run the remote inventory task. it's correct?

Since we are not going to install the agent, we will launch the remote inventory task.

All the best

g-bougard commented 2 years ago

I still noticed a little bug: we should read systemd-nspawn in place of just systemd. A need to fix a regexp.

Yes, the information is minimal, and this is why running agent in the container is really needed. machinectl is providing a knowledge of the base OS, but this is not totally exact as if your run the agent inside the container, you'll probably obtain a more accurate OS version. Of course, this would be nice to still have it but this would be also a new source of confusion.

As the memory is set to 0 in GLPI, it means this has not been set in inventory and the container has potentially access to all the host memory size. So I can probably set memory to the currently available size, but I'm not sure this is exact. When set, it means MemoryMax has been set in dedicated systemd service, but I guess it can also be greater than the real available memory size. So I won't really trust that value. Anyway and generally speaking, memory for containers has definitively not the same meaning than for virtualized machines.

About remote inventory, you still require to have a sshd service enabled inside the container. Now, and thinking about, I imagine a remote inventory targeting a container could be based on a process execution inside the container... I'll put that idea on my concept to explore as I imagine this can benefit to different kinds of container technology ;-)

g-bougard commented 2 years ago

I just pushed the following patch on my PR to fix the issue I noticed:

diff --git a/lib/GLPI/Agent/Task/Inventory/Virtualization/SystemdNspawn.pm b/lib/GLPI/Agent/Task/Inventory/Virtualization/SystemdNspawn.pm
index 0d1c1bfaf..db62ab9bb 100644
--- a/lib/GLPI/Agent/Task/Inventory/Virtualization/SystemdNspawn.pm
+++ b/lib/GLPI/Agent/Task/Inventory/Virtualization/SystemdNspawn.pm
@@ -62,7 +62,7 @@ sub  _getVirtualMachines {
         command => "machinectl --no-pager --no-legend",
         logger  => $params{logger}
     )) {
-        my ($name, $class, $service) = $line =~ /^(\S+)\s+(\w+)\s+(\w+)/
+        my ($name, $class, $service) = $line =~ /^(\S+)\s+(\w+)\s+(\S+)/
             or next;

         my $container;

You can apply it by editing the file and just changing the last \w by \S on l. 65.

alexmicontini commented 2 years ago

Hi @g-bougard ,

I haven't patched SystemdNspawn.pm yet but I see strange things:

On the GLPIpre host there are 2 containers:

image

On host srvpruebas1pre there is 1 container:

image

On host srvpruebas2pre there is 1 container:

image

In the machine that is created connected to the CDsrvpruebas1pre container, in the virtualization section, 4 host are seen and GLPIpre duplicate appears:

image

It will correct the duplicity the last patch that you have indicated.

Regarding the remote inventory, yes, the sshd service is enabled in each container and it is accessed by ssh with the host IP and port. Given that a user with administrator permissions is required for the remote inventory task, we are very concerned about security, so the ideal would be to also access it with a digital certificate and that the data is encrypted over all the access data that is passed as a parameter on the connection.

It would be great to carry out that idea but taking care of security!

Anything to improve the agent is welcome.

Thank you very much. Greetings

g-bougard commented 2 years ago

What's the output of machinectl --no-pager --no-legend for that last computer where you have duplicated ?

About ssh remote inventory, this is very secured. You only have to setup an access on one trusted agent which can be the host itself. For example, you should be able to simply configure a remote access based on dedicated public key as usual for ssh in ~/.ssh/config (in client-side) and in ~/.ssh/authorized_keys container file. It is generally advised to run an agent as root, but for container, it may be sufficient to run it as a dedicated user without specific privileges. This way you'll still have the software inventory which I suppose is the only really interesting part for you.

alexmicontini commented 2 years ago

Hi @g-bougard ,

The outputs after running the command machinectl --no-pager --no-legend on the three computers that have containers are as follows:

GLPIPre image

srvpruebas1pre image

srvpruebas2pre image

The equipment that appears duplicated is GLPIpre.

In GLPI, only the computer associated with the srvpruebas1pre container was created, with the name CDsrvpruebas1pre. The problem is that computers CDGPLIBDpre, CDGPLIpre and CDsrvpruebas2pre associated with containers should have been created but they were not. Could it be because of the GLPI import rules?

Well, we are not only interested in knowing the software but also the hardware and being able to know the dependencies between equipment and when there is a problem about which other equipment it can impact.

I'll try remote inventory as you've indicated and let you know.

Thank you very much

g-bougard commented 2 years ago

Hi @alexmicontini

did you still run glpi-agent inside some containers for testing ? If yes, you need to re-run it but using the patch on Vmsystem.pm like I told you before. The problem here is if you have dmidecode installed in the container, you'll probably obtain the host UUID and this is really really bad as you can have mess up between computer assets in glpi: container inventory or host inventory updating the same asset.

I suspect such problem as I see in your previous screenshot that all your containers seems to have the same UUID... this is a big problem. And honestly I'm not sure to understand how that's possible to see that in GLPI for containers on different hosts. Maybe you cloned containers after a first run and run an inventory from it for testing.

From the container, you can check the content of /etc/machine-id. From the host, you can check the Id with: machinectl show -p Id CONTAINER_NAME changing CONTAINER_NAME by CDGPLIBDpre, CDGPLIpre, CDsrvpruebas1pre and CDsrvpruebas2pre Content of /etc/machine-id and Id seen from host should match.

For ssh remote inventory, I talked about software inventory, but most other stuff could be inventoried too even from a user account. There will be few things that really need a root access. You still can test to make an inventory file from root and a normal user and make a diff on it. The difference can be a bigger problem on a physical host than on a container.

alexmicontini commented 2 years ago

Hi,

On each host and containers dmidecode is installed. A container is created once and then copied to each host that is needed and a service associated with the container is brought up.

It seems that, as you comment, the containers have the same id.

It is happening that when inventory is run on a host, the associated asset in the last inventory is overwritten.

If this is a problem, we will try to find a way that when the service is started to launch the container on the host, a random and unique id is created for the container.

Host GLPIpre

Contenedores:

Desde el host GLPIpre:

$ machinectl show -p Id CDGPLIBDpre Id=c01dd7852d1349dcbb698d55bec3f4bc

$ machinectl show -p Id CDGPLIpre Id=c01dd7852d1349dcbb698d55bec3f4bc

Desde el contenedor CDGPLIpre:

$ more /etc/machine-id c01dd7852d1349dcbb698d55bec3f4bc

Desde el contenedor CDGPLIBDpre:

$ more /etc/machine-id c01dd7852d1349dcbb698d55bec3f4bc

Host srvpruebas1pre

Contenedores:

Desde el host srvpruebas1pre:

$ machinectl show -p Id CDsrvpruebas1pre Id=c01dd7852d1349dcbb698d55bec3f4bc

Desde el contenedor CDsrvpruebas1pre $ more /etc/machine-id c01dd7852d1349dcbb698d55bec3f4bc

Host srvpruebas2pre

Contenedores:

Desde el host srvpruebas2pre:

$ machinectl show -p Id CDsrvpruebas2pre Id=c01dd7852d1349dcbb698d55bec3f4bc

Desde el contenedor CDsrvpruebas2pre $ more /etc/machine-id c01dd7852d1349dcbb698d55bec3f4bc

We have not and will not install the agent in the container.

g-bougard commented 2 years ago

As far I know, you may just have to remove /etc/machine-id file and reboot as this file should be generated during boot time if it is missing.

alexmicontini commented 2 years ago

I have deleted the /etc/machine-id file and changed the content, restarted but it is generated again with the same content. It must be that the content is obtained from elsewhere and I am investigating.

alexmicontini commented 2 years ago

Hi @g-bougard,

When I run the command: glpi-agent --debug on a host with two systemd-nspawn containers it gives me the following error:

[debug] invalid value systemd-nspawn for field VMTYPE for section VIRTUALMACHINES

image

I am using glpi-agent 1.3, adding the file SystemdNspawn.pm and updating Vmsystem.pm.

All the best

g-bougard commented 2 years ago

Hi @alexmicontini thank you I missed that. You should edit the GLPI/Agent/Inventory.pm file and remove l.116 which is no more required for just released v1.0.2 GLPI version.

alexmicontini commented 2 years ago

Hi @g-bougard , Thanks a lot.

g-bougard commented 2 years ago

@alexmicontini As GLPI 1.0.2 has been released, I merged the feature as GLPI 1.0.2 can now support systemd-nspawn as virtualization type.

You will be able to use this feature with next nightly.

alexmicontini commented 2 years ago

Hi @g-bougard ,

It's amazing, thank you very much again.

Cheers.