-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Unmanaged devices: Do not override device name if it's a managed device #18766
base: 10.0/bugfixes
Are you sure you want to change the base?
Conversation
I've tried importing the supplied files several times, but I can't reproduce your problem. Everything's OK on my side No server02esxi01During import do you have GLPI errors ( Could you carry out another test by resetting the Best egards |
Hello @stonebuzz, |
Can you send me inventory file from discovery module ? |
Hello @stonebuzz, |
netdiscovery files will always be sent as XML when directly sent from a netdiscovery task toward glpi. And debug value can't change the output format. This is definitively not related. You probably missed another context problem. |
Hello @g-bougard, thank you for your response. The only flag I changed was the |
Following the review of the file generated during the
In my opinion, the issue lies in the improper use of the
We fully agree that the system can be improved in the long term. We are considering a different approach by implementing a global discovery module, not limited to SNMP devices. This module would allow for the inventory of a PC, an ESX, or a network device equipped with an SNMP module. However, at this stage, it is essential to use the discovery feature within its current capabilities: detecting and retrieving only devices that respond to the SNMP protocol. Best regards |
@stonebuzz said:
Here I must tell you I fixed an issue on agent in remoteinventory use case: glpi-project/glpi-agent@a2db0fc @eduardomozart do you use ToolBox or RemoteInventory to inventory ESX computers ? |
Ok, but it doesn't matter, it will always be seen as an |
Hello @stonebuzz, thank you for analyzing this bug further.
Please also notice that this issue is also reproduciable with IP Phone assets, not only ESX assets. @g-bougard I'm using RemoteInventory (ESX task) on server-side. When updating to GLPI-Agent 1.12 (today nightly build - |
Let's take the example of an This could represent an inconvenience for users who accept that the name changes according to the IP address (in their management of unmanaged equipment). However, even taking user experience into account, modifying GLPI's behaviour to respond to this specific case does not seem appropriate. (So far, I haven't come across a situation where a dynamic IP address was associated with an ESX via DHCP). I remain convinced that the proposed solution is not relevant. A more acceptable approach would be to configure two ranges of IP addresses to exclude the problematic IP. We're still thinking about integrating IP address exclusion management into IP ranges in a future version of the global discovery module. |
I would be more inclined to validate a PR that would allow the GLPIInventory plugin to exclude IPs from the IP Range definition. |
Hello @stonebuzz,
Please note that those verifications supports IPv4/IPv6 addresses. Here's some output examples of the changes introduced in this PR:
Scenario 1 (KEEP THE CURRENT BEHAVIOR): fields:name (current asset name) is an IP address, the val:name (new asset name) is also an IP address, so both are valid IP addresses and the asset will be renamed from
Scenario 2 (NEW BEHAVIOR): Now in this scenario a previous ESXi task renamed the asset to
Scenario 3 (KEEP THE CURRENT BEHAVIOR): Here we have a scenario where an Unix agent runs a NetDiscovery task. On Unix, it seems to be able to use reverse DNS queries (I pretend to implement it on GLPI-Agent for Windows too) and was able to resolve "192.168.0.9" to it's name ("esxi01.example.com"). In this case, both names aren't valid IP addresses, so it will keep the current behavior and will replace the current asset name (esxi01) by "esxi01.example.com", keeping the current behavior. If the user renamed the device and it changed it's NetBIOS/DNS name, it guarantees that even unmanaged devices or agentless devices reflect those changes, keeping the current behavior. It also believe that it's possible to create GLPI rules for users that didn't want to use the full DNS registry name (scenario 3) using RegEx, so GLPI could split the ".example.com" part of the discovered device name. It's not a perfect solution for me, as I believe that managed assets should have their name updated only by NetInventory or Inventory tasks, so the "esxi01" host wouldn't be updated to "esxi01.example.com" by NetDiscovery task as it is today. I believe that information gathered from "NetDiscovery" module isn't trustworthy for Managed devices since it can return a name from other device (e.g. device got an IP from other device that was using that same IP address DHCP lease in the past), but I can see it's utility for inventoring agentless/non-SNMP network devices, so I believe this PR is a win-win situation for everyone. |
Checklist before requesting a review
Please delete options that are not relevant.
Description
(This is a continuation of Check if MAC address exists before assume it's an Unmanaged device #17506)
A MAC address should be unique. When running a NetDiscovery task, it may create a new Unmanaged asset with a MAC address that already exists on GLPI, which can lead to duplicate MAC addresses on NetworkPort DB table, so before assuming it's an Unmanaged device, check if there's any item on DB that matches this MAC address. It would be great if GLPI implements an option to cleanup orphans/unmanaged devices from time to time as seen in: https://github.com/glpi-project/glpi-inventory-plugin/blob/e8cd779e0449ab4d402774e39a22f84b69317f3b/hook.php#L357
Here's the output of the affected 'Unmanaged device' asset import:
This fix simplies unset the
[name]
attribute of an unmanaged asset if it's already imported (aka. is a managed asset).Here's the inventory files as requested by @stonebuzz:
esxi01.json
server02.json
Screenshots (if appropriate):