Closed AldarisPale closed 1 year ago
If it helps this is visible in GLPI 9.x:
Try with GLPI latest release, several fixes has been made on inventory part.
@trasher sorry, I mistyped before. GLPI version is 10.0.9, not 10.0.7 as I indicated when I created the ticket. As I understand, 10.0.9 is the current latest version.
I've updated the bug report to show 10.0.9 instead of 10.0.7 as it was previously.
Could you check if other fields are impacted? Many information were stored in glpi_plugin_fusioninventory_networkports
and are now in glpi_networkports
; goal is to know if the whole update is failing or if it's limited to mac only; the update code of the plugin is a real nightmare, I do not see what would be wrong reading it...
MAC address seems to be the only field which gets blanked. I've confirmed that the following fields remain intact:
This is the output when install glpiinventory plugin from console.
Processing plugin "glpiinventory"...
SQL Warnings:
1831: Duplicate index 'plugin_glpiinventory_timeslots_id' defined on the table 'glpi.glpi_plugin_glpiinventory_timeslotentries'. This is deprecated and will be disallowed in a future release. in query "ALTER TABLE `glpi_plugin_glpiinventory_timeslotentries` CHANGE `plugin_fusioninventory_timeslots_id`
`plugin_glpiinventory_timeslots_id` int unsigned NOT NULL DEFAULT 0 , ADD INDEX `plugin_glpiinventory_timeslots_id`
(`plugin_glpiinventory_timeslots_id`) "
SQL Warnings:
1831: Duplicate index 'last_inventory_update' defined on the table 'glpi.glpi_plugin_glpiinventory_inventorycomputercomputers'. This is deprecated and will be disallowed in a future release.
in query "ALTER TABLE `glpi_plugin_glpiinventory_inventorycomputercomputers` ADD INDEX `last_inventory_update` (`last_inventory_update`) "
SQL Warnings:
1831: Duplicate index 'agents_id_state' defined on the table 'glpi.glpi_plugin_glpiinventory_taskjobstates'. This is deprecated and will be disallowed in a future release.
1831: Duplicate index 'plugin_glpiinventory_agents_items_states' defined on the table 'glpi.glpi_plugin_glpiinventory_taskjobstates'. This is deprecated and will be disallowed in a future release.
in query "ALTER TABLE `glpi_plugin_glpiinventory_taskjobstates` ADD INDEX `agents_id_state` (`agents_id`, `state`) ,
ADD INDEX `plugin_glpiinventory_agents_items_states` (`agents_id`, `plugin_glpiinventory_taskjobs_id`, `items_id`, `itemtype`, `id`, `state`) "
Plugin "glpiinventory" has been installed and can be activated.
OK, that's strange because all migrations should be done in one query :/ I'll be off few weeks, I'll take a look when I'll be back.
Many information were stored in
glpi_plugin_fusioninventory_networkports
and are now inglpi_networkports
Thanks for the tip, @trasher . For reasons unknown it looks like if I drop table glpi_plugin_fusioninventory_networkports
before installing the glpiinventory plugin, the MAC addresses will remain intact.
Before installing glpiinventory plugin:
select count(*) from glpi_plugin_fusioninventory_networkports;
+----------+
| count(*) |
+----------+
| 54 |
+----------+
select count(*) from glpi_networkports;
+----------+
| count(*) |
+----------+
| 12465 |
+----------+
Hey, @trasher . Hope your time-off went superbly! What should the correct solution be in this case? Dropping the table manually looks very hackish and might break some other things I did not notice yet.
Hi @AldarisPale
can you check if MAC
address is set from glpi_networkports
and not from glpi_plugins_fusioninventory_networkports
before migrating to the glpiinventory
plugin
I suspect that the MAC
column is empty in the glpi_plugin_fusioninventory_networkports
table and set from glpi_networkports
.
when managing network ports, we 'simply' update the glpi_networkports
table from the glpi_plugin_glpiinventory_networkports
table (formerly glpi_plugin_fusioninventory_networkports
)
$migration->displayMessage("Use core network ports");
if ($DB->tableExists('glpi_plugin_glpiinventory_networkports')) {
$DB->queryOrDie(
"UPDATE `glpi_networkports` AS `ports`
INNER JOIN (
SELECT
`networkports_id`,
`ifmtu`,
`ifspeed`,
`ifinternalstatus`,
`ifconnectionstatus`,
`iflastchange`,
`ifinoctets`,
`ifinerrors`,
`ifoutoctets`,
`ifouterrors`,
`ifstatus`,
`mac`,
`ifdescr`,
`ifalias`,
`portduplex`,
`trunk`,
`lastup`
FROM `glpi_plugin_glpiinventory_networkports`
) AS `plugin_ports` ON `plugin_ports`.`networkports_id` = `ports`.`id`
SET
`ports`.`ifmtu` = `plugin_ports`.`ifmtu`,
`ports`.`ifspeed` = `plugin_ports`.`ifspeed`,
`ports`.`ifinternalstatus` = `plugin_ports`.`ifinternalstatus`,
`ports`.`ifconnectionstatus` = `plugin_ports`.`ifconnectionstatus`,
`ports`.`iflastchange` = `plugin_ports`.`iflastchange`,
`ports`.`ifinbytes` = `plugin_ports`.`ifinoctets`,
`ports`.`ifinerrors` = `plugin_ports`.`ifinerrors`,
`ports`.`ifoutbytes` = `plugin_ports`.`ifoutoctets`,
`ports`.`ifouterrors` = `plugin_ports`.`ifouterrors`,
`ports`.`ifstatus` = `plugin_ports`.`ifstatus`,
`ports`.`mac` = `plugin_ports`.`mac`,
`ports`.`ifdescr` = `plugin_ports`.`ifdescr`,
`ports`.`ifalias` = `plugin_ports`.`ifalias`,
`ports`.`portduplex` = `plugin_ports`.`portduplex`,
`ports`.`trunk` = `plugin_ports`.`trunk`,
`ports`.`lastup` = `plugin_ports`.`lastup`
;"
);
$migration->dropTable('glpi_plugin_glpiinventory_networkports');
}
Best regards
@stonebuzz this seems to be the case.
Before migration, glpi_plugin_fusioninventory_networkports
contains 54 rows. Only columns id,networkports_id
seem to contain actual information, rest of the column's values are either 0
or <null>
.
I wonder what and why populates/populated glpi_plugin_fusioninventory_networkports
in the first place.
After taking a look, glpi_plugin_fusioninventory_networkports
seems to be populated when a network port has been defined manually in GLPI.
I wonder what would be the way forward. Ports were defined manually for a reason - to record used IP and MAC addresses for equipment for which automatic inventory is impossible. This information is being used downstream by network security devices.
I think we're in a special case
can you "just" delete the following lines (to prevent overwrite the MAC with an empty value)
File : glpiinventory/install/update.native.php
Line : 262 and 281
and retry
@stonebuzz that seems to do the trick.
Nice.
As this is the first time I've heard of this problem and it would seem "logical" that manually added data should replace dynamic data
I don't know if we need to fix something in the data migration (FusionInventyory -> core)
If the problem persists or if it becomes a nuisance for the community, we'll think about a more permanent solution.
Sincerely
Describe the bug
MAC address disappears from networkport after installing glpiinventory plugin on GLPI 10.x after migrating from GLPI 9.x with fusioninventory plugin.
To reproduce
Expected behavior
MAC address should be still there
Operating system
Other (See additional context below)
GLPI Agent version
Other (See additional context below)
GLPI version
10.0.9
GLPIInventory plugin
Other (See additional context below)
Additional context
Affected glpiinventory plugin is 1.2.3. No idea if previous versions are affected as well.