ocsinventoryng
ocsinventoryng copied to clipboard
Unable to import computers on GLPI 10.0.2
Hello everyone.
I'm experiencing problems when importing new computers to GLPI. The plugin shows the computers correctly, but when i click on import it freezes and never finishes.
Versions:
-OCS reports: 2.9.2
-OCS plugin: 2.0.1
-GLPI: 10.0.2
Steps to reproduce:
In GLPI go to Tools -> OCS Inventory NG -> Inventory Import -> Import or link new computers
.
Then add any computer that you want and press on the yellow buttom on the bottom left corner of the screen: Import or link new computers
.
You should now see the following screen forever:
The following logs are present in glpi/files/_log/php-errors.log
[2022-08-12 11:09:09] glpiphplog.WARNING: *** PHP Warning (2): mysqli::real_connect(): (HY000/2002): No such file or directory in /var/www/html/glpi/plugins/ocsinventoryng/inc/dbocs.class.php at line 96
Backtrace :
plugins/ocsinventoryng/inc/dbocs.class.php:96 mysqli->real_connect()
plugins/ocsinventoryng/inc/dbocs.class.php:55 PluginOcsinventoryngDBocs->connect()
...ins/ocsinventoryng/inc/ocsdbclient.class.php:52 PluginOcsinventoryngDBocs->__construct()
...ins/ocsinventoryng/inc/ocsserver.class.php:1907 PluginOcsinventoryngOcsDbClient->__construct()
plugins/ocsinventoryng/hook.php:1365 PluginOcsinventoryngOcsServer::getDBocs()
src/Plugin.php:1550 plugin_ocsinventoryng_ruleCollectionPrepareInputDataForProcess()
src/RuleCollection.php:1772 Plugin::doOneHook()
src/RuleCollection.php:1579 RuleCollection->prepareInputDataForProcessWithPlugins()
...ins/ocsinventoryng/inc/ocsprocess.class.php:526 RuleCollection->processAllRules()
...ins/ocsinventoryng/inc/ocsprocess.class.php:482 PluginOcsinventoryngOcsProcess::importComputer()
plugins/ocsinventoryng/front/ocsng.import.php:107 PluginOcsinventoryngOcsProcess::processComputer()
[2022-08-12 11:09:09] glpiphplog.WARNING: *** PHP Warning (2): mysqli::real_escape_string(): invalid object or resource mysqli
in /var/www/html/glpi/src/DBmysql.php at line 333
Backtrace :
src/DBmysql.php:333 mysqli->real_escape_string()
...s/ocsinventoryng/inc/ocsdbclient.class.php:1103 DBmysql->escape()
...ins/ocsinventoryng/inc/ocsdbclient.class.php:77 PluginOcsinventoryngOcsDbClient->getConfig()
plugins/ocsinventoryng/inc/ocsclient.class.php:298 PluginOcsinventoryngOcsDbClient->getComputerRule()
plugins/ocsinventoryng/hook.php:1370 PluginOcsinventoryngOcsClient->getOcsComputer()
src/Plugin.php:1550 plugin_ocsinventoryng_ruleCollectionPrepareInputDataForProcess()
src/RuleCollection.php:1772 Plugin::doOneHook()
src/RuleCollection.php:1579 RuleCollection->prepareInputDataForProcessWithPlugins()
...ins/ocsinventoryng/inc/ocsprocess.class.php:526 RuleCollection->processAllRules()
...ins/ocsinventoryng/inc/ocsprocess.class.php:482 PluginOcsinventoryngOcsProcess::importComputer()
plugins/ocsinventoryng/front/ocsng.import.php:107 PluginOcsinventoryngOcsProcess::processComputer()
[2022-08-12 11:09:09] glpiphplog.WARNING: *** PHP Warning (2): mysqli::query(): invalid object or resource mysqli
in /var/www/html/glpi/src/DBmysql.php at line 363
Backtrace :
src/DBmysql.php:363 mysqli->query()
...s/ocsinventoryng/inc/ocsdbclient.class.php:1104 DBmysql->query()
...ins/ocsinventoryng/inc/ocsdbclient.class.php:77 PluginOcsinventoryngOcsDbClient->getConfig()
plugins/ocsinventoryng/inc/ocsclient.class.php:298 PluginOcsinventoryngOcsDbClient->getComputerRule()
plugins/ocsinventoryng/hook.php:1370 PluginOcsinventoryngOcsClient->getOcsComputer()
src/Plugin.php:1550 plugin_ocsinventoryng_ruleCollectionPrepareInputDataForProcess()
src/RuleCollection.php:1772 Plugin::doOneHook()
src/RuleCollection.php:1579 RuleCollection->prepareInputDataForProcessWithPlugins()
...ins/ocsinventoryng/inc/ocsprocess.class.php:526 RuleCollection->processAllRules()
...ins/ocsinventoryng/inc/ocsprocess.class.php:482 PluginOcsinventoryngOcsProcess::importComputer()
plugins/ocsinventoryng/front/ocsng.import.php:107 PluginOcsinventoryngOcsProcess::processComputer()
[2022-08-12 11:09:09] glpiphplog.WARNING: *** PHP Warning (2): DBmysql::fetchQueryWarnings(): Property access is not allowed yet in /var/www/html/glpi/src/DBmysql.php at line 1897
Backtrace :
src/DBmysql.php:385 DBmysql->fetchQueryWarnings()
...s/ocsinventoryng/inc/ocsdbclient.class.php:1104 DBmysql->query()
...ins/ocsinventoryng/inc/ocsdbclient.class.php:77 PluginOcsinventoryngOcsDbClient->getConfig()
plugins/ocsinventoryng/inc/ocsclient.class.php:298 PluginOcsinventoryngOcsDbClient->getComputerRule()
plugins/ocsinventoryng/hook.php:1370 PluginOcsinventoryngOcsClient->getOcsComputer()
src/Plugin.php:1550 plugin_ocsinventoryng_ruleCollectionPrepareInputDataForProcess()
src/RuleCollection.php:1772 Plugin::doOneHook()
src/RuleCollection.php:1579 RuleCollection->prepareInputDataForProcessWithPlugins()
...ins/ocsinventoryng/inc/ocsprocess.class.php:526 RuleCollection->processAllRules()
...ins/ocsinventoryng/inc/ocsprocess.class.php:482 PluginOcsinventoryngOcsProcess::importComputer()
plugins/ocsinventoryng/front/ocsng.import.php:107 PluginOcsinventoryngOcsProcess::processComputer()
[2022-08-12 11:09:09] glpiphplog.WARNING: *** PHP Warning (2): mysqli::query(): invalid object or resource mysqli
in /var/www/html/glpi/src/DBmysql.php at line 363
Backtrace :
src/DBmysql.php:363 mysqli->query()
...ins/ocsinventoryng/inc/ocsdbclient.class.php:88 DBmysql->query()
plugins/ocsinventoryng/inc/ocsclient.class.php:298 PluginOcsinventoryngOcsDbClient->getComputerRule()
plugins/ocsinventoryng/hook.php:1370 PluginOcsinventoryngOcsClient->getOcsComputer()
src/Plugin.php:1550 plugin_ocsinventoryng_ruleCollectionPrepareInputDataForProcess()
src/RuleCollection.php:1772 Plugin::doOneHook()
src/RuleCollection.php:1579 RuleCollection->prepareInputDataForProcessWithPlugins()
...ins/ocsinventoryng/inc/ocsprocess.class.php:526 RuleCollection->processAllRules()
...ins/ocsinventoryng/inc/ocsprocess.class.php:482 PluginOcsinventoryngOcsProcess::importComputer()
plugins/ocsinventoryng/front/ocsng.import.php:107 PluginOcsinventoryngOcsProcess::processComputer()
[2022-08-12 11:09:09] glpiphplog.WARNING: *** PHP Warning (2): DBmysql::fetchQueryWarnings(): Property access is not allowed yet in /var/www/html/glpi/src/DBmysql.php at line 1897
Backtrace :
src/DBmysql.php:385 DBmysql->fetchQueryWarnings()
...ins/ocsinventoryng/inc/ocsdbclient.class.php:88 DBmysql->query()
plugins/ocsinventoryng/inc/ocsclient.class.php:298 PluginOcsinventoryngOcsDbClient->getComputerRule()
plugins/ocsinventoryng/hook.php:1370 PluginOcsinventoryngOcsClient->getOcsComputer()
src/Plugin.php:1550 plugin_ocsinventoryng_ruleCollectionPrepareInputDataForProcess()
src/RuleCollection.php:1772 Plugin::doOneHook()
src/RuleCollection.php:1579 RuleCollection->prepareInputDataForProcessWithPlugins()
...ins/ocsinventoryng/inc/ocsprocess.class.php:526 RuleCollection->processAllRules()
...ins/ocsinventoryng/inc/ocsprocess.class.php:482 PluginOcsinventoryngOcsProcess::importComputer()
plugins/ocsinventoryng/front/ocsng.import.php:107 PluginOcsinventoryngOcsProcess::processComputer()
[2022-08-12 11:09:09] glpiphplog.CRITICAL: *** Uncaught Exception Error: Call to a member function fetch_assoc() on bool in /var/www/html/glpi/src/DBmysql.php at line 548
Backtrace :
...ins/ocsinventoryng/inc/ocsdbclient.class.php:89 DBmysql->fetchAssoc()
plugins/ocsinventoryng/inc/ocsclient.class.php:298 PluginOcsinventoryngOcsDbClient->getComputerRule()
plugins/ocsinventoryng/hook.php:1370 PluginOcsinventoryngOcsClient->getOcsComputer()
src/Plugin.php:1550 plugin_ocsinventoryng_ruleCollectionPrepareInputDataForProcess()
src/RuleCollection.php:1772 Plugin::doOneHook()
src/RuleCollection.php:1579 RuleCollection->prepareInputDataForProcessWithPlugins()
...ins/ocsinventoryng/inc/ocsprocess.class.php:526 RuleCollection->processAllRules()
...ins/ocsinventoryng/inc/ocsprocess.class.php:482 PluginOcsinventoryngOcsProcess::importComputer()
plugins/ocsinventoryng/front/ocsng.import.php:107 PluginOcsinventoryngOcsProcess::processComputer()
same here with same versions
@decodevelop I'm afraid support for this plugin is in dire straits.
Hello everyone,
After further investigation, I find out a way to make the plugin work again in this configuration. Turns out it was the old ocsngplugin database shema in glpi database that was causing issues.
You need to : Before : make a backup of your glpi files and database (juste in case)
- drop any OCSinventoryNG related table in glpi database, anything that look like (glpi_plugin_ocsinventoryng_*)
- deactivate and uninstall the ocsng plugin (if it fail, temporarily increase the php max execution time to 240 )
- clean the ocs ng plugin from the plugin page on GLPI
- re-download and re-install the plugin from the market place
- Put back your OCSinventoryNG server config in the plugin config
regards, TTAK
Please try with master version ? https://github.com/pluginsGLPI/ocsinventoryng/archive/refs/heads/master.zip