pluginsGLPI / ocsinventoryng

Plugin ocsinventoryng for GLPI
GNU General Public License v2.0
68 stars 52 forks source link

No rule assigment work for a ocs server since update to glpi 10 #326

Closed Blank-Vcf closed 1 year ago

Blank-Vcf commented 2 years ago

before: glpi 9.5.7 ocs plugin 1.7.3

have 2 ocs server, preview assignment on glpi 9.5 image

rules are easy if server ocs is > assign to this entity

upgrade to: glpi 10.2 ocs plugun 2.0.1

assignment is working well for the fisrt ocs server: image

switching to second rules doesn't match:

i have check rules > still ok ocs config plugin > still the same

i have deleted ocs conf and rules and re create fro scratch: since there is tons a machine, preview crash: image without preview i'm seeing all comp but import failed with no rules match: image

sync with command line: if I'll force with shell it doesn't care of --server_id and start sync with first server: popping tons of errors:

php ocsng_fullsync.php --server_id=2 --debug
        Thread #-1: import computers from server: 'OCS_xxxxx'
        Thread #-1: 1069 computer(s)
..PHP Deprecated function (8192): trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/src/CommonDropdown.php at line 744
PHP Deprecated:  trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/src/CommonDropdown.php on line 744
PHP Deprecated function (8192): strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/plugins/ocsinventoryng/inc/monitor.class.php at line 291
PHP Deprecated:  strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/plugins/ocsinventoryng/inc/monitor.class.php on line 291
.....PHP Deprecated function (8192): trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/src/CommonDropdown.php at line 744
PHP Deprecated:  trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/src/CommonDropdown.php on line 744
....PHP Deprecated function (8192): trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/src/CommonDropdown.php at line 744
PHP Deprecated:  trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/src/CommonDropdown.php on line 744
.......PHP Deprecated function (8192): trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/src/CommonDropdown.php at line 744
PHP Deprecated:  trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/src/CommonDropdown.php on line 744
Réseau déjà défini dans les entités visibles
Réseau déjà défini dans les entités visibles

and finally does the second:

        Thread #-1: import computers from server: 'xxx'
        Thread #-1: 2676 computer(s)
.SQL Error "1048": Column 'tag' cannot be null in query "INSERT INTO `glpi_plugin_ocsinventoryng_notimportedcomputers` (`name`, `domain`, `tag`, `ocs_deviceid`, `ipaddr`, `plugin_ocsinventoryng_ocsservers_id`, `ocsid`, `last_inventory`, `useragent`, `serial`, `reason`, `comment`, `entities_id`, `rules_id`) VALUES ('HP6200W7_TEST', 'xxx.local', NULL, 'Hxxxx7_TEST-2020-10-04-23-00-46', 'xxx..xxx.x..xx', '5', '59527', '2021-05-26 23:39:00', 'OCS-NG_WINDOWS_AGENT_v2.4.0.0', 'CZC20475RR', '3', '', '0', '[]')"
...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................PHP Deprecated function (8192): trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/src/CommonDropdown.php at line 744
PHP Deprecated:  trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/src/CommonDropdown.php on line 744
.............................................................................................................................................................................................................................

nothing is added to computer and machine still in import list

Blank-Vcf commented 2 years ago

have some error in sql like this: [2022-07-15 17:13:21] glpisqllog.ERROR: DBmysql::query() in /var/www/src/DBmysql.php line 370 *** MySQL query error: SQL: SELECT glpi_lines.id FROM glpi_lines WHERE (glpi_lines.serial = 'PC08AMUJ') Error: Unknown column 'glpi_lines.serial' in 'where clause' Backtrace : src/DBmysqlIterator.php:110
src/DBmysql.php:1048 DBmysqlIterator->execute() src/RuleImportAsset.php:540 DBmysql->request() src/Rule.php:1649 RuleImportAsset->findWithGlobalCriteria() src/Rule.php:1507 Rule->checkCriterias() src/RuleCollection.php:1591 Rule->process() ...ins/ocsinventoryng/inc/ocsprocess.class.php:580 RuleCollection->processAllRules() ...ins/ocsinventoryng/inc/ocsprocess.class.php:482 PluginOcsinventoryngOcsProcess::importComputer() ...s/ocsinventoryng/scripts/ocsng_fullsync.php:454 PluginOcsinventoryngOcsProcess::processComputer() ...s/ocsinventoryng/scripts/ocsng_fullsync.php:303 plugin_ocsinventoryng_importFromOcsServer() ...s/ocsinventoryng/scripts/ocsng_fullsync.php:185 SecondPass()

Blank-Vcf commented 1 year ago

get it to work after somme other issue same as:

329

328

322

on clone dev server after update glpi to 10.0.3 remove plugin clean db (drop ocs plugin tables) reinstall plugin from market,update hook.php to install work

      //Add template
      $query = "INSERT INTO `glpi_notificationtemplates` (id, name, itemtype,date_mod,comment,css,date_creation)
                                                                VALUES (NULL, 'Computers not imported', 'PluginOcsinventoryngNotimportedcomputer',NOW(), 'ocs', NULL,NOW());";

reconfigure ocs server + rule and import preview is working

Blank-Vcf commented 1 year ago

I was wrong finally, after cleanup prod server and reconfigure from scratch still the same problem. Also on dev, i have only try with 1 ocs server but after added the second server, rules still not match on assign to entity. same by changing rules order. the error "database table warning" should come from memory configuration ini php.ini

Blank-Vcf commented 1 year ago

i get a disgusting things to work: remove third ocs 'useless' server make first rule what come from ocs server Z go to entity Z make second rule what not come from ocs server Z assign to entity Y

by the way on ~2400 computers from ocs Y ~15 computer match first rule :S if i add tag on rule criteria no rule match 👎

tsmr commented 1 year ago

Please try with master version ? https://github.com/pluginsGLPI/ocsinventoryng/archive/refs/heads/master.zip

Blank-Vcf commented 1 year ago

seems ok, but there no more preview button image cannot check without import if entity and link with existing computer are ok. still a common problem computer are never link if it's ok in preview, it's always ending by making doublon.

tsmr commented 1 year ago

I temporarily disabled it for performance issues

tsmr commented 1 year ago

fixed in 2.0.4