Closed WebGregGit closed 2 years ago
Hi @WebGregGit
can you past here full log (--debug --debug
) for :
Can you limit discovery / inventory task / job to one printer (for easy debugging)
Best regards
Sure.
ping 1.x.x.3 64 bytes from 1.x.x.3: icmp_seq=1 ttl=254 time=2.09 ms 64 bytes from 1.x.x.3: icmp_seq=2 ttl=254 time=0.449 ms 64 bytes from 1.x.x.3: icmp_seq=3 ttl=254 time=0.638 ms
[debug] Logger backend Stderr initialized
[debug] GLPI Agent (1.4-1)
[debug] initializing job 1
[debug] initializing block 1.x.x.3-1.x.x.3
[debug] Current run expiration timeout: soon
[debug] creating 1 worker threads
[debug] [thread 1] creation
[debug] [thread 1] #1, scanning 1.x.x.3
[debug] [thread 1] #1, full match for sysobjectID .1.3.6.1.4.1.11.2.3.9.1 in database
[debug2] [thread 1] #1, /etc/glpi-agent/toolbox.yaml configuration not found
[debug] [thread 1] #1, sysobjectID match: hp-peripheral mib support enabled
[debug] [thread 1] #1, - scanning 1.x.x.3 with SNMP, credentials 1: success
[debug] [thread 1] #1, - scanning 1.x.x.3 with netbios: success
[debug] [thread 1] #1, - scanning 1.x.x.3 with echo ping: no result, ping not supported
[debug2] [thread 1] #1, executing arp -a 1.x.x.3
[debug] [thread 1] #1, - scanning 1.x.x.3 in arp table: no result
<?xml version="1.0" encoding="UTF-8" ?>
<REQUEST>
<CONTENT>
<DEVICE>
<AUTHPORT /> <AUTHPROTOCOL /> <AUTHSNMP>1</AUTHSNMP>
<CONTACT></CONTACT>
<DESCRIPTION>HP ETHERNET MULTI-ENVIRONMENT,SN:P...7,FN:6...S,SVCID:2...8,PID:HP LaserJet M402dne</DESCRIPTION>
<IP>1.x.x.3</IP>
<IPS>
<IP>1.x.x.3</IP>
</IPS>
<LOCATION></LOCATION>
<MAC>00:00:00:00:00:00</MAC>
<MANUFACTURER>Hewlett-Packard</MANUFACTURER>
<MODEL>HP LaserJet M402dn</MODEL>
<NETBIOSNAME>7</NETBIOSNAME>
<SERIAL>P...7</SERIAL>
<SNMPHOSTNAME>7</SNMPHOSTNAME>
<TYPE>PRINTER</TYPE>
<UPTIME>2 days, 09:48:05.00</UPTIME>
<WORKGROUP>WORKGROUP</WORKGROUP>
</DEVICE>
<MODULEVERSION>5.1</MODULEVERSION>
<PROCESSNUMBER>1</PROCESSNUMBER>
</CONTENT>
<DEVICEID>foo</DEVICEID>
<QUERY>NETDISCOVERY</QUERY>
</REQUEST>
[debug2] [thread 1] processed 1 scans
[debug] [thread 1] termination
[debug] All netdiscovery threads terminated
[debug] Logger backend Stderr initialized
[debug] GLPI Agent (1.4-1)
[debug] Current run expiration timeout: 1.0 hour
[debug] creating 1 worker threads
[debug] [thread 1] creation
[debug] [thread 1] #1, scanning 0: 1.x.x.3
[debug] [thread 1] #1, full match for sysobjectID .1.3.6.1.4.1.11.2.3.9.1 in database
[debug2] [thread 1] #1, /etc/glpi-agent/toolbox.yaml configuration not found
[debug] [thread 1] #1, sysobjectID match: hp-peripheral mib support enabled
<?xml version="1.0" encoding="UTF-8" ?>
<REQUEST>
<CONTENT>
<DEVICE>
<CARTRIDGES>
<TONERBLACK>27</TONERBLACK>
</CARTRIDGES>
<INFO>
<COMMENTS>HP ETHERNET MULTI-ENVIRONMENT,SN:P...7,FN:6...S,SVCID:2...8,PID:HP LaserJet M402dne</COMMENTS>
<CONTACT></CONTACT>
<ID>0</ID>
<IPS>
<IP>1.x.x.3</IP>
</IPS>
<LOCATION></LOCATION>
<MAC>...5d:c9:50</MAC>
<MANUFACTURER>Hewlett-Packard</MANUFACTURER>
<MEMORY>256</MEMORY>
<MODEL>HP LaserJet M402dn</MODEL>
<NAME>7</NAME>
<RAM>256</RAM>
<SERIAL>P...7</SERIAL>
<TYPE>PRINTER</TYPE>
<UPTIME>2 days, 09:53:56.00</UPTIME>
</INFO>
<PAGECOUNTERS>
<DUPLEX>3187</DUPLEX>
<TOTAL>20864</TOTAL>
</PAGECOUNTERS>
<PORTS>
<PORT>
<IFDESCR>LOOPBACK</IFDESCR>
<IFINERRORS>0</IFINERRORS>
<IFINOCTETS>32143174</IFINOCTETS>
<IFINTERNALSTATUS>1</IFINTERNALSTATUS>
<IFLASTCHANGE>0.00 seconds</IFLASTCHANGE>
<IFMTU>1500</IFMTU>
<IFNAME>LOOPBACK</IFNAME>
<IFNUMBER>1</IFNUMBER>
<IFOUTERRORS>0</IFOUTERRORS>
<IFOUTOCTETS>32143174</IFOUTOCTETS>
<IFSPEED>0</IFSPEED>
<IFSTATUS>1</IFSTATUS>
<IFTYPE>24</IFTYPE>
</PORT>
<PORT>
<IFDESCR>Ethernet</IFDESCR>
<IFINERRORS>0</IFINERRORS>
<IFINOCTETS>50832204</IFINOCTETS>
<IFINTERNALSTATUS>1</IFINTERNALSTATUS>
<IFLASTCHANGE>0.00 seconds</IFLASTCHANGE>
<IFMTU>1500</IFMTU>
<IFNAME>Ethernet</IFNAME>
<IFNUMBER>2</IFNUMBER>
<IFOUTERRORS>0</IFOUTERRORS>
<IFOUTOCTETS>648857</IFOUTOCTETS>
<IFSPEED>10000000</IFSPEED>
<IFSTATUS>1</IFSTATUS>
<IFTYPE>6</IFTYPE>
<IP>1.x.x.3</IP>
<IPS>
<IP>1.x.x.3</IP>
</IPS>
<MAC>...5d:c9:50</MAC>
</PORT>
</PORTS>
</DEVICE>
<MODULEVERSION>5.1</MODULEVERSION>
<PROCESSNUMBER>1</PROCESSNUMBER>
</CONTENT>
<DEVICEID>foo</DEVICEID>
<QUERY>SNMPQUERY</QUERY>
</REQUEST>
[debug] [thread 1] termination
[debug] All netinventory threads terminated
The Network ports view
This is what it looked like in version 9.5.6
And here is the port view in the version from the issue, but before deleting the printer and re-importing it.
It looks like it is displaying everything instead of the network port - network port and management ports.
I also have a Sharp printer but it is offline at the moment so I am not able to say if the amount of data displayed will change. For now, it only displays the management port.
Hi @WebGregGit
Unless I'm wrong, but with FusionInventory (and GLPI 9.5.x) there was no notion of management port
Now with native inventory we have it
Management port on your instance because from
netDiscoery
ARP table did not respond[debug] [thread 1] #1, - scanning 1.x.x.3 in arp table: no result
But we get it from
netInventory
I need to check for a fix
Why IP is displayed three times:
because we have three IPAddress
attached to printer
| 71 | 0 | 21 | NetworkName | 4 | 10.100.0.3 | 0 | 0 | 65535 | 174325763 | 0 | 1 | 4 | Printer |
| 72 | 0 | 22 | NetworkName | 4 | 10.100.0.3 | 0 | 0 | 65535 | 174325763 | 0 | 1 | 4 | Printer |
| 73 | 0 | 23 | NetworkName | 4 | 10.100.0.3 | 0 | 0 | 65535 | 174325763 | 0 | 1 | 4 | Printer |
+----+-------------+----------+-------------+---------+---------------------------------------+------------+-----------+------------+------------+------------+------------+--------------+--------------+
related to three networkPort
+----+----------+----------+-------------+--------------+----------------+------------+----------------------+-------------------+---------+------------+------------+---------------------+---------------------+-------+----------+------------------+--------------------+--------------+-----------+------------+------------+-------------+----------+----------+---------+------------+-------+--------+
| id | items_id | itemtype | entities_id | is_recursive | logical_number | name | instantiation_type | mac | comment | is_deleted | is_dynamic | date_mod | date_creation | ifmtu | ifspeed | ifinternalstatus | ifconnectionstatus | iflastchange | ifinbytes | ifinerrors | ifoutbytes | ifouterrors | ifstatus | ifdescr | ifalias | portduplex | trunk | lastup |
+----+----------+----------+-------------+--------------+----------------+------------+----------------------+-------------------+---------+------------+------------+---------------------+---------------------+-------+----------+------------------+--------------------+--------------+-----------+------------+------------+-------------+----------+----------+---------+------------+-------+--------+
| 21 | 4 | Printer | 0 | 0 | 0 | Management | NetworkPortAggregate | 00:00:00:00:00:00 | NULL | 0 | 1 | 2022-07-07 14:18:42 | 2022-07-07 14:18:42 | 0 | 0 | NULL | 0 | NULL | 0 | 0 | 0 | 0 | NULL | NULL | NULL | NULL | 0 | NULL |
| 24 | 4 | Printer | 0 | 0 | 0 | Management | NetworkPortAggregate | 5d:c9:50:5d:c9:50 | NULL | 0 | 1 | 2022-07-07 14:57:34 | 2022-07-07 14:57:34 | 0 | 0 | NULL | 0 | NULL | 0 | 0 | 0 | 0 | NULL | NULL | NULL | NULL | 0 | NULL |
| 25 | 4 | Printer | 0 | 0 | 2 | Ethernet | NetworkPortEthernet | 5d:c9:50:5d:c9:50 | NULL | 0 | 1 | 2022-07-07 14:57:34 | 2022-07-07 14:57:34 | 1500 | 10000000 | 1 | 0 | 0.00 seconds | 50832204 | 0 | 648857 | 0 | 1 | Ethernet | NULL | NULL | 0 | NULL |
+----+----------+----------+-------------+--------------+----------------+------------+----------------------+-------------------+---------+------------+------------+---------------------+---------------------+-------+----------+------------------+--------------------+--------------+-----------+------------+------------+-------------+----------+----------+---------+------------+-------+--------+
Two Aggregate
for managment port, and one for Ethernet
I don't know if possible de limit scope to Ethernet
only.
Best regards
For
[debug] [thread 1] #1, - scanning 1.x.x.3 in arp table: no result
can you run this (from the server that does the SNMP discovery and inventory)
arp -a
Did you see printer IP ?
can you try to ping printer (from the server that does the SNMP discovery and inventory)
Have you a result ?
If sever have no response from ping
he can't populate arp table.
Hi @stonebuzz
because we have three
IPAddress
attached to printer
That's what I thought. However, it seems unnecessary to repeat the same address. Displaying multiple addresses only makes sense if they are different (e.g. Ethernet + WiFi)...
I don't know if possible de limit scope to
Ethernet
only.
... so maybe this way? Addition of the condition that if the address is the same, do not display it?
can you run this (from the server that does the SNMP discovery and inventory)
ping 1.x.x.3
64 bytes from 1.x.x.3: icmp_seq=1 ttl=254 time=2.09 ms
64 bytes from 1.x.x.3: icmp_seq=2 ttl=254 time=0.449 ms
64 bytes from 1.x.x.3: icmp_seq=3 ttl=254 time=0.638 ms
arp -a
Here I don't have 1.x.x.3
So I checked for another printer that shows up in arp (but it doesn't change much - it only removes the message about "no result", but the inventory is the same).
[debug] Logger backend Stderr initialized
[debug] GLPI Agent (1.4-1)
[debug] initializing job 1
[debug] initializing block 1.x.x.7-1.x.x.7
[debug] Current run expiration timeout: soon
[debug] creating 1 worker threads
[debug] [thread 1] creation
[debug] [thread 1] #1, scanning 1.x.x.7
[debug] [thread 1] #1, full match for sysobjectID .1.3.6.1.4.1.11.2.3.9.1 in database
[debug2] [thread 1] #1, /etc/glpi-agent/toolbox.yaml configuration not found
[debug] [thread 1] #1, sysobjectID match: hp-peripheral mib support enabled
[debug] [thread 1] #1, - scanning 1.x.x.7 with SNMP, credentials 1: success
[debug] [thread 1] #1, - scanning 1.x.x.7 with netbios: success
[debug] [thread 1] #1, - scanning 1.x.x.7 with echo ping: no result, ping not supported
[debug2] [thread 1] #1, executing arp -a 1.x.x.7
[debug] [thread 1] #1, - scanning 1.x.x.7 in arp table: success
<?xml version="1.0" encoding="UTF-8" ?>
<REQUEST>
<CONTENT>
<DEVICE>
<AUTHPORT /> <AUTHPROTOCOL /> <AUTHSNMP>1</AUTHSNMP>
<CONTACT>p403</CONTACT>
<DESCRIPTION>HP ETHERNET MULTI-ENVIRONMENT,SN:...1JK,FN:...76X,SVCID:...71,PID:HP LaserJet P2015</DESCRIPTION>
<IP>1.x.x.7</IP>
<IPS>
<IP>1.x.x.7</IP>
</IPS>
<LOCATION>Boise, ID, USA</LOCATION>
<MAC>...6:00:22</MAC>
<MANUFACTURER>Hewlett-Packard</MANUFACTURER>
<MODEL>HP LaserJet P2015 Series</MODEL>
<NETBIOSNAME>4</NETBIOSNAME>
<SERIAL>...JK</SERIAL>
<SNMPHOSTNAME>4</SNMPHOSTNAME>
<TYPE>PRINTER</TYPE>
<UPTIME>3 days, 09:12:51.24</UPTIME>
</DEVICE>
<MODULEVERSION>5.1</MODULEVERSION>
<PROCESSNUMBER>1</PROCESSNUMBER>
</CONTENT>
<DEVICEID>foo</DEVICEID>
<QUERY>NETDISCOVERY</QUERY>
</REQUEST>
[debug2] [thread 1] processed 1 scans
[debug] [thread 1] termination
[debug] All netdiscovery threads terminated
I don't know why I get:
[debug] [thread 1] #1, - scanning 1.x.x.7 with echo ping: no result, ping not supported
because:
PING 1.x.x.7 (1.x.x.7) 56(84) bytes of data.
64 bytes from 1.x.x.7: icmp_seq=1 ttl=254 time=0.350 ms
64 bytes from 1.x.x.7: icmp_seq=2 ttl=254 time=0.348 ms
64 bytes from 1.x.x.7: icmp_seq=3 ttl=254 time=0.376 ms
[debug] Logger backend Stderr initialized
[debug] GLPI Agent (1.4-1)
[debug] Current run expiration timeout: 1.0 hour
[debug] creating 1 worker threads
[debug] [thread 1] creation
[debug] [thread 1] #1, scanning 0: 1.x.x.7
[debug] [thread 1] #1, full match for sysobjectID .1.3.6.1.4.1.11.2.3.9.1 in database
[debug2] [thread 1] #1, /etc/glpi-agent/toolbox.yaml configuration not found
[debug] [thread 1] #1, sysobjectID match: hp-peripheral mib support enabled
<?xml version="1.0" encoding="UTF-8" ?>
<REQUEST>
<CONTENT>
<DEVICE>
<CARTRIDGES>
<TONERBLACK>0</TONERBLACK>
</CARTRIDGES>
<INFO>
<COMMENTS>HP ETHERNET MULTI-ENVIRONMENT,SN:...1JK,FN:...6X,SVCID:...71,PID:HP LaserJet P2015</COMMENTS>
<CONTACT></CONTACT>
<ID>0</ID>
<IPS>
<IP>1.x.x.7</IP>
</IPS>
<LOCATION></LOCATION>
<MAC>...6:00:22</MAC>
<MANUFACTURER>Hewlett-Packard</MANUFACTURER>
<MEMORY>32</MEMORY>
<MODEL>HP LaserJet P2015 Series</MODEL>
<NAME>4</NAME>
<RAM>32</RAM>
<SERIAL>...1JK</SERIAL>
<TYPE>PRINTER</TYPE>
<UPTIME>3 days, 09:19:52.66</UPTIME>
</INFO>
<PAGECOUNTERS>
<DUPLEX>8209</DUPLEX>
<TOTAL>95030</TOTAL>
</PAGECOUNTERS>
<PORTS>
<PORT>
<IFDESCR>LOOPBACK</IFDESCR>
<IFINERRORS>0</IFINERRORS>
<IFINOCTETS>86798447</IFINOCTETS>
<IFINTERNALSTATUS>1</IFINTERNALSTATUS>
<IFLASTCHANGE>0.00 seconds</IFLASTCHANGE>
<IFMTU>1500</IFMTU>
<IFNAME>LOOPBACK</IFNAME>
<IFNUMBER>1</IFNUMBER>
<IFOUTERRORS>0</IFOUTERRORS>
<IFOUTOCTETS>86798595</IFOUTOCTETS>
<IFSPEED>0</IFSPEED>
<IFSTATUS>1</IFSTATUS>
<IFTYPE>24</IFTYPE>
</PORT>
<PORT>
<IFDESCR>Ethernet</IFDESCR>
<IFINERRORS>0</IFINERRORS>
<IFINOCTETS>572388305</IFINOCTETS>
<IFINTERNALSTATUS>1</IFINTERNALSTATUS>
<IFLASTCHANGE>18.86 seconds</IFLASTCHANGE>
<IFMTU>1500</IFMTU>
<IFNAME>Ethernet</IFNAME>
<IFNUMBER>2</IFNUMBER>
<IFOUTERRORS>0</IFOUTERRORS>
<IFOUTOCTETS>3260669</IFOUTOCTETS>
<IFSPEED>10000000</IFSPEED>
<IFSTATUS>1</IFSTATUS>
<IFTYPE>6</IFTYPE>
<IP>1.x.x.7</IP>
<IPS>
<IP>1.x.x.7</IP>
</IPS>
<MAC>...6:00:22</MAC>
</PORT>
</PORTS>
</DEVICE>
<MODULEVERSION>5.1</MODULEVERSION>
<PROCESSNUMBER>1</PROCESSNUMBER>
</CONTENT>
<DEVICEID>foo</DEVICEID>
<QUERY>SNMPQUERY</QUERY>
</REQUEST>
[debug] [thread 1] termination
[debug] All netinventory threads terminated
Unless I'm wrong, but with FusionInventory (and GLPI 9.5.x) there was no notion of management port
I think you are not. This was a screenshot of GLPI 9.5.6 + Fusioninventory 9.5.0+1.0 :) BTW with Fusioninventory the "Plugins - FusInv - SNMP credentials" column was available. Very useful because it allows you to identify which community name was used (if several are used). Now not available.
Hi @WebGregGit
I can only talk for the 00:00:00:00:00:00
mac address problem there's maybe a bug in the agent related to Netbios support.
Can you apply the following patch on your agent ?
diff --git a/lib/GLPI/Agent/Task/NetDiscovery.pm b/lib/GLPI/Agent/Task/NetDiscovery.pm
+++ b/lib/GLPI/Agent/Task/NetDiscovery.pm
@@ -643,6 +643,8 @@ sub _scanAddressByNetbios {
$device{MAC} = $ns->mac_address();
$device{MAC} =~ tr/-/:/;
+ $device{MAC} = getCanonicalMacAddress($device{MAC});
+ delete $device{MAC} unless defined($device{MAC});
return %device;
}
And tell us if it fixes the 00:00:00:00:00:00
mac address problem.
Thx
Hi @WebGregGit
for duplicate IP
from Printer
list,
can you try this -> https://github.com/glpi-project/glpi/pull/12171
Best regards
Hi @g-bougard - what and where should i change (agent installed on Ubuntu)? I don't understand.
Hi @stonebuzz - better. I see one IP now, but still several MACs :)
I cannot check if the printer will also have wifi enabled - whether two addresses will be displayed.
@WebGregGit
I cannot check if the printer will also have wifi enabled - whether two addresses will be displayed.
Yes, we only exclude NetworkPortAggregate
, and Wifi Address should be different (i guess)
For duplicate MAC from list view
you need this -> https://github.com/glpi-project/glpi/pull/12172
Best regards
@WebGregGit for Glpi-Agent patch
go to this folder
ce /usr/share/glpi-agent/lib/GLPI/Agent/Task/
Modify NetDiscovery.pm
line 643 by adding this
$device{MAC} = getCanonicalMacAddress($device{MAC});
delete $device{MAC} unless defined($device{MAC});
after
$device{MAC} =~ tr/-/:/;
then restart agent
service glpi-agent restart
and finally
completely remove printer (with empty mac) , re-run only netDiscovery
to check if MAC from management port is OK
@stonebuzz
you need this -> glpi-project/glpi#12172
Column 'instantiation_type' in on clause is ambiguous
$device{MAC} = getCanonicalMacAddress($device{MAC}); delete $device{MAC} unless defined($device{MAC});
Added > glpi-agent service restartet > NetDiscovery Task has been launched > I still have 00:00:00:00:00:00
.
So I deleted the printer> started the discovery job> inventory > no 00:00:00:00:00:00
mac.
BTW - I will write only for confirmation - after running the discovery task, the IP address in the table did not appear (although it was detected for the management port). It appeared in the table only after the inventory task was completed.
@WebGregGit can you apply this -> https://github.com/glpi-project/glpi/pull/12176 (without revert https://github.com/glpi-project/glpi/pull/12172 and https://github.com/glpi-project/glpi/pull/12171)
Thanks for testing glpi-agent patch @g-bougard any idea ?
@stonebuzz It looks great now
@g-bougard - I don't see mac 00:00:00:00:00:00
entries anymore. Maybe it took more time to apply the change?
More specifically...
In this view, I can see:
But it doesn't appear in the assets table anymore:
In fact, discovery get an empty MAC (from arp) and its added, from inventory MAC is found ( from snmp) but glpi add it as a new management port, because of different MAC....
We need to improve this part on glpi-agent side
Hi @WebGregGit
for an ubuntu agent, you must apply my patch on the file located at /usr/share/glpi-agent/lib/GLPI/Agent/Task/Task/NetDiscovery.pm
.
Hi, I'm experiencing the same problem. From what I've analyzed, I believe that this occurs when a switch is included in the automatic inventory. In this way, a rule is triggered (Rules for import and link equipments - GLOBAL) that relates the MAC of the switch port to the IP and creates duplicates. The management port is created by this rule and serves to indicate which switch this device is connected to.
Hi @jpdenss Managmement Port is always created if possible by inventory.
I don't have these rules, I use the native rules of the plugin and management port is created
Best regards
Hi @WebGregGit
Hi
Found better way to
Please revert this patch : https://github.com/glpi-project/glpi/pull/12171 https://github.com/glpi-project/glpi/pull/12172 https://github.com/glpi-project/glpi/pull/12176
And follow the guide here -> https://github.com/glpi-project/glpi-inventory-plugin/issues/189
I close this issue.
Best regards
Describe the bug
Hi @stonebuzz I read Your comment from https://github.com/glpi-project/glpi-inventory-plugin/issues/175 "Then, remove all assets only created by discovery and without IPs (IP are needed for SNMP Inventory by IP Range, glpiinventory can't retrieve target without )"
But my printers have IP addresses and they are not inventoried too. I have to delete them and import them again.
All printers are online. The first two were deleted and imported again (so there is an inventory date). The printer named 6 is before deleting. Only 1 IP address is displayed for this printer. Two printers for which inventory works have so much IP addresses as MAC addresses (even if the mac address is all zeros)
To reproduce
Expected behavior
As before, only one (used) IP and MAC addresses are displayed.
Operating system
Linux
GLPI Agent version
1.4
GLPI version
10.0.2
GLPIInventory plugin
1.0.3
Additional context
GLPI - the nightly build of yesterday