pluginsGLPI / ocsinventoryng

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

Automatic sync script deleting all networkports #355

Open fgendorf opened 1 year ago

fgendorf commented 1 year ago

Hi, in the latest versions of GLPI/Plugin/OCS we have an issue that causing problems to our inventory

GLPI VERSION: 10.0.7 OCSSERVER: 2.11.1 PLUGIN: 2.0.4 PHP: 8.1.18

We saw that all interfaces networkports on synced computers became empty... If we force full import it appear again, but in next automatic sync by ocsfull_sync.sh they are deleted again, ex:

38076157 | 26-04-2023 16:52 | ocsinventoryng | Network Port | Delete an Item: Network Port (BRNB062 - WAN Miniport (PPTP) (525346))
-- | -- | -- | -- | --
38076156 | 26-04-2023 16:52 | ocsinventoryng | Network Port | Delete an Item: Network Port (BRNB062 - WAN Miniport (L2TP) (525345))
38076155 | 26-04-2023 16:52 | ocsinventoryng | Network Port | Delete an Item: Network Port (BRNB062 - WAN Miniport (IKEv2) (525344))
38076154 | 26-04-2023 16:52 | ocsinventoryng | Network Port | Delete an Item: Network Port (BRNB062 - WAN Miniport (SSTP) (525343))
38076153 | 26-04-2023 16:52 | ocsinventoryng | Network Port | Delete an Item: Network Port (BRNB062 - Microsoft Wi-Fi Direct Virtual Adapter #2 (525342))
38076152 | 26-04-2023 16:52 | ocsinventoryng | Network Port | Delete an Item: Network Port (BRNB062 - Microsoft Wi-Fi Direct Virtual Adapter (525341))
38076151 | 26-04-2023 16:52 | ocsinventoryng | Network Port | Delete an Item: Network Port (BRNB062 - Intel(R) Wi-Fi 6 AX201 160MHz (525340))
38076150 | 26-04-2023 16:52 | ocsinventoryng | Network Port | Delete an Item: Network Port (BRNB062 - Intel(R) Wi-Fi 6 AX201 160MHz (IPV6) (525339))
38076149 | 26-04-2023 16:52 | ocsinventoryng | Network Port | Delete an Item: Network Port (BRNB062 - Microsoft Wi-Fi Direct Virtual Adapter #2-WFP 802.3 MAC Layer LightWeight Filter-0000 (525338))

on _log/php-errors.log shows:

[2023-04-26 16:52:59] glpiphplog.WARNING:   *** PHP User Warning (512): Relation between "glpi_networkports" and "glpi_plugin_ocsinventoryng_networkports" table based on "networkports_id" fi
eld cannot be handled automatically as "networkports_id" also corresponds to index field of the target table. in /home/glpi/src/DbUtils.php at line 2099
  Backtrace :
  src/DbUtils.php:2099                               trigger_error()
  inc/db.function.php:585                            DbUtils->getDbRelations()
  src/CommonDBTM.php:866                             getDbRelations()
  src/CommonDBTM.php:788                             CommonDBTM->cleanRelationData()
  src/CommonDBTM.php:2064                            CommonDBTM->deleteFromDB()
  src/CommonDBTM.php:4610                            CommonDBTM->delete()
  ...ce/ocsinventoryng/inc/registrykey.class.php:100 CommonDBTM->deleteByCriteria()
  ...ace/ocsinventoryng/inc/registrykey.class.php:73 PluginOcsinventoryngRegistryKey::resetRegistry()
  ...ce/ocsinventoryng/inc/ocsprocess.class.php:1408 PluginOcsinventoryngRegistryKey::updateRegistry()
  ...ace/ocsinventoryng/inc/ocsprocess.class.php:480 PluginOcsinventoryngOcsProcess::synchronizeComputer()
  ...e/ocsinventoryng/scripts/ocsng_fullsync.php:461 PluginOcsinventoryngOcsProcess::processComputer()
  ...e/ocsinventoryng/scripts/ocsng_fullsync.php:299 plugin_ocsinventoryng_importFromOcsServer()
  ...e/ocsinventoryng/scripts/ocsng_fullsync.php:166 SecondPass()

We appreciate if have any clue to solve this bug.

Thanks in advance

laurentliesse commented 1 year ago

i have the same problem with network interfaces- delete and not create interface

jlb5980 commented 1 year ago

Hello

J'ai sensiblement la même chose avec une version vierge de glpi et le plugin ocs 2.0.4 !

[2023-05-15 12:30:01] glpiphplog.WARNING: *** PHP User Warning (512): Relation between "glpi_networkports" and "glpi_plugin_ocsinventoryng_networkports" table based on "networkports_id" field cannot be handled automatically as "networkports_id" also corresponds to index field of the target table. in /data/glpiv/src/DbUtils.php at line 2099 Backtrace : src/DbUtils.php:2099 trigger_error() inc/db.function.php:585 DbUtils->getDbRelations() src/CommonDBTM.php:866 getDbRelations() src/CommonDBTM.php:788 CommonDBTM->cleanRelationData() src/CommonDBTM.php:2064 CommonDBTM->deleteFromDB() src/CommonDBTM.php:4610 CommonDBTM->delete() plugins/pdf/inc/profile.class.php:124 CommonDBTM->deleteByCriteria() plugins/pdf/inc/profile.class.php:143 PluginPdfProfile::addDefaultProfileInfos() plugins/pdf/inc/profile.class.php:197 PluginPdfProfile::createFirstAccess() plugins/pdf/hook.php:61 PluginPdfProfile::install() src/Plugin.php:876 plugin_pdf_install() front/plugin.form.php:51
Merci pour vos réponses et la correction du bug qui interviens avec une installation vierge de glpi . Cordialement

David-Rodriguez-cabrera commented 1 year ago

Me pasa exactamente lo mismo.

Stufo76 commented 1 year ago

Same here, please fix it!

imponimassacri commented 1 year ago

Hi, I have the same problem. If you need some logs, I'm available to send you. Thank you

kabassanov commented 1 year ago

Hi,

This warning reflects the way this plugin references network ports. Class PluginOcsinventoryngNetworkPort extends NetworkPortInstantiation which "link" column is not id (even if it is the table primary key), but networkports_id. Recent GLPI changes raise warnings if something not expected is detected.

I don't know if there are still active developpers of this plugin...

imponimassacri commented 1 year ago

@tsmr is this project active? Or is time for us to search for a different product?

JastrzebskiKrzysztof commented 1 year ago

OS: debian 12 PHP: 8.2.7-1~deb12u1 GLPI: 10.0.10 (git) OCSNG: 2.11.1 rev. 7069 (git) ocsinventory-agent: 2.10.0-3 (deb) ocsinventoryng plugin: 2.0.4 rev. 15930 (git)

Same problem here. All work with assigning NIC's to swiches ports lost :-( Force full resync is not an option - overwritten with next ocsng sync cronjob...

Muzo18 commented 12 months ago

GLPI VERSION: 10.0.0 OCSSERVER: 2.12.0 PLUGIN: 2.0.4 PHP: 7.4.3

Hello, Same problem for us : With "Force Full Import" the networkports interfaces became empty. If we "Force full import" again, they appear If we "Force full import" again, they disappear If we "Force full import" again, they appear .... I think you understand the problem...

Thanks a lot for your support

Mirkk commented 9 months ago

Hi, The commit 8433a4822d7693619981adfcd0c5a934633a55ec by @tsmr resolves the warning in the log, but still we have Networks appearing/disappearing at every second "force full import" as @Muzo18 described above.

Mirkk commented 7 months ago

Hi @fgendorf @Muzo18 @tsmr @Stufo76 @David-Rodriguez-cabrera! Does anyone of you have a clue on how to fix this appearing/disappearing of NetworkPorts at every Full Sync? I have it on every Instance running with different versions till the latest committed plugin code with the actual GLPI. I did some effort to find the bug, but was not able to find anything concrete till now.

Thanks to anyone for any feedback!

fgendorf commented 7 months ago

Hi @Mirkk , no clue yet... but I guess the issue are in API GLPI in the latest versions, changed a lot since 10.0 when the last version of plugin was released