glpi-project / glpi-agent

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

Linux network inventory don't work anymore #554

Closed mayasd closed 6 months ago

mayasd commented 6 months ago

Bug reporting acknowledgment

Yes, I read it

Professional support

None

Describe the bug

Hello,

Computer network information no longer inventoried in GLPI. When I execute glpi-agent I got this error:

[debug] Running GLPI::Agent::Task::Inventory::Linux::Networks Odd number of elements in hash assignment at /usr/share/glpi-agent/lib/GLPI/Agent/Tools/Linux.pm line 739.

To reproduce

  1. Execute glpi-agent

Expected behavior

Computer network information should be visible in GLPI

Operating system

Linux

GLPI Agent version

1.6.1

GLPI version

10.0.10

GLPIInventory plugin or FusionInventory for GLPI plugin version

GLPI Inventory v1.3.3

Additional context

No response

Creteil commented 6 months ago

I always build package by myself, Bug was introduced between...

Not working (f1bcf717f) :

GLPI Agent (1.6.1-55-gf1bcf717f)
Built by Debian
Source time: 2023-12-15 10:38

and

Working (6961b4c7f) :

GLPI Agent (1.6.1-47-g6961b4c7f)
Built by Debian
Source time: 2023-12-14 08:56

Hope it help...

g-bougard commented 6 months ago

Hi @mayasd

thank you for your report.

To me, nothing related to linux network inventory has been changed between these two commits.

Anyway, this doesn't mean something may have changed on your computer which may trigger that problem.

The related function is intended to parse the output of the following command, can you run it yourself on platform and share the result ?

/sbin/ip -o route list default
Creteil commented 6 months ago
default via 10.106.133.33 dev ens192 onlink 
10.106.133.32/27 dev ens192 proto kernel scope link src 10.106.133.48 
g-bougard commented 6 months ago

Hi @mayasd @Creteil thank you for the sharing, this helped me to add a dedicated unittest and fix the default ip route parsing. Next nightly will include the fix for this issue.

mayasd commented 6 months ago

Wow that was fast ! :rocket: Thank you

Creteil commented 6 months ago

Hi @g-bougard,

You are true, the error message doesn't have to do with the computer network information no longer inventoried in GLPI.

I have reach this issue by searching « Odd number of elements in hash assignment at /usr/share/glpi-agent/lib/GLPI/Agent/Tools/Linux.pm line 739. » error since my last « git pull » of the client.

Then looking on my « GLPI » server I have focused on this part (green square) for the current computer I am working on :

Capture du 15-12-2023 à 15-18-06

Capture du 15-12-2023 à 16-04-55

By the way, is it normal the part in red square is blank ?

g-bougard commented 6 months ago

You should probably check to use "Réseau - Adresse mac" in place of "Composants - Adresse mac". I'm not sure why we can also have component mac address. GLPI may decide to create a network interface component and this is finally not a GLPI-Agent problem. @stonebuzz I'm curious, do you know when GLPI can decide to create a network interface component in the components list ?