Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic sync script deleting all networkports #355

Open
fgendorf opened this issue Apr 27, 2023 · 12 comments
Open

Automatic sync script deleting all networkports #355

fgendorf opened this issue Apr 27, 2023 · 12 comments

Comments

@fgendorf
Copy link

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
Copy link

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

@jlb5980
Copy link

jlb5980 commented May 15, 2023

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

Me pasa exactamente lo mismo.

@Stufo76
Copy link

Stufo76 commented May 26, 2023

Same here, please fix it!

@imponimassacri
Copy link

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

@kabassanov
Copy link

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
Copy link

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

@JastrzebskiKrzysztof
Copy link

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
Copy link

Muzo18 commented Aug 30, 2023

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
Copy link

Mirkk commented Nov 22, 2023

Hi,
The commit 8433a48 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
Copy link

Mirkk commented Jan 16, 2024

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants