glpi-project / glpi-inventory-plugin

GLPI Inventory plugin
GNU Affero General Public License v3.0
47 stars 27 forks source link

Stack is showing the latest switch only #560

Open romnvll opened 1 month ago

romnvll commented 1 month ago

Code of Conduct

Is there an existing issue for this?

GLPI Version

10.0.15

Plugin version

1.4.0

Bug description

switch stacks all have the same id

Relevant log output

php-error.log :
 glpiphplog.WARNING:   *** PHP User Warning (512): Multiple non-virtual NetworkPorts on the computer (1332656,3155102) in /var/www/html/glpi/src/Inventory/Asset/NetworkPort.php at line 393
  Backtrace :
  src/Inventory/Asset/NetworkPort.php:393            trigger_error()
  src/Inventory/Asset/NetworkPort.php:611            Glpi\Inventory\Asset\NetworkPort->handleMacConnection()
  src/Inventory/Asset/NetworkPort.php:633            Glpi\Inventory\Asset\NetworkPort->handleConnections()
  src/Inventory/Asset/NetworkPort.php:628            Glpi\Inventory\Asset\NetworkPort->portChanged()
  src/Inventory/Asset/InventoryNetworkPort.php:644   Glpi\Inventory\Asset\NetworkPort->portCreated()
  src/Inventory/Asset/InventoryNetworkPort.php:122   Glpi\Inventory\Asset\NetworkPort->handleCreates()
  src/Inventory/Asset/NetworkPort.php:835            Glpi\Inventory\Asset\NetworkPort->handlePortsTrait()
  src/Inventory/Asset/NetworkPort.php:618            Glpi\Inventory\Asset\NetworkPort->handlePorts()
  src/Inventory/Asset/MainAsset.php:1001             Glpi\Inventory\Asset\NetworkPort->handle()
  src/Inventory/Asset/MainAsset.php:916              Glpi\Inventory\Asset\MainAsset->handleAssets()
  src/Inventory/Asset/NetworkEquipment.php:228       Glpi\Inventory\Asset\MainAsset->rulepassed()
  src/RuleImportAsset.php:981                        Glpi\Inventory\Asset\NetworkEquipment->rulepassed()
  src/Rule.php:1531                                  RuleImportAsset->executeActions()
  src/RuleCollection.php:1660                        Rule->process()
  src/Inventory/Asset/MainAsset.php:582              RuleCollection->processAllRules()
  src/Inventory/Inventory.php:724                    Glpi\Inventory\Asset\MainAsset->handle()
  src/Inventory/Inventory.php:355                    Glpi\Inventory\Inventory->handleItem()
  src/Inventory/Request.php:364                      Glpi\Inventory\Inventory->doInventory()
  src/Inventory/Request.php:285                      Glpi\Inventory\Request->inventory()
  src/Inventory/Request.php:252                      Glpi\Inventory\Request->network()
  src/Inventory/Request.php:98                       Glpi\Inventory\Request->networkInventory()
  src/Agent/Communication/AbstractRequest.php:332    Glpi\Inventory\Request->handleAction()
  src/Agent/Communication/AbstractRequest.php:269    Glpi\Agent\Communication\AbstractRequest->handleXMLRequest()
  src/Inventory/Conf.php:242                         Glpi\Agent\Communication\AbstractRequest->handleRequest()
  src/Inventory/Conf.php:187                         Glpi\Inventory\Conf->importContentFile()
  src/Inventory/Conf.php:291                         Glpi\Inventory\Conf->importFiles()
  front/inventory.conf.php:47                        Glpi\Inventory\Conf->displayImportFiles()

Page URL

No response

Steps To reproduce

glpi-netinventory --host 192.168.28.9 --credentials version:2c,community:XXXX--debug --control --backend-collect-timeout 30 --timeout 5 --retries 1 --threads 10000 --file /tmp/28.9.xml I obtain an XML file and import it manually

image

Every switch as the same ID

and i get only the last switch of the stack : image

Your GLPI setup information

Operating system: Linux glpiv3 5.15.0-107-generic #​117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 PHP 8.1.2-1ubuntu2.18 apache2handler (Core, FFI, PDO, Phar, Reflection, SPL, SimpleXML, Zend OPcache, apache2handler, bz2, calendar, ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, intl, json, ldap, libxml, mbstring, mysqli, mysqlnd, openssl, pcre, pdo_mysql, posix, readline, session, shmop, sockets, sodium, standard, sysvmsg, sysvsem, sysvshm, tokenizer, xml, xmlreader, xmlwriter, xsl, zlib) Setup: max_execution_time="120" memory_limit="128M" post_max_size="8M" safe_mode="" session.save_handler="files" upload_max_filesize="2M" disable_functions="" Software: Apache/2.4.52 (Ubuntu) (Apache/2.4.52 (Ubuntu) Server at helpdesk.intranet.int Port 80 ) Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36 Server Software: Ubuntu 22.04 Server Version: 10.6.18-MariaDB-0ubuntu0.22.04.1 Server SQL Mode: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION Parameters: glpi@localhost/glpi Host info: Localhost via UNIX socket

PHP version (8.1.2-1ubuntu2.18) is supported.PHP version (8.1.2-1ubuntu2.18) is supported. Sessions configuration is OK.Sessions configuration is OK. Allocated memory is sufficient.Allocated memory is sufficient. mysqli extension is installed.mysqli extension is installed. Following extensions are installed: dom, fileinfo, filter, libxml, json, simplexml, xmlreader, xmlwriter.Following extensions are installed: dom, fileinfo, filter, libxml, json, simplexml, xmlreader, xmlwriter. curl extension is installed.curl extension is installed. gd extension is installed.gd extension is installed. intl extension is installed.intl extension is installed. zlib extension is installed.zlib extension is installed. The constant SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES is present.The constant SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES is present. Database engine version (10.6.18) is supported.Database engine version (10.6.18) is supported. No files from previous GLPI version detected.No files from previous GLPI version detected. The log file has been created successfully.The log file has been created successfully. Write access to /var/www/html/glpi/files/_cache has been validated. Write access to /var/www/html/glpi/files/_cron has been validated. Write access to /var/www/html/glpi/files has been validated. Write access to /var/www/html/glpi/files/_dumps has been validated. Write access to /var/www/html/glpi/files/_graphs has been validated. Write access to /var/www/html/glpi/files/_lock has been validated. Write access to /var/www/html/glpi/files/_pictures has been validated. Write access to /var/www/html/glpi/files/_plugins has been validated. Write access to /var/www/html/glpi/files/_rss has been validated. Write access to /var/www/html/glpi/files/_sessions has been validated. Write access to /var/www/html/glpi/files/_tmp has been validated. Write access to /var/www/html/glpi/files/_uploads has been validated.Write access to /var/www/html/glpi/files/_cache has been validated. Write access to /var/www/html/glpi/files/_cron has been validated. Write access to /var/www/html/glpi/files has been validated. Write access to /var/www/html/glpi/files/_dumps has been validated. Write access to /var/www/html/glpi/files/_graphs has been validated. Write access to /var/www/html/glpi/files/_lock has been validated. Write access to /var/www/html/glpi/files/_pictures has been validated. Write access to /var/www/html/glpi/files/_plugins has been validated. Write access to /var/www/html/glpi/files/_rss has been validated. Write access to /var/www/html/glpi/files/_sessions has been validated. Write access to /var/www/html/glpi/files/_tmp has been validated. Write access to /var/www/html/glpi/files/_uploads has been validated.

Web server root directory configuration is not safe as it permits access to non-public files. See installation documentation for more details.Web server root directory configuration is not safe as it permits access to non-public files. See installation documentation for more details. The following directories should be placed outside "/var/www/html/glpi": ‣ "/var/www/html/glpi/files" ("GLPI_VAR_DIR") You can ignore this suggestion if your web server root directory is "/var/www/html/glpi/public".The following directories should be placed outside "/var/www/html/glpi": ‣ "/var/www/html/glpi/files" ("GLPI_VAR_DIR") You can ignore this suggestion if your web server root directory is "/var/www/html/glpi/public". Sessions configuration is secured.Sessions configuration is secured. OS and PHP are relying on 64 bits integers.OS and PHP are relying on 64 bits integers. exif extension is installed.exif extension is installed. ldap extension is installed.ldap extension is installed. openssl extension is installed.openssl extension is installed. Following extensions are installed: bz2, Phar. Following extensions are not present: zip.Following extensions are installed: bz2, Phar. Following extensions are not present: zip. Zend OPcache extension is installed.Zend OPcache extension is installed. Following extensions are installed: ctype, iconv, mbstring, sodium.Following extensions are installed: ctype, iconv, mbstring, sodium. Write access to /var/www/html/glpi/marketplace has been validated.Write access to /var/www/html/glpi/marketplace has been validated. Access to timezone database (mysql) is not allowed.Access to timezone database (mysql) is not allowed.

Anything else?

No response

trasher commented 1 month ago

First, try with latest GLPI version. If it's still relevant, please provide an example inventory file we can use to reproduce on our side.

romnvll commented 1 month ago

Thank you for your reply . 192.168.28.9.zip

I juste update to 10.0.16 but the issue still alive :)

When i import this file, only one switch is created with SW28-9 - Unit 6 - 6 name and only this switch. And the history for this equipement is strange, because unit 5 is deleted : image

Thank you

trasher commented 1 month ago

I've just used your inventory file on my local instance, it creates 6 NetworkEquipment entries, as expected. Everything seems correct. Everything is still OK if I try several imports (well, that does not exactly reflects reality, but inventory is ok at this point).

Of course, I'm using default import rules; that may be the cause of your problem. Try (on a preprod instance first maybe) to reset your import rules and see if you reproduce.