glpi-project / glpi

GLPI is a Free Asset and IT Management Software package, Data center management, ITIL Service Desk, licenses tracking and software auditing.
https://glpi-project.org
GNU General Public License v3.0
4.36k stars 1.3k forks source link

Inventories with VM from FusionInventory are rejected as vmtype is not defined #11810

Closed dani closed 2 years ago

dani commented 2 years ago

Code of Conduct

Is there an existing issue for this?

Version

10.0.1

Bug description

Some of my servers are running Proxmox VE, with FusionInventory Agent (version 2.4 or 2.6). When VM are running, they are added in the inventory like this

    <VIRTUALMACHINES>
      <MEMORY>8192</MEMORY>
      <NAME>zbx-infra.test.local</NAME>
      <STATUS>running</STATUS>
      <UUID>be0bb287-8a99-48dc-8bd6-8b00b5cc9402</UUID>
      <VCPU>1</VCPU>
    </VIRTUALMACHINES>

Note : there's not VMTYPE property. GLPI refuses such an inventory because of this missing property, as vmtype is defined in the schema as mandatory. FusionInventory plugin for GLPI used to accept those.

Relevant log output

No response

Page URL

No response

Steps To reproduce

inv_without_vmtype.xml.txt

Attached is a sample inventory. You can reproduce the issue by trying to import it in GLPI from the interface in Administration -> Inventory -> Import from file

Note : the error message is empty, which made debuging a bit harder. I had to comment lines 205 and 206 from src/Inventory/Conf.php to get the error displayed. Without commenting them, I had

[2022-06-03 14:35:48] glpiphplog.WARNING:   *** PHP Warning (2): Attempt to read property "ERROR" on bool in /opt/glpi_1/web/src/Inventory/Conf.php at line 206
  Backtrace :
  src/Inventory/Conf.php:140                         Glpi\Inventory\Conf->importContentFile()
  front/inventory.conf.php:47                        Glpi\Inventory\Conf->importFile()

in php-errors.log

Your GLPI setup information

Informations sur le système, l'installation et la configuration
GLPI 10.0.1 ( => /opt/glpi_1/web)
Installation mode: TARBALL
Current language:fr_FR

Server
 
Operating system: Linux web1 4.18.0-372.9.1.el8.x86_64 #1 SMP Tue May 10 08:57:35 EDT 2022 x86_64
PHP 8.0.19 fpm-fcgi (Core, PDO, Phar, Reflection, SPL, SimpleXML, Zend OPcache, apcu, bcmath, bz2, calendar, cgi-fcgi, ctype,
    curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, igbinary, imagick, imap, intl, json, ldap, libxml,
    mbstring, memcached, msgpack, mysqli, mysqlnd, openssl, pcre, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, posix, session, shmop,
    snmp, soap, sockets, sqlite3, standard, sysvmsg, sysvsem, sysvshm, tokenizer, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip,
    zlib)
Setup: max_execution_time="60" memory_limit="256M" post_max_size="100M" safe_mode="" session.save_handler="files"
    upload_max_filesize="100M" 
Software: Apache ()
    Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.61 Safari/537.36
Server Software: MariaDB Server
    Server Version: 10.6.8-MariaDB
    Server SQL Mode: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
    Parameters: glpi_1@db.lapiole.org/glpi_1
    Host info: db.lapiole.org via TCP/IP

PHP version (8.0.19) is supported.
Sessions configuration is OK.
Allocated memory is sufficient.
mysqli extension is installed.
Following extensions are installed: dom, fileinfo, json, simplexml.
curl extension is installed.
gd extension is installed.
intl extension is installed.
libxml extension is installed.
zlib extension is installed.
The constant SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES is present.
Database engine version (10.6.8) is supported.
The log file has been created successfully.
Write access to /opt/glpi_1/data/_cache has been validated.
Write access to /opt/glpi_1/web/config has been validated.
Write access to /opt/glpi_1/data/_cron has been validated.
Write access to /opt/glpi_1/data/_files has been validated.
Write access to /opt/glpi_1/data/_dumps has been validated.
Write access to /opt/glpi_1/data/_graphs has been validated.
Write access to /opt/glpi_1/data/_lock has been validated.
Write access to /opt/glpi_1/data/_pictures has been validated.
Write access to /opt/glpi_1/data/_plugins has been validated.
Write access to /opt/glpi_1/data/_rss has been validated.
Write access to /opt/glpi_1/sessions has been validated.
Write access to /opt/glpi_1/tmp has been validated.
Write access to /opt/glpi_1/tmp has been validated.
Web access to the files directory should not be allowed but this cannot be checked automatically on this instance.
Make sure access to error log file (/files/_log/php-errors.log) is forbidden; otherwise review .htaccess file and web server configuration.
exif extension is installed.
ldap extension is installed.
openssl extension is installed.
zip extension is installed.
bz2 extension is installed.
Zend OPcache extension is installed.
Following extensions are installed: ctype, iconv, mbstring.
Following extensions are not present: sodium.
Write access to /opt/glpi_1/web/marketplace has been validated.
Access to timezone database (mysql) is not allowed.

GLPI constants
 
GLPI_ROOT: /opt/glpi_1/web
GLPI_VAR_DIR: /opt/glpi_1/data
GLPI_DOC_DIR: /opt/glpi_1/data/_files
GLPI_SESSION_DIR: /opt/glpi_1/sessions
GLPI_TMP_DIR: /opt/glpi_1/tmp
GLPI_UPLOAD_DIR: /opt/glpi_1/tmp
GLPI_CONFIG_DIR: /opt/glpi_1/web/config
GLPI_MARKETPLACE_DIR: /opt/glpi_1/web/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: 
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: 1
GLPI_MARKETPLACE_MANUAL_DOWNLOADS: 1
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_CACHE_DIR: /opt/glpi_1/data/_cache
GLPI_CRON_DIR: /opt/glpi_1/data/_cron
GLPI_DUMP_DIR: /opt/glpi_1/data/_dumps
GLPI_GRAPH_DIR: /opt/glpi_1/data/_graphs
GLPI_LOCAL_I18N_DIR: /opt/glpi_1/data/_locales
GLPI_LOCK_DIR: /opt/glpi_1/data/_lock
GLPI_LOG_DIR: /opt/glpi_1/data/_log
GLPI_PICTURE_DIR: /opt/glpi_1/data/_pictures
GLPI_PLUGIN_DOC_DIR: /opt/glpi_1/data/_plugins
GLPI_RSS_DIR: /opt/glpi_1/data/_rss
GLPI_INVENTORY_DIR: /opt/glpi_1/data/_inventories
GLPI_NETWORK_REGISTRATION_API_URL: https://services.glpi-network.com/api/registration/
GLPI_MARKETPLACE_PLUGINS_API_URI: https://services.glpi-network.com/api/glpi-plugins/
GLPI_I18N_DIR: /opt/glpi_1/web/locales
GLPI_VERSION: 10.0.1
GLPI_SCHEMA_VERSION: 10.0.1@a130db99c7d9b131c2e2ea59fe0d6260fe93d831
GLPI_MARKETPLACE_PRERELEASES: 
GLPI_MIN_PHP: 7.4.0
GLPI_MAX_PHP: 8.2.0
GLPI_YEAR: 2022

Libraries
 
htmlawed/htmlawed version 1.2.6 in (/opt/glpi_1/web/vendor/htmlawed/htmlawed)
phpmailer/phpmailer version 6.6.0 in (/opt/glpi_1/web/vendor/phpmailer/phpmailer/src)
simplepie/simplepie version 1.5.8 in (/opt/glpi_1/web/vendor/simplepie/simplepie/library)
tecnickcom/tcpdf version 6.4.4 in (/opt/glpi_1/web/vendor/tecnickcom/tcpdf)
michelf/php-markdown in (/opt/glpi_1/web/vendor/michelf/php-markdown/Michelf)
true/punycode in (/opt/glpi_1/web/vendor/true/punycode/src)
iamcal/lib_autolink in (/opt/glpi_1/web/vendor/iamcal/lib_autolink)
sabre/dav in (/opt/glpi_1/web/vendor/sabre/dav/lib/DAV)
sabre/http in (/opt/glpi_1/web/vendor/sabre/http/lib)
sabre/uri in (/opt/glpi_1/web/vendor/sabre/uri/lib)
sabre/vobject in (/opt/glpi_1/web/vendor/sabre/vobject/lib)
laminas/laminas-i18n in (/opt/glpi_1/web/vendor/laminas/laminas-i18n/src)
laminas/laminas-servicemanager in (/opt/glpi_1/web/vendor/laminas/laminas-servicemanager/src)
monolog/monolog in (/opt/glpi_1/web/vendor/monolog/monolog/src/Monolog)
sebastian/diff in (/opt/glpi_1/web/vendor/sebastian/diff/src)
donatj/phpuseragentparser in (/opt/glpi_1/web/vendor/donatj/phpuseragentparser/src/UserAgent)
elvanto/litemoji in (/opt/glpi_1/web/vendor/elvanto/litemoji/src)
symfony/console in (/opt/glpi_1/web/vendor/symfony/console)
scssphp/scssphp in (/opt/glpi_1/web/vendor/scssphp/scssphp/src)
laminas/laminas-mail in (/opt/glpi_1/web/vendor/laminas/laminas-mail/src/Protocol)
laminas/laminas-mime in (/opt/glpi_1/web/vendor/laminas/laminas-mime/src)
rlanvin/php-rrule in (/opt/glpi_1/web/vendor/rlanvin/php-rrule/src)
blueimp/jquery-file-upload in (/opt/glpi_1/web/vendor/blueimp/jquery-file-upload/server/php)
ramsey/uuid in (/opt/glpi_1/web/vendor/ramsey/uuid/src)
psr/log in (/opt/glpi_1/web/vendor/psr/log/Psr/Log)
psr/simple-cache in (/opt/glpi_1/web/vendor/psr/simple-cache/src)
psr/cache in (/opt/glpi_1/web/vendor/psr/cache/src)
league/csv in (/opt/glpi_1/web/vendor/league/csv/src)
mexitek/phpcolors in (/opt/glpi_1/web/vendor/mexitek/phpcolors/src/Mexitek/PHPColors)
guzzlehttp/guzzle in (/opt/glpi_1/web/vendor/guzzlehttp/guzzle/src)
guzzlehttp/psr7 in (/opt/glpi_1/web/vendor/guzzlehttp/psr7/src)
glpi-project/inventory_format in (/opt/glpi_1/web/vendor/glpi-project/inventory_format/lib/php)
wapmorgan/unified-archive in (/opt/glpi_1/web/vendor/wapmorgan/unified-archive/src)
paragonie/sodium_compat in (/opt/glpi_1/web/vendor/paragonie/sodium_compat/src)
symfony/cache in (/opt/glpi_1/web/vendor/symfony/cache)
html2text/html2text in (/opt/glpi_1/web/vendor/html2text/html2text/src)
symfony/css-selector in (/opt/glpi_1/web/vendor/symfony/css-selector)
symfony/dom-crawler in (/opt/glpi_1/web/vendor/symfony/dom-crawler)
twig/twig in (/opt/glpi_1/web/vendor/twig/twig/src)
twig/string-extra in (/opt/glpi_1/web/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 in (/opt/glpi_1/web/vendor/symfony/polyfill-php81)
phpCas version 1.5.0 in (/usr/share/pear)

LDAP directories
 
Server: 'dc3.lapiole.org', Port: '389', BaseDN: 'DC=lapiole,DC=org', Connection filter:
        '(&(objectClass=user)(objectCategory=person)(|(memberOf=CN=Domain
        Admins,OU=Groups,DC=lapiole,DC=org)(memberOf=CN=Equipe,OU=Groups,DC=lapiole,DC=org)))', RootDN: 'glpi@lapiole.org', Use TLS:
        '1'

SQL replicas
 
Not active

Notifications
 
Way of sending emails: PHP

Plugins list
 
    mydashboard          Name: Dashboard                      Version: 2.0.3      State: Installed / not activated
    fusioninventory      Name: FusionInventory                Version: 9.5+3.0    State: Error / to clean
    tag                  Name: Gestion des tags               Version: 2.9.0      State: Installed / not activated

Anything else?

No response

g-bougard commented 2 years ago

Hi @dani

did you test with a GLPI Agent ? If the problem is also present in GLPI agent, I'will be able to quickly fix it in the agent.

trasher commented 2 years ago

It's also possible to define it as not required. I have no idea if it should be always present or not.

dani commented 2 years ago

Haven't tried with the GLPI Agent yet. My goal is to first have all my inventories up and running again with my existing FusionInventory agents. Then I'll see if I can deploy GLPI Agent

dani commented 2 years ago

I also think vmtype shouldn't be required, as the new integrated inventory is supposed to be a drop-in replacement for FusionInventory plugin