glpi-project / glpi-agent

GLPI Agent
GNU General Public License v2.0
212 stars 51 forks source link

Windows remote inventory hangs on registry entry and never finishes #654

Closed GuidoWilden closed 2 months ago

GuidoWilden commented 2 months ago

Bug reporting acknowledgment

Yes, I read it

Professional support

None

Describe the bug

Run glpi-remote on a Windows 10 machine the inventory never finishes for us. It gets some part of the way but then hangs on Looking for HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Office registry key subkeys via winrm

To reproduce

Run glpi-remote on a Windows 10 machine

Expected behavior

Should finish and make a new database entry.

Operating system

Linux

GLPI Agent version

Nightly build (git version in additional context below)

GLPI version

10.0.14

GLPIInventory plugin or other plugin version

GLPI Inventory v1.3.5

Additional context

Agent nightly build v1.8-gitd493d729

GuidoWilden commented 2 months ago

Just tested with the stable build (1.7.3) and the problem remains.

g-bougard commented 2 months ago

Hi @GuidoWilden

are you sure the problem is glpi-remote ? This script can be used to register remote, but remote inventory is only run from glpi-agent RemoteInventory task.

If you indeed managed to register with glpi-remote and have the failure when running the service, can you enable debug=2 and provide the log showing the hanging up ?

GuidoWilden commented 2 months ago

Hi @g-bougard,

Please find the log attached. agent_log.txt.zip

g-bougard commented 2 months ago

Hi @GuidoWilden

okay, so the context is you're running RemoteInventory task toward a windows computer from a Ubuntu 22.04.4 LTS linux... which is itself hosted under a WSL container. Speaking about the WSL container, you probably like risks ;-)

Anyway, I think this should still work unless we discover a constraint related to the context.

As you run the agent from the command line and it hangs up. Do you finally stop the process with CTRL+C or does it fail itself after a given time ? Do you have any output on stderr ?

P.S.: Do you think you can share an export of HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Office from the remote computer if that registry key exists ?

GuidoWilden commented 2 months ago

Hi @g-bougard ,

Thank you for getting back to me. Not sure about the WSL container, the server and agent are both running on a Hyper-V VM.

I do have to Ctrl + C the agent on command line. Otherwise it won't stop (or I am too impatient to wait). The output I sent was a copy/paste of stderr. Could not get the log file right until earlier today :-D.

If its OK I will sent the export of the Registry Key to your email.

GuidoWilden commented 2 months ago

Hi @g-bougard,

Tested once more this morning just to see whether or not glpi-agent will time out by itself but after around 4 minutes the inventory completed. Guess I was just too impatient. Closing this one.

g-bougard commented 2 months ago

Thank you for this feedback,

I should check anyway if I can optimize HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Office registry requesting.

GuidoWilden commented 2 months ago

Hi @g-bougard, I thought I keep you posted on this one. On investigation I noticed that the agent run maxed out both CPU and memory on the VM (2 CPUs, 2048 MB memory). After assigning more resources to the VM (4 CPUs and 6144 MB memory) the agent run is much faster. It still is heavy on the CPUs though.