OCSInventory-ocsreports
OCSInventory-ocsreports copied to clipboard
[BUG] "single" duplicate entries
OCS Inventory version Version : 2.9.2
Describe the bug Sometimes we get duplicated computers, but after merging, one entry remains. As you can see from this image, OCSInventory reports a duplicated MAC + serialnumber, but there is only one entry.
Thus, it's not possible to merge it with anything.
Hi, I have the same problem:
I figered out that in the table networks, in the column MACADDR there are duplicates values:
But the duplicate Hardware_ID doesn't exist in hardware table:
So, for some reason, in any time that I deleted a computer, or merged a duplicate computer, theses values or rows didn't delete.
After I delete manually these wrong duplicate values/entries where the HARDWARE_ID doesn't exist in hardware table (in my case the ID 10186), the single duplicate entry dissapeared.
Hi @jackburton79,
There might be remaining entries from a deleted device in some of the tables linked to the duplicates.
This query will give you the hardware_ids no longer linked to any device within the hardware table.
SELECT networks.HARDWARE_ID FROM networks LEFT JOIN hardware ON networks.HARDWARE_ID = hardware.ID WHERE hardware.ID IS NULL;
And the following one will return a list of queries to clean every table from these deleted devices (replace HID with the list of IDs returned by the precedent statement and ocsweb with your database name.):
SELECT CONCAT('DELETE FROM ',TABLE_NAME," WHERE hardware_id IN (HID, HID);") FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = 'ocsweb' AND COLUMN_NAME='hardware_id';
Could you try this and check if you still get single duplicates ?
Regards, Léa
I added a distinct because there were duplicate records in the result. Anyway:
SELECT distinct networks.HARDWARE_ID FROM networks LEFT JOIN hardware ON networks.HARDWARE_ID = hardware.ID WHERE hardware.ID IS NULL;
HARDWARE_ID 989 3511 3662 3793 3848
Executed the queries to delete records. No longer get single duplicates. Will see what happens next time I get a duplicate. Thanks for now.
Hi @jackburton79,
If you updated your OCS from an older version, these hardware IDs might date back to the previous version. Improvements have been made to the way a computer is deleted from OCS in the latest releases. Given that, I'll close this issue for now but feel free to open another one if you find out that the problem is still happening and we'll look more into it.
Regards, Léa