glpi-project / glpi-inventory-plugin

GLPI Inventory plugin
GNU Affero General Public License v3.0
46 stars 27 forks source link

glpi-netinventory gets blank xml-reply from HP MFP when using snmpv3 credentials #533

Closed bogachevd closed 1 month ago

bogachevd commented 3 months ago

Describe the bug

Successfully created NetDiscovery and NetInventory tasks on my server, got a pack of unmanaged devices, added one (HP LJ Pro MFP M428fdn) to Printers and Scheduled an SNMP Inventory task. Task finished succesfully, but nothing changed, no information about the printer was added. image

So I tried to launch a command directly from my agent. glpi-netinventory.bat --host 192.168.*.* --credentials version:3,username:snmptest,authpassword:"snmp1",authprotocol:sha,privpassword:"snmp2",privprotocol:aes --debug And got an answer from printer:

[debug] Current netinventory run expiration timeout: 1.0 hour                                                                               
[debug] using 1 netinventory worker                                                                                                         
[debug] #1, full snmp scan of 192.168.*.* with credentials 1                                                                              
<?xml version="1.0" encoding="UTF-8"?>                                                                                                      
<REQUEST>                                                                                                                                     
 <CONTENT>                                                                                                                                     
  <DEVICE>                                                                                                                                      
   <INFO>                                                                                                                                        
    <ID>0</ID>                                                                                                                                  
   </INFO>                                                                                                                                   
  </DEVICE>                                                                                                                                   
  <MODULEVERSION>6.1</MODULEVERSION>                                                                                                          
  <PROCESSNUMBER>1</PROCESSNUMBER>                                                                                                          
 </CONTENT>                                                                                                                                  
 <DEVICEID>foo</DEVICEID>                                                                                                                    
 <QUERY>SNMPQUERY</QUERY>                                                                                                                  
</REQUEST>                                                                                                                                  
[debug] #1, Netinventory worker terminated 

What I tried and what works for me:

What I tried and what doesn't work:

To reproduce

  1. Set SNMP v3 credentials on printer
  2. Launch glpi-netinventory.bat --host 192.168.*.* --credentials version:3,username:snmptest,authpassword:"snmp1",authprotocol:sha,privpassword:"snmp2",privprotocol:aes --debug from GLPI-Agent install path

Expected behavior

xml I get when using snmp v2c credentials (agent version 1.10):

<?xml version="1.0" encoding="UTF-8"?>
<REQUEST>
  <CONTENT>
    <DEVICE>
      <CARTRIDGES>
        <TONERBLACK>WARNING</TONERBLACK>
      </CARTRIDGES>
      <FIRMWARES>
        <DATE>2020-04-02</DATE>
        <DESCRIPTION>device firmware</DESCRIPTION>
        <MANUFACTURER>Hewlett-Packard</MANUFACTURER>
        <NAME>HP LaserJet Pro MFP M428fdn</NAME>
        <TYPE>device</TYPE>
        <VERSION>TETONXXXXN002.2014A.00</VERSION>
      </FIRMWARES>
      <INFO>
        <COMMENTS>HP ETHERNET MULTI-ENVIRONMENT</COMMENTS>
        <FIRMWARE>TETONXXXXN002.2014A.00</FIRMWARE>
        <ID>0</ID>
        <IPS>
          <IP>127.0.0.1</IP>
          <IP>192.168.*.*</IP>
        </IPS>
        <MAC>*:*:*:*:*:*</MAC>
        <MANUFACTURER>Hewlett-Packard</MANUFACTURER>
        <MEMORY>340</MEMORY>
        <MODEL>HP LaserJet Pro MFP M428fdn</MODEL>
        <NAME>HPD*</NAME>
        <RAM>340</RAM>
        <SERIAL>CNB*</SERIAL>
        <TYPE>PRINTER</TYPE>
        <UPTIME>30.37 seconds</UPTIME>
      </INFO>
      <PAGECOUNTERS>
        <DUPLEX>104</DUPLEX>
        <TOTAL>58697</TOTAL>
      </PAGECOUNTERS>
      <PORTS>
        <PORT>
          <IFDESCR>lo</IFDESCR>
          <IFINERRORS>0</IFINERRORS>
          <IFINOCTETS>215272871</IFINOCTETS>
          <IFINTERNALSTATUS>1</IFINTERNALSTATUS>
          <IFLASTCHANGE>0.00 seconds</IFLASTCHANGE>
          <IFMTU>65536</IFMTU>
          <IFNAME>lo</IFNAME>
          <IFNUMBER>1</IFNUMBER>
          <IFOUTERRORS>0</IFOUTERRORS>
          <IFOUTOCTETS>215272871</IFOUTOCTETS>
          <IFSPEED>10000000</IFSPEED>
          <IFSTATUS>1</IFSTATUS>
          <IFTYPE>24</IFTYPE>
          <IP>127.0.0.1</IP>
          <IPS>
            <IP>127.0.0.1</IP>
          </IPS>
        </PORT>
        <PORT>
          <IFDESCR>eth0</IFDESCR>
          <IFINERRORS>0</IFINERRORS>
          <IFINOCTETS>38903776</IFINOCTETS>
          <IFINTERNALSTATUS>1</IFINTERNALSTATUS>
          <IFLASTCHANGE>0.00 seconds</IFLASTCHANGE>
          <IFMTU>1500</IFMTU>
          <IFNAME>eth0</IFNAME>
          <IFNUMBER>2</IFNUMBER>
          <IFOUTERRORS>0</IFOUTERRORS>
          <IFOUTOCTETS>28375908</IFOUTOCTETS>
          <IFSPEED>100000000</IFSPEED>
          <IFSTATUS>1</IFSTATUS>
          <IFTYPE>6</IFTYPE>
          <IP>192.168.*.*</IP>
          <IPS>
            <IP>192.168.*.*</IP>
          </IPS>
          <MAC>*:*:*:*:*:*</MAC>
        </PORT>
      </PORTS>
    </DEVICE>
    <MODULEVERSION>6.3</MODULEVERSION>
    <PROCESSNUMBER>1</PROCESSNUMBER>
  </CONTENT>
  <DEVICEID>foo</DEVICEID>
  <QUERY>SNMPQUERY</QUERY>
</REQUEST>

Operating system

Windows, Linux

GLPI Agent version

1.0, Other (See additional context below)

GLPI version

Other (See additional context below)

GLPIInventory plugin

1.3.5

Additional context

Tested on GLPI-Agents v 1.7.1 and 1.10, GLPI version: 1.0.15

bogachevd commented 3 months ago

I think the problem is glpi-netinventory doesn't have "Context Name" parameter. image snmpwalk returns error when I remove -n Jetdirect from command. Is there any way to make glpi-netinventory work with snmp v3 and HP printers?

trasher commented 3 months ago

This seems rather an agent issue than a plugin one; please open a discussion on agent repository.

bogachevd commented 3 months ago

This seems rather an agent issue than a plugin one

I actually think it's a GLPI-server issue. "Context Name" is a valid snmpv3 parameter. Snmpwalk has it, some HP (and I think not only them) printers have it and require this parameter. Glpi doesn't have this parameter in Administration > Inventory > SNMP credentials at all. Ok, I got it, I'll try to open a discussion in a main repository.

github-actions[bot] commented 1 month ago

There has been no activity on this issue for some time and therefore it is considered stale and will be closed automatically in 7 days.

If this issue is related to a bug, please try to reproduce on latest release. If the problem persist, feel free to add a comment to revive this issue.

You may also consider taking a subscription to get professionnal support or contact GLPI editor team directly.