fusioninventory / fusioninventory-for-glpi

FusionInventory plugin for GLPI
http://www.FusionInventory.org/
GNU Affero General Public License v3.0
362 stars 150 forks source link

[Solved] NetDiscovery find devices but not import, SNMP scan not executed #2749

Closed Dallo71 closed 5 years ago

Dallo71 commented 5 years ago

Hello, I'm not able to import any devices by doing a fusoninventory-netdiscovery task. For test purpose I tried with a well-known printer (but the same thing happens with any other device in my network) In the "Equipment ignored on import" page, I see that it fails on the "Global import denied" rule and also that the "Item Type" field is empty. If I run the program from the command line I see that the "type" field correctly reports the value "Printer":

root@GLPI:/# IP=192.168.10.54
root@GLPI:/# fusioninventory-netdiscovery --first $IP --last $IP --control --debug --community public --entity root
<?xml version="1.0" encoding="UTF-8" ?>
<REQUEST>
  <CONTENT>
    <AGENT>
      <AGENTVERSION>2.4-2</AGENTVERSION>
      <START>1</START>
    </AGENT>
    <MODULEVERSION>2.6</MODULEVERSION>
    <PROCESSNUMBER>1</PROCESSNUMBER>
  </CONTENT>
  <DEVICEID>foo</DEVICEID>
  <QUERY>NETDISCOVERY</QUERY>
</REQUEST>
[debug] scanning block 192.168.10.54-192.168.10.54
<?xml version="1.0" encoding="UTF-8" ?>
<REQUEST>
  <CONTENT>
    <AGENT>
      <NBIP>1</NBIP>
    </AGENT>
    <PROCESSNUMBER>1</PROCESSNUMBER>
  </CONTENT>
  <DEVICEID>foo</DEVICEID>
  <QUERY>NETDISCOVERY</QUERY>
</REQUEST>
[debug] creating 1 worker threads
[debug] [thread 1] creation
[debug] [thread 1] scanning 192.168.10.54:
[debug] full match for sysobjectID .1.3.6.1.4.1.236.11.5.1 in database
[debug] [thread 1] - scanning 192.168.10.54 with SNMP, credentials 1: success
[debug] [thread 1] - scanning 192.168.10.54 with netbios: no result
[debug] [thread 1] - scanning 192.168.10.54 with nmap: success
[debug] [thread 1] termination
<?xml version="1.0" encoding="UTF-8" ?>
<REQUEST>
  <CONTENT>
    <DEVICE>
      <AUTHSNMP>1</AUTHSNMP>
      <CONTACT>Stefano Dall&apos;Olio</CONTACT>
      <DESCRIPTION>Samsung Samsung ML-2950 Series; V3.00.01.06     Jul-03-2011;Engine V1.01.04 07-01-2011;NIC V6.01.00(ML-2950 Series);S/N Z6H7BAGB900388M</DESCRIPTION>
      <DNSHOSTNAME>prn-ml-2955nd.carovana.lan</DNSHOSTNAME>
      <IP>192.168.10.54</IP>
      <IPS>
        <IP>127.0.0.1</IP>
        <IP>192.168.10.54</IP>
      </IPS>
      <LOCATION>Ufficio Mirta</LOCATION>
      <MAC>00:15:99:8e:66:0f</MAC>
      <MANUFACTURER>Samsung</MANUFACTURER>
      <MEMORY>0</MEMORY>
      <MODEL>ML-371x</MODEL>
      <NETPORTVENDOR>Samsung Electronics</NETPORTVENDOR>
      <SERIAL>Z6H7BAGB900388M</SERIAL>
      <SNMPHOSTNAME>Mirta-SamML2950</SNMPHOSTNAME>
      <TYPE>PRINTER</TYPE>
      <UPTIME>7 days, 03:42:51.00</UPTIME>
    </DEVICE>
    <MODULEVERSION>2.6</MODULEVERSION>
    <PROCESSNUMBER>1</PROCESSNUMBER>
  </CONTENT>
  <DEVICEID>foo</DEVICEID>
  <QUERY>NETDISCOVERY</QUERY>
</REQUEST>
<?xml version="1.0" encoding="UTF-8" ?>
<REQUEST>
  <CONTENT>
    <AGENT>
      <END>1</END>
    </AGENT>
    <MODULEVERSION>2.6</MODULEVERSION>
    <PROCESSNUMBER>1</PROCESSNUMBER>
  </CONTENT>
  <DEVICEID>foo</DEVICEID>
  <QUERY>NETDISCOVERY</QUERY>
</REQUEST>
[debug] cleaning 1 worker threads
<?xml version="1.0" encoding="UTF-8" ?>
<REQUEST>
  <CONTENT>
    <AGENT>
      <END>1</END>
    </AGENT>
    <MODULEVERSION>2.6</MODULEVERSION>
    <PROCESSNUMBER>1</PROCESSNUMBER>
  </CONTENT>
  <DEVICEID>foo</DEVICEID>
  <QUERY>NETDISCOVERY</QUERY>
</REQUEST>

glpi - netdiscovery task result

glpi - equipment ignored on import page

I have the same problem on two different installations in two different sites. I tried reinstalling a server from scratch with the latest version of GLPI and FusionInventory carefully following all the instructions... The configuration of the server where I'm doing the tests now is the following:

GLPI 9.3.3 ( => /var/www/glpi)
Installation mode: TARBALL

Server

Operating system: Linux GLPI 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64
PHP 7.0.33-0+deb9u1 apache2handler (Core, PDO, Phar, Reflection, SPL, SimpleXML, Zend OPcache, apache2handler, apcu, calendar,
    ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, imap, json, ldap, libxml, mbstring, mysqli,
    mysqlnd, openssl, pcre, pdo_mysql, posix, readline, session, shmop, snmp, soap, sockets, standard, sysvmsg, sysvsem, sysvshm,
    tokenizer, wddx, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, zlib)
Setup: max_execution_time="600" memory_limit="64M" post_max_size="16M" safe_mode="" session.save_handler="files"
    upload_max_filesize="8M" 
Software: Apache ()
    Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
Server Software: Debian 9.6
    Server Version: 10.1.37-MariaDB-0+deb9u1
    Server SQL Mode: 
    Parameters: glpi@localhost/glpi
    Host info: Localhost via UNIX socket

mysqli extension is installed
ctype extension is installed
fileinfo extension is installed
json extension is installed
mbstring extension is installed
zlib extension is installed
curl extension is installed
gd extension is installed
simplexml extension is installed
xml extension is installed
ldap extension is installed
imap extension is installed
Zend OPcache extension is installed
APCu extension is installed
xmlrpc extension is installed
CAS extension is installed
Database version seems correct (10.1.37) - Perfect!Database version seems correct (10.1.37) - Perfect!
OK/var/log/glpi : OK
OK/etc/glpi/ : OK
OK/var/lib/glpi : OK
OK/var/lib/glpi/_dumps : OK
OK/var/lib/glpi/_sessions : OK
OK/var/lib/glpi/_cron : OK
OK/var/lib/glpi/_graphs : OK
OK/var/lib/glpi/_lock : OK
OK/var/lib/glpi/_plugins : OK
OK/var/lib/glpi/_tmp : OK
OK/var/lib/glpi/_cache : OK
OK/var/lib/glpi/_rss : OK
OK/var/lib/glpi/_uploads : OK
OK/var/lib/glpi/_pictures : OK

Libraries

htmLawed version 1.2.4 in (/var/www/glpi/lib/htmlawed)
SimplePie version 1.5.2 in (/var/www/glpi/vendor/simplepie/simplepie/library)
TCPDF version 6.2.25 in (/var/www/glpi/vendor/tecnickcom/tcpdf)
michelf/php-markdown in (/var/www/glpi/vendor/michelf/php-markdown/Michelf)
true/punycode in (/var/www/glpi/vendor/true/punycode/src)
iacaml/autolink in (/var/www/glpi/vendor/iamcal/lib_autolink)
sabre/vobject in (/var/www/glpi/vendor/sabre/vobject/lib)
phpCas version 1.3.3 in (/usr/share/php)

LDAP directories

Server: 'ldap://winserv01.carovana.lan', Port: '389', BaseDN: 'DC=carovana,DC=lan', Connection filter:
        '(&(objectClass=user)(objectCategory=person)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))', RootDN:
        'CN=GLPI,CN=Users,DC=carovana,DC=lan', Use TLS: none

SQL replicas

Not active

Notifications

Way of sending emails: PHP

Mails receivers

Plugins list

    barcode              Name: Barcode                        Version: 2.2.1      State: Enabled
    positions            Name: Cartography                    Version: 4.5.1      State: Enabled
    fusioninventory      Name: FusionInventory                Version: 9.3+1.3    State: Enabled
    openvas              Name: GLPi openvas Connector         Version: 1.2.0      State: Enabled
    pdf                  Name: Print to pdf                   Version: 1.4.0      State: Enabled
    printercounters      Name: Printer counters               Version: 1.5.0      State: Enabled
    reports              Name: Reports                        Version: 1.12.0     State: Enabled

Accordin to the FusionInventory instructions, I've also installed SNMP, nmap and NBname packages:

root@GLPI:/var/www# apt list --installed|egrep "nmap|snmp|nbname"

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libnet-nbname-perl/stable,now 0.26-1.2 all [installed]
libnet-snmp-perl/stable,now 6.0.1-2 all [installed]
libsnmp-base/stable,stable,now 5.7.3+dfsg-1.7+deb9u1 all [installed,automatic]
libsnmp30/stable,stable,now 5.7.3+dfsg-1.7+deb9u1 amd64 [installed,automatic]
nmap/stable,now 7.40-1 amd64 [installed]
php-snmp/stable,now 1:7.0+49 all [installed]
php7.0-snmp/stable,now 7.0.33-0+deb9u1 amd64 [installed,automatic]

Setting debug level = 2 in the FusionInventory config file I can see only nmap scan is performed and it can't be able to send info about device type so the GLPI rules reject entry missing device type....

[Sun Jan  6 21:02:14 2019][info] running task NetDiscovery
[Sun Jan  6 21:02:14 2019][debug] [http client] Using Compress::Zlib for compression
[Sun Jan  6 21:02:14 2019][debug2] [http client] sending message:
 <?xml version="1.0" encoding="UTF-8" ?>
<REQUEST>
  <CONTENT>
    <AGENT>
      <AGENTVERSION>2.4-2</AGENTVERSION>
      <START>1</START>
    </AGENT>
    <MODULEVERSION>2.6</MODULEVERSION>
    <PROCESSNUMBER>141</PROCESSNUMBER>
  </CONTENT>
  <DEVICEID>GLPI-2018-12-02-21-32-57</DEVICEID>
  <QUERY>NETDISCOVERY</QUERY>
</REQUEST>
[Sun Jan  6 21:02:15 2019][debug2] format: Zlib
[Sun Jan  6 21:02:15 2019][debug2] [http client] receiving message:
 <?xml version="1.0" encoding="UTF-8"?>
<REPLY>
</REPLY>
[Sun Jan  6 21:02:15 2019][debug] scanning block 192.168.10.54-192.168.10.54
[Sun Jan  6 21:02:15 2019][debug2] [http client] sending message:
 <?xml version="1.0" encoding="UTF-8" ?>
<REQUEST>
  <CONTENT>
    <AGENT>
      <NBIP>1</NBIP>
    </AGENT>
    <PROCESSNUMBER>141</PROCESSNUMBER>
  </CONTENT>
  <DEVICEID>GLPI-2018-12-02-21-32-57</DEVICEID>
  <QUERY>NETDISCOVERY</QUERY>
</REQUEST>
[Sun Jan  6 21:02:15 2019][debug2] format: Zlib
[Sun Jan  6 21:02:15 2019][debug2] [http client] receiving message:
 <?xml version="1.0" encoding="UTF-8"?>
<REPLY>
</REPLY>
[Sun Jan  6 21:02:15 2019][debug] creating 1 worker threads
[Sun Jan  6 21:02:16 2019][debug] [thread 1] creation
[Sun Jan  6 21:02:16 2019][debug] [thread 1] scanning 192.168.10.54:
[Sun Jan  6 21:02:16 2019][debug] [http server] request /status from client 127.0.0.1
[Sun Jan  6 21:02:16 2019][debug] [http server] response status 200
[Sun Jan  6 21:02:17 2019][debug] [thread 1] - scanning 192.168.10.54 with netbios: no result
[Sun Jan  6 21:02:18 2019][debug] [thread 1] - scanning 192.168.10.54 with nmap: success
[Sun Jan  6 21:02:18 2019][debug] [thread 1] termination
[Sun Jan  6 21:02:18 2019][debug2] [http client] sending message:
 <?xml version="1.0" encoding="UTF-8" ?>
<REQUEST>
  <CONTENT>
    <DEVICE>
      <DNSHOSTNAME>prn-ml-2955nd.carovana.lan</DNSHOSTNAME>
      <ENTITY>0</ENTITY>
      <IP>192.168.10.54</IP>
      <MAC>00:15:99:8e:66:0f</MAC>
      <NETPORTVENDOR>Samsung Electronics</NETPORTVENDOR>
    </DEVICE>
    <MODULEVERSION>2.6</MODULEVERSION>
    <PROCESSNUMBER>141</PROCESSNUMBER>
  </CONTENT>
  <DEVICEID>GLPI-2018-12-02-21-32-57</DEVICEID>
  <QUERY>NETDISCOVERY</QUERY>
</REQUEST>
[Sun Jan  6 21:02:18 2019][debug2] format: Zlib
[Sun Jan  6 21:02:18 2019][debug2] [http client] receiving message:
 <?xml version="1.0" encoding="UTF-8"?>
<REPLY>
</REPLY>
[Sun Jan  6 21:02:18 2019][debug2] [http client] sending message:
 <?xml version="1.0" encoding="UTF-8" ?>
<REQUEST>
  <CONTENT>
    <AGENT>
      <END>1</END>
    </AGENT>
    <MODULEVERSION>2.6</MODULEVERSION>
    <PROCESSNUMBER>141</PROCESSNUMBER>
  </CONTENT>
  <DEVICEID>GLPI-2018-12-02-21-32-57</DEVICEID>
  <QUERY>NETDISCOVERY</QUERY>
</REQUEST>
[Sun Jan  6 21:02:18 2019][debug2] format: Zlib
[Sun Jan  6 21:02:18 2019][debug2] [http client] receiving message:
 <?xml version="1.0" encoding="UTF-8"?>
<REPLY>
</REPLY>
[Sun Jan  6 21:02:18 2019][debug] cleaning 1 worker threads
[Sun Jan  6 21:02:18 2019][debug2] [http client] sending message:
 <?xml version="1.0" encoding="UTF-8" ?>
<REQUEST>
  <CONTENT>
    <AGENT>
      <END>1</END>
    </AGENT>
    <MODULEVERSION>2.6</MODULEVERSION>
    <PROCESSNUMBER>141</PROCESSNUMBER>
  </CONTENT>
  <DEVICEID>GLPI-2018-12-02-21-32-57</DEVICEID>
  <QUERY>NETDISCOVERY</QUERY>
</REQUEST>
[Sun Jan  6 21:02:18 2019][debug2] format: Zlib
[Sun Jan  6 21:02:18 2019][debug2] [http client] receiving message:
 <?xml version="1.0" encoding="UTF-8"?>
<REPLY>
</REPLY>
[Sun Jan  6 21:02:18 2019][debug] [http server] request /status from client 127.0.0.1
[Sun Jan  6 21:02:18 2019][debug] [http server] response status 200
[Sun Jan  6 21:02:19 2019][debug2] server target scheduled: Mon Jan  7 16:46:59 2019
[Sun Jan  6 21:02:21 2019][debug] [http server] request /status from client 127.0.0.1
[Sun Jan  6 21:02:21 2019][debug] [http server] response status 200

So, it's me that I'm doing something wrong or there's a problem in the plugin?

Thank you in advance

Eddie595 commented 5 years ago

Seems to be an issue here as well. My specs and libraries are identical as Dallo71 and I get a lot of hosts in my scan but nothing is imported.

Dallo71 commented 5 years ago

[Solved] I'm sorry but as I imagined, I made a stupid mistake: to make the SNMP scan work you have to add the authentication credentials in the IP Ranges. Manual at "3.2.2 - Target network creation" section says "If you want" but now I know it's mandatory...

listhai commented 12 months ago

I have the same problem, what can I do to import these not import devices