glpi-project / glpi-agent

GLPI Agent
GNU General Public License v2.0
243 stars 61 forks source link

network inventory brokes links between ports on mikrotik networkdevices #520

Closed petrov-it closed 10 months ago

petrov-it commented 1 year ago

Bug reporting acknowledgment

Yes, I read it

Professional support

None

Describe the bug

Hi, After Launching Discovery and Inventory tasks on two mikrotik routeros devices (agent logs, xml and snmpwalk are attached) ports which are connects this two devices are linked to unmanaged hub (screenshot attached). After further inventories "network device/network ports" pages reports many messages like:

 "Warning: getFromDBByCrit expects to get one result, 7 found in query "SELECT `id` FROM `glpi_networkports_networkports` WHERE (`glpi_networkports_networkports`.`networkports_id_1` = '594' OR `glpi_networkports_networkports`.`networkports_id_2` = '594')". in /var/www/glpi/src/CommonDBTM.php on line 391"

Information about ports linking becomes misleading.

I have no clue on how glpi links ports of network devices and I can't be sure if it is agent or plugin issue. Please check if data generated by agent is correct. steklo-snmpwalk.txt

steklo_inventory.xml.txt steklo_discovery.xml.txt Screenshot_20231017_233228 gtw-snmpwalk.txt gtw_inventory.xml.txt gtw_discovery.xml.txt

To reproduce

  1. Launch Discover and inventory on two mikrotik routeros devices.
  2. View misleading info on network devices/network ports page

Expected behavior

Network ports should report adequate information or at least not to be broken.

Operating system

Linux

GLPI Agent version

1.5

GLPI version

Other (See additional context below)

GLPIInventory plugin or FusionInventory for GLPI plugin version

GLPI Inventory v1.x.x (See additional context below)

Additional context

GLPI 10.0.10 ( => /var/www/glpi)
Installation mode: DOCKER
Current language:en_GB

Operating system: Linux glpi 6.5.6-arch2-1 #​1 SMP PREEMPT_DYNAMIC Sat, 07 Oct 2023 08:14:55 +0000 x86_64
PHP 8.2.11 apache2handler (Core, PDO, Phar, Reflection, SPL, SimpleXML, Zend OPcache, apache2handler, apcu, bz2, ctype, curl,
    date, dom, exif, fileinfo, filter, ftp, gd, hash, iconv, intl, json, ldap, libxml, mbstring, mysqli, mysqlnd, openssl, pcre,
    pdo_sqlite, posix, random, session, soap, sodium, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zip, zlib)
Setup: max_execution_time="30" memory_limit="128M" post_max_size="8M" safe_mode="" session.save_handler="files"
    upload_max_filesize="2M" 
Software: Apache/2.4.57 (Debian) (Apache/2.4.57 (Debian) Server at glpi.solid-it.ru Port 80
)
    Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/118.0
Server Software: mariadb.org binary distribution
    Server Version: 10.7.3-MariaDB-1:10.7.3+maria~focal
    Server SQL Mode: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
    Parameters: glpi@glpi-db/glpi
    Host info: glpi-db via TCP/IP

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

Web server root directory configuration seems safe.
Sessions configuration is secured.
OS and PHP are relying on 64 bits integers.
exif extension is installed.
ldap extension is installed.
openssl extension is installed.
Following extensions are installed: bz2, Phar, zip.
Zend OPcache extension is installed.
Following extensions are installed: ctype, iconv, mbstring, sodium.
Write access to /var/www/glpi/marketplace has been validated.
Access to timezone database (mysql) is not allowed.

GLPI_ROOT: "/var/www/glpi"
GLPI_CONFIG_DIR: "/var/glpi/config"
GLPI_VAR_DIR: "/var/glpi/files"
GLPI_INSTALL_MODE: "DOCKER"
GLPI_MARKETPLACE_DIR: "/var/www/glpi/marketplace"
GLPI_USE_CSRF_CHECK: "1"
GLPI_CSRF_EXPIRES: "7200"
GLPI_CSRF_MAX_TOKENS: "100"
GLPI_USE_IDOR_CHECK: "1"
GLPI_IDOR_EXPIRES: "7200"
GLPI_ALLOW_IFRAME_IN_RICH_TEXT: false
GLPI_SERVERSIDE_URL_ALLOWLIST: ["/^(https?|feed):\\/\\/[^@:]+(\\/.*)?$/"]
GLPI_TELEMETRY_URI: "https://telemetry.glpi-project.org"
GLPI_NETWORK_MAIL: "glpi@teclib.com"
GLPI_NETWORK_SERVICES: "https://services.glpi-network.com"
GLPI_MARKETPLACE_ALLOW_OVERRIDE: true
GLPI_MARKETPLACE_MANUAL_DOWNLOADS: true
GLPI_USER_AGENT_EXTRA_COMMENTS: ""
GLPI_DISABLE_ONLY_FULL_GROUP_BY_SQL_MODE: "1"
GLPI_AJAX_DASHBOARD: "1"
GLPI_CALDAV_IMPORT_STATE: 0
GLPI_DEMO_MODE: "0"
GLPI_CENTRAL_WARNINGS: "1"
GLPI_DOC_DIR: "/var/glpi/files"
GLPI_CACHE_DIR: "/var/glpi/files/_cache"
GLPI_CRON_DIR: "/var/glpi/files/_cron"
GLPI_DUMP_DIR: "/var/glpi/files/_dumps"
GLPI_GRAPH_DIR: "/var/glpi/files/_graphs"
GLPI_LOCAL_I18N_DIR: "/var/glpi/files/_locales"
GLPI_LOCK_DIR: "/var/glpi/files/_lock"
GLPI_LOG_DIR: "/var/glpi/files/_log"
GLPI_PICTURE_DIR: "/var/glpi/files/_pictures"
GLPI_PLUGIN_DOC_DIR: "/var/glpi/files/_plugins"
GLPI_RSS_DIR: "/var/glpi/files/_rss"
GLPI_SESSION_DIR: "/var/glpi/files/_sessions"
GLPI_TMP_DIR: "/var/glpi/files/_tmp"
GLPI_UPLOAD_DIR: "/var/glpi/files/_uploads"
GLPI_INVENTORY_DIR: "/var/glpi/files/_inventories"
GLPI_NETWORK_REGISTRATION_API_URL: "https://services.glpi-network.com/api/registration/"
GLPI_MARKETPLACE_PLUGINS_API_URI: "https://services.glpi-network.com/api/marketplace/"
GLPI_I18N_DIR: "/var/www/glpi/locales"
GLPI_VERSION: "10.0.10"
GLPI_SCHEMA_VERSION: "10.0.10@05de68add675fb55abaeec10f3a2552085594a16"
GLPI_MARKETPLACE_PRERELEASES: false
GLPI_MIN_PHP: "7.4.0"
GLPI_MAX_PHP: "8.4.0"
GLPI_YEAR: "2023"
g-bougard commented 11 months ago

Hi @petrov-it

I took a moment to test your walk. It helped me to identify few problems in the LLDP analysis. I'm not sure this is relevant to your issue, but can I ask you to install next nightly and make tests with that updated version to continue with the same base ? I still can say LLDP support on Mikrotik devices seems approximative ^^

g-bougard commented 10 months ago

Hi @petrov-it I'm closing this issue without your feedback. I'll make a new release next week. Feel free to reopen from next week if you have more to share after 1.7 update.