glpi-inventory-plugin icon indicating copy to clipboard operation
glpi-inventory-plugin copied to clipboard

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

Open bogachevd opened this issue 1 year ago • 4 comments

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:

  • using snmpv2c with glpi-netinventory.bat gives expected behavior: correct xml-output with printer info
  • using snmpwalk from linux machine with snmpv3 credentials gives expected behavior: correct file with OIDs

What I tried and what doesn't work:

  • changing auth and priv protocols for snmpv3 from sha to md5 and from aes to des in CLI and on device. If I intentionally change protocols to wrong I get <MESSAGE>SNMP communication error: authentication error on host 192.168.*.*</MESSAGE>
  • downgrading glpi-agent from 1.10 to 1.7.1
  • adding --type PRINTER to command just adds <TYPE>PRINTER</TYPE>
  • trying to launch glpi-netinventory from wsl gives the same bahavior: empty xml-reply
  • removing quotes from authpassword and privpassword and using simple strings gives the same behavior

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 avatar Jul 22 '24 07:07 bogachevd

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?

bogachevd avatar Jul 22 '24 11:07 bogachevd

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

trasher avatar Jul 29 '24 06:07 trasher

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.

bogachevd avatar Jul 29 '24 10:07 bogachevd

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.

github-actions[bot] avatar Sep 28 '24 08:09 github-actions[bot]