Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLPI 10.0.17 does not record the IP of the VMs collected with the ESX task. #839

Open
alexmicontini opened this issue Jan 27, 2025 · 13 comments
Labels
bug Something isn't working

Comments

@alexmicontini
Copy link

Bug reporting acknowledgment

Yes, I read it

Professional support

None

Describe the bug

Hi @g-bougard,

with version 1.12 of the agent and version 10.0.17 of glpi, the agent obtains the IP address and operating system of the virtual machines hosted on the VCenter server, GLPI registers the operating system in the VMs but not the IP address, the field remains empty.

GLPI 10.0.17 is assumed to support the v1.1.36 inventory format scheme. Is there something to configure in GLPI?

LOG GLPI AGENT

Image

GLPI 10.0.17

Image

Greetings

To reproduce

  1. I execute the agent
  2. I notice that the agent obtains the IP and the operating system.
  3. I check GLPI 10.0.17 for the IP of the VMs collected from VCenter and it is not displayed. However, the Operating System is shown.

Expected behavior

Register the IP in GLPI.

Operating system

Linux

GLPI Agent version

v1.12

GLPI version

10.0.17

GLPIInventory plugin or other plugin version

GLPI Inventory v1.4.0

Additional context

No response

@alexmicontini alexmicontini added the bug Something isn't working label Jan 27, 2025
@eduardomozart
Copy link
Contributor

eduardomozart commented Jan 27, 2025

If the agent obtains the IP address of the VM you should report it into GLPI bugtracker instead. I believe it will be declined since it seems a feature request instead of a bug report, since I don't think this feature exists on GLPI UI before and it's not available on the GLPI 10.0.18 nightly build, so you would need to implement it on your own if you don't have a TecLib' subscription.

@alexmicontini
Copy link
Author

alexmicontini commented Jan 27, 2025

Hi @eduardomozart,

yes, but in the changes brought by version 1.12 of the glpi agent it is indicated that the format is compatible with version 10.0.17 of GLPI.

esx:
Support reporting of ESX virtualmachines ip and operating system. It requires inventory_format schema v1.1.36 on server-side included in GLPI v10.0.17.

It doesn't make much sense to have functionality that you can't take advantage of.

@g-bougard
Copy link
Member

Hi @alexmicontini

as said here, the feature also requires an option in GLPI to be enabled.

As you answered here, you have enabled it, so it seems this is maybe a GLPI server problem.

But you're also telling you still run inventory locally in VM or containers. So you may have a concurrency between local inventory and this feature. You must also know remote inventory of vm generated by RemoteInventory task will be considered as local inventory in GLPI. And this is normal are they were made running checks into the OS system itself. This means such kind of inventory will also be concurrent to the feature. I really don't know how concurrency between this feature and local inventory import can perform, and I won't be surprised if this generates side-effect issues. Generally, I won't advise to use this feature if you also generates local inventories from VMs. You should better choose between running local inventory and use this feature.

Another point, you are showing a screenshot where you expect to see the ip if column, but sorry, I don't understand that language, so I can't confirm you if the ip should be seen in that column. Can you translate the column name into english ?

@alexmicontini
Copy link
Author

Hi @g-bougard,

I am clear that performing a local inventory and having the "Create computer for virtual machines" option enabled can be a problem. In my case I will do local inventory later, it is not possible for now, in the meantime I at least wanted to do the inventory for the ESX task. With version 1.11 of the agent it did not obtain from the ESX task either the Operating System or the IP of the VMs. Now with v1.12 I get both the O.S. as the IP, but in GLPI the IP is not registered, however the O.S. is registered.

I think it is because to register the IP it is necessary to associate it with a network interface and that is not obtained by the VCenter ESX task.

Image

Image

@g-bougard
Copy link
Member

Okay, this reminded me there was a PR from @stonebuzz which has still been merged in GLPI but will only be available in next release and this PR should probably fix your problem.

Here's the PR: glpi-project/glpi#18746

You can try to apply on your server the changes on src/Inventory/Asset/InventoryNetworkPort.php from this PR.

@alexmicontini
Copy link
Author

Hi @g-bougard,

I applied the patch but it did not solve the problem, GLPI does not record the IP address of the VCenter VMs collected with the ESX task with the glpi v1.2 agent, although the agent does collect it.

I think it is because of what I already mentioned, an IP has to be associated with a network interface but the ESX task does not obtain it from the VM, so it is not created in GLPI.

LOG GLPI AGENT
Image

GLPI
Image

@g-bougard
Copy link
Member

Hi @alexmicontini

do you have any error that could be related in the GLPI php-warnings.log file ?

Do you see the ip as management ip on computer network ports tab in GLPI ? This may just be an UI issue where the expected ip doesn't appear in the search results but it does in the network ports.

@alexmicontini
Copy link
Author

Hi @g-bougard,

in php-errors.log, this error repeats when I run the glpi agent:

Image

[2025-01-31 11:50:41] glpiphplog.WARNING: *** PHP Warning (2): Undefined array key "operatingsystems_id" in /var/www/html/glpi/src/Inventory/Asset/OperatingSystem.php at line 184
Backtrace :
src/Inventory/Asset/VirtualMachine.php:357 Glpi\Inventory\Asset\OperatingSystem->handle()
src/Inventory/Asset/VirtualMachine.php:278 Glpi\Inventory\Asset\VirtualMachine->createVmComputer()
src/Inventory/Asset/MainAsset.php:998 Glpi\Inventory\Asset\VirtualMachine->handle()
src/Inventory/Asset/MainAsset.php:913 Glpi\Inventory\Asset\MainAsset->handleAssets()
src/RuleImportAsset.php:974 Glpi\Inventory\Asset\MainAsset->rulepassed()
src/Rule.php:1537 RuleImportAsset->executeActions()
src/RuleCollection.php:1660 Rule->process()
src/Inventory/Asset/MainAsset.php:577 RuleCollection->processAllRules()
src/Inventory/Inventory.php:726 Glpi\Inventory\Asset\MainAsset->handle()
src/Inventory/Inventory.php:357 Glpi\Inventory\Inventory->handleItem()
src/Inventory/Request.php:364 Glpi\Inventory\Inventory->doInventory()
src/Inventory/Request.php:90 Glpi\Inventory\Request->inventory()
src/Agent/Communication/AbstractRequest.php:359 Glpi\Inventory\Request->handleAction()
src/Agent/Communication/AbstractRequest.php:271 Glpi\Agent\Communication\AbstractRequest->handleJSONRequest()
front/inventory.php:99 Glpi\Agent\Communication\AbstractRequest->handleRequest()
...tplace/glpiinventory/front/communication.php:72 include_once()
marketplace/glpiinventory/index.php:45 include_once()
public/index.php:82 require()

No network interface is created in GLPI

Image

@stonebuzz
Copy link

Hi @alexmicontini

would you have a dictionary rule that would change the OS name?

Check that you don't have an inconsistent rule (assign N/A)

Best regards

@alexmicontini
Copy link
Author

Hi @stonebuzz,

I don't have any dictionary rules, it is from a default installation of glpi with no additional rules configured.

Image

Best regards

@stonebuzz
Copy link

Can you post here related inventory file ?

@alexmicontini
Copy link
Author

Hi @stonebuzz,

I cannot send the inventory files because they have confidential information. I send you an extract where a VM appears with the Operating System and the IP address.

Image

@eduardomozart
Copy link
Contributor

Hello guys,
Since I also use ESXi into my homelab I decided to provide my inventory files to help to troubleshoot this issue, as I was able to reproduce it:

Image

Here I opened the UniFi OS Console machine, no IP is shown:

Image

Also find an odd behavior, as ESX inventory seems to create a new machine instead of updating the existing one:

Image

I believe it happens because the GLPI Agent is nativelly installed into server02 VM, but I don't think that should happen. I'll try to troubleshoot that last issue further.

Here's my inventory files:

server02-agentless-esx-inventory.json
server02-with-glpi-agent.json
esxi01.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants