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

Can't upload xml files generated via command line inventory #16942

Closed
2 tasks done
GuidoWilden opened this issue Apr 17, 2024 · 16 comments
Closed
2 tasks done

Can't upload xml files generated via command line inventory #16942

GuidoWilden opened this issue Apr 17, 2024 · 16 comments

Comments

@GuidoWilden
Copy link

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Version

10.0.14

Bug description

When attempting to upload an xml file generated via glpi-netinventory we get:
File has not been imported: 'JSON does not validate ...

Relevant log output

No response

Page URL

No response

Steps To reproduce

  1. generate xml file via glpi-netinventory
  2. Go to Administration > Inventory > Import from file > select xml > Upload

Your GLPI setup information

Information about system installation and configuration
GLPI 10.0.14 ( => /var/www/html/glpi)
Installation mode: TARBALL
Current language:en_GB

Server
 
Operating system: Linux ldnaz-wiki01 5.15.0-102-generic #​112-Ubuntu SMP Tue Mar 5 16:50:32 UTC 2024 x86_64
PHP 8.3.6 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, random, readline, session, shmop, sockets, sodium, standard, sysvmsg, sysvsem, sysvshm,
tokenizer, xml, xmlreader, xmlwriter, xsl, zip, zlib)
Setup: max_execution_time="60" memory_limit="256M" post_max_size="20M" safe_mode="" session.save_handler="files"
upload_max_filesize="20M" disable_functions=""
Software: Apache/2.4.52 (Ubuntu) (Apache/2.4.52 (Ubuntu) Server at 10.120.30.15 Port 80
)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:124.0) Gecko/20100101 Firefox/124.0
Server Software: Ubuntu 22.04
Server Version: 10.6.16-MariaDB-0ubuntu0.22.04.1
Server SQL Mode: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Parameters: glpiuser@localhost/glpidb
Host info: Localhost via UNIX socket

PHP version (8.3.6) 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.6.16) is supported.
No files from previous GLPI version detected.
The log file has been created successfully.
Write access to /var/lib/glpi/_cache has been validated.
Write access to /var/lib/glpi/_cron has been validated.
Write access to /var/lib/glpi has been validated.
Write access to /var/lib/glpi/_dumps has been validated.
Write access to /var/lib/glpi/_graphs has been validated.
Write access to /var/lib/glpi/_lock has been validated.
Write access to /var/lib/glpi/_pictures has been validated.
Write access to /var/lib/glpi/_plugins has been validated.
Write access to /var/lib/glpi/_rss has been validated.
Write access to /var/lib/glpi/_sessions has been validated.
Write access to /var/lib/glpi/_tmp has been validated.
Write access to /var/lib/glpi/_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/html/glpi/marketplace has been validated.
Timezones seems loaded in database.

GLPI constants
 
GLPI_ROOT: "/var/www/html/glpi"
GLPI_CONFIG_DIR: "/etc/glpi/"
GLPI_VAR_DIR: "/var/lib/glpi"
GLPI_DOC_DIR: "/var/lib/glpi"
GLPI_CRON_DIR: "/var/lib/glpi/_cron"
GLPI_DUMP_DIR: "/var/lib/glpi/_dumps"
GLPI_GRAPH_DIR: "/var/lib/glpi/_graphs"
GLPI_LOCK_DIR: "/var/lib/glpi/_lock"
GLPI_PICTURE_DIR: "/var/lib/glpi/_pictures"
GLPI_PLUGIN_DOC_DIR: "/var/lib/glpi/_plugins"
GLPI_RSS_DIR: "/var/lib/glpi/_rss"
GLPI_SESSION_DIR: "/var/lib/glpi/_sessions"
GLPI_TMP_DIR: "/var/lib/glpi/_tmp"
GLPI_UPLOAD_DIR: "/var/lib/glpi/_uploads"
GLPI_CACHE_DIR: "/var/lib/glpi/_cache"
GLPI_LOG_DIR: "/var/log/glpi"
GLPI_MARKETPLACE_DIR: "/var/www/html/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_INSTALL_MODE: "TARBALL"
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_TEXT_MAXSIZE: "4000"
GLPI_LOCAL_I18N_DIR: "/var/lib/glpi/_locales"
GLPI_INVENTORY_DIR: "/var/lib/glpi/_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/html/glpi/locales"
GLPI_VERSION: "10.0.14"
GLPI_SCHEMA_VERSION: "10.0.14@8f13530f7cf0fb07add30ae20013f0374956795b"
GLPI_MARKETPLACE_PRERELEASES: false
GLPI_MIN_PHP: "7.4.0"
GLPI_MAX_PHP: "8.4.0"
GLPI_YEAR: "2024"

Libraries
 
htmlawed/htmlawed version 1.2.14 in (/var/www/html/glpi/vendor/htmlawed/htmlawed)
phpmailer/phpmailer version 6.8.0 in (/var/www/html/glpi/vendor/phpmailer/phpmailer/src)
simplepie/simplepie version 1.5.8 in (/var/www/html/glpi/vendor/simplepie/simplepie/library)
tecnickcom/tcpdf version 6.6.2 in (/var/www/html/glpi/vendor/tecnickcom/tcpdf)
michelf/php-markdown in (/var/www/html/glpi/vendor/michelf/php-markdown/Michelf)
true/punycode in (/var/www/html/glpi/vendor/true/punycode/src)
iamcal/lib_autolink in (/var/www/html/glpi/vendor/iamcal/lib_autolink)
sabre/dav in (/var/www/html/glpi/vendor/sabre/dav/lib/DAV)
sabre/http in (/var/www/html/glpi/vendor/sabre/http/lib)
sabre/uri in (/var/www/html/glpi/vendor/sabre/uri/lib)
sabre/vobject in (/var/www/html/glpi/vendor/sabre/vobject/lib)
laminas/laminas-i18n in (/var/www/html/glpi/vendor/laminas/laminas-i18n/src)
laminas/laminas-servicemanager in (/var/www/html/glpi/vendor/laminas/laminas-servicemanager/src)
monolog/monolog in (/var/www/html/glpi/vendor/monolog/monolog/src/Monolog)
sebastian/diff in (/var/www/html/glpi/vendor/sebastian/diff/src)
donatj/phpuseragentparser in (/var/www/html/glpi/vendor/donatj/phpuseragentparser/src/UserAgent)
elvanto/litemoji in (/var/www/html/glpi/vendor/elvanto/litemoji/src)
symfony/console in (/var/www/html/glpi/vendor/symfony/console)
scssphp/scssphp in (/var/www/html/glpi/vendor/scssphp/scssphp/src)
laminas/laminas-mail in (/var/www/html/glpi/vendor/laminas/laminas-mail/src/Protocol)
laminas/laminas-mime in (/var/www/html/glpi/vendor/laminas/laminas-mime/src)
rlanvin/php-rrule in (/var/www/html/glpi/vendor/rlanvin/php-rrule/src)
ramsey/uuid in (/var/www/html/glpi/vendor/ramsey/uuid/src)
psr/log in (/var/www/html/glpi/vendor/psr/log/Psr/Log)
psr/simple-cache in (/var/www/html/glpi/vendor/psr/simple-cache/src)
psr/cache in (/var/www/html/glpi/vendor/psr/cache/src)
league/csv in (/var/www/html/glpi/vendor/league/csv/src)
mexitek/phpcolors in (/var/www/html/glpi/vendor/mexitek/phpcolors/src/Mexitek/PHPColors)
guzzlehttp/guzzle in (/var/www/html/glpi/vendor/guzzlehttp/guzzle/src)
guzzlehttp/psr7 in (/var/www/html/glpi/vendor/guzzlehttp/psr7/src)
glpi-project/inventory_format in (/var/www/html/glpi/vendor/glpi-project/inventory_format/lib/php)
wapmorgan/unified-archive in (/var/www/html/glpi/vendor/wapmorgan/unified-archive/src)
paragonie/sodium_compat in (/var/www/html/glpi/vendor/paragonie/sodium_compat/src)
symfony/cache in (/var/www/html/glpi/vendor/symfony/cache)
html2text/html2text in (/var/www/html/glpi/vendor/html2text/html2text/src)
symfony/css-selector in (/var/www/html/glpi/vendor/symfony/css-selector)
symfony/dom-crawler in (/var/www/html/glpi/vendor/symfony/dom-crawler)
twig/twig in (/var/www/html/glpi/vendor/twig/twig/src)
twig/string-extra in (/var/www/html/glpi/vendor/twig/string-extra)
symfony/polyfill-ctype not found
symfony/polyfill-iconv not found
symfony/polyfill-mbstring not found
symfony/polyfill-php80 not found
symfony/polyfill-php81 not found
symfony/polyfill-php82 in (/var/www/html/glpi/vendor/symfony/polyfill-php82)
league/oauth2-client in (/var/www/html/glpi/vendor/league/oauth2-client/src/Provider)
league/oauth2-google in (/var/www/html/glpi/vendor/league/oauth2-google/src/Provider)
thenetworg/oauth2-azure in (/var/www/html/glpi/vendor/thenetworg/oauth2-azure/src/Provider)

LDAP directories
 
Server: 'ormedia.local', Port: '389', BaseDN: 'dc=ormedia,dc=local', Connection filter:
'(&(objectClass=user)(objectCategory=person)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))', RootDN: 'fusion4it', Use
TLS: none

SQL replicas
 
Not active

Notifications
 
Way of sending emails: PHP

Plugins list
 
accounts Name: Accounts Version: 3.0.4 State: Enabled
Install Method: Marketplace
databaseinventory Name: Database Inventory Version: 1.0.0 State: Not installed
Install Method: Marketplace
formcreator Name: Form Creator Version: 2.13.9 State: Enabled
Install Method: Marketplace
glpiinventory Name: GLPI Inventory Version: 1.3.5 State: Enabled
Install Method: Marketplace

Anything else?

No response

@trasher
Copy link
Contributor

trasher commented Apr 17, 2024

Please provide inventory file.

@GuidoWilden
Copy link
Author

@trasher Here you go.
switch01.xml.zip

@trasher
Copy link
Contributor

trasher commented Apr 17, 2024

This file is indeed missing mandatory TYPE node in INFO. What is the agent used to produce it?

@GuidoWilden
Copy link
Author

The latest nightly build v1.8-gitd493d729

@trasher
Copy link
Contributor

trasher commented Apr 17, 2024

Can you try with latest stable agent (1.7.3)? It's certainly an agent side issue anyway.

@GuidoWilden
Copy link
Author

GuidoWilden commented Apr 17, 2024

What is the command to downgrade the agent? When I attempt to install v1.7.3:

perl glpi-agent-1.7.3-linux-installer.pl --install --verbose
Running on linux distro: Ubuntu 22.04.4 LTS : Ubuntu : 22.04.4 LTS (Jammy Jellyfish)...
Guessed installation type: network
Installing glpi-agent v1.7.3...
Trying to install glpi-agent v1.7.3-1 on Ubuntu 22.04.4 LTS release (Ubuntu:22.04.4 LTS (Jammy Jellyfish))...
glpi-agent will be upgraded
glpi-agent-task-network will be upgraded
Extracting glpi-agent_1.7.3-1_all.deb ...
Extracting glpi-agent-task-network_1.7.3-1_all.deb ...
Running: apt -y install /var/tmp/glpi-agent-task-network_1.7.3-1_all.deb /var/tmp/glpi-agent_1.7.3-1_all.deb 2>/dev/null
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'glpi-agent-task-network' instead of '/var/tmp/glpi-agent-task-network_1.7.3-1_all.deb'
Note, selecting 'glpi-agent' instead of '/var/tmp/glpi-agent_1.7.3-1_all.deb'
Suggested packages:
  smartmontools read-edid
The following packages will be DOWNGRADED:
  glpi-agent glpi-agent-task-network
0 upgraded, 0 newly installed, 2 downgraded, 0 to remove and 7 not upgraded.
Failed to install glpi-agent

@GuidoWilden
Copy link
Author

OK seems that --force did the trick. New xml with v1.7.3 attached.
switch02.xml.zip

@trasher
Copy link
Contributor

trasher commented Apr 17, 2024

OK, thanks. It misses also TYPE node.

It's always been required from netinventory; I'm a bit surprised this has not yet been caught. ping @g-bougard @stonebuzz

@GuidoWilden
Copy link
Author

GuidoWilden commented Apr 17, 2024

OK @stonebuzz, @g-bougard I can provide a snmpwalk if required. If you just give me the exact syntax of what's required.

@stonebuzz
Copy link
Contributor

Hi @GuidoWilden

if <TYPE> is missing, it's because the SNMP community associated with the IP (or Asset) has not allowed the agent to retrieve the sysObjectID (used to know the type -> Printer / NetworkEquipment according to the file https://github.com/glpi-project/sysobject.ids/blob/master/sysobject.ids )

Under normal circumstances, the agent "talks" to the GlpiInventory plugin, which would display an error message (or simply redirect the type to an Unmanaged).

But going straight to an injection in the native inventory with an erroneous XML is certainly poorly handled by GLPI.

Anyway, can you check the SNMP community associated with the SNMP inventory command ?

or upload the agent log here (debug mode 2 ) when doing the SNMP inventory

Best regards

@GuidoWilden
Copy link
Author

Hey @stonebuzz,

The SNMP community string is fine as an snmpwalk works without a problem. We have eight of those switches and they do indeed all land in Unmanaged devices.

Log file:
glpi_inventory_log.txt.zip

@stonebuzz
Copy link
Contributor

I dont know if related but i found this

[debug] #1, partial match for sysobjectID .1.3.6.1.4.1.674.10895.3084 on manufacturer ID

@GuidoWilden
Copy link
Author

I'm afraid I'm of no help here. The manufacturer is Dell and it's a bog standard switch so I'm a little surprised GLPI struggles with the hardware.

@stonebuzz
Copy link
Contributor

Model N3048EP-ON or sysobjectID .1.3.6.1.4.1.674.10895.3084 does not exist in the

https://github.com/glpi-project/sysobject.ids/blob/master/sysobject.ids

So Agent can't determine <TYPE>

a snmpwalk should allow my colleague @g-bougard to complete the sysobject.ids file

Best regards

@GuidoWilden
Copy link
Author

snmpwalk attached.
snmpwalk.txt.zip

@trasher
Copy link
Contributor

trasher commented Apr 18, 2024

Thanks @stonebuzz :)

@GuidoWilden, please provide snmpwalk in new issue on https://github.com/glpi-project/sysobject.ids project - I cannot transfer the issue

@trasher trasher closed this as not planned Won't fix, can't repro, duplicate, stale Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants