OCSInventory-NG / OCSInventory-Server

Communication server of OCS Inventory
http://www.ocsinventory-ng.org/
GNU General Public License v2.0
344 stars 139 forks source link

Automerge duplicate not working #347

Closed Gelogo closed 2 years ago

Gelogo commented 3 years ago

It's hard to solve a problem when important details are missing, that why we added this template, to help you and us.

General informations

Operating system : CentOS 7.9.2009 (Core)

Server informations

Perl version : 5.16.3 Mysql / Mariadb / Percona version : MariaDB 10.5.12

OCS Inventory informations

Ocs server version : 2.9.1

Problem's description

Describe your problem here Apparently from nothing my automerge configuration not working anymore. No server update or configuration changes in previous days, just started to ignore the settings.

Reading about this problem: I removed the TRACE_DELETED option (activated while testing GLPI but not needed anymore), changed the automerge setting from "hostname" to "hostname+serial"; but none of this helped. Restarted web server, restarted DB (thinking about table locks), restarted whole server.

Activity log shows:

Wed Sep  8 10:13:10 2021;19845;326;Bxxxx2-2021-09-08-10-10-27;10.10.35.98;OCS-NG_WINDOWS_AGENT_v2.8.0.0;duplicate;Bxxxx2-2021-08-26-10-00-21
Wed Sep  8 10:13:10 2021;19845;513;Bxxxx2-2021-09-08-10-10-27;10.10.35.98;OCS-NG_WINDOWS_AGENT_v2.8.0.0;duplicate;old deviceid
Wed Sep  8 10:13:11 2021;19845;517;Bxxxx2-2021-09-08-10-10-27;10.10.35.98;OCS-NG_WINDOWS_AGENT_v2.8.0.0;duplicate;replacing_error

Actually i find 600+ duplicate everyday and not 100% of contact will become a duplicate. Can't find any difference between the pcs that works and the ones who don't.

tyvm

Gelogo commented 2 years ago

Update: After enabled OPT_DBI_PRINT_ERROR = 1, for some other reason, I noticed some of this errors in httpd/error_log:

DBD::mysql::db do failed: Table 'ocsweb.listprinters' doesn't exist at /usr/share/perl5/vendor_perl/Apache/Ocsinventory/Server/Duplicate.pm line 268.
DBD::mysql::db do failed: Table 'ocsweb.winusers' doesn't exist at /usr/share/perl5/vendor_perl/Apache/Ocsinventory/Server/Duplicate.pm line 268.

After removing this 2 extensions, the client prolog still tries to insert data inside that tables, but by removing extension the tables were dropped.

My solution was to recreate the tables empty and let clients filling them when they have to. Probably the local client inventory (last_state if I'm not wrong) still contains data from removed plugins and every prolog this a sent back to server. The real solution might be to ignore this data if the server extension is removed or clear the local inventory if the plugin is removed.

o/