You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2023-05-08 22:14:07

thyde.rsi
Member
Registered: 2021-12-07
Posts: 6

SNMP Credentials Blank

This is (or at least should be) linked to a side post regarding SNMP import failure - however the details of the issue are more specific to the new topic name. (Apologies if the post doesn't link correctly).

Using GLPI 10.0.3 on Debian 11, MariaDB, fresh install, GLPI Native inventory plugin from the Marketplace enabled and set up. Local agent inventory pulls in fine. SNMP/NetDiscovery is where we have failures. Logs for the agent tasks indicate "No Valid SNMP Credentials" being passed on.

Screenshot-2023-05-08-153351.png

Noting above screencap where there is an entry for an SNMP credential attached to the ip range, but no data returned for the SNMP credential or the version number.

A deep dive through the code brings me to inspecting the element and finding that that section of the page is rendered by:

<a class="nav-link justify-content-between pe-1 active" data-bs-toggle="tab" title="Associated SNMP credentials 1" href="/ajax/common.tabs.php?_target=/marketplace/glpiinventory/front/iprange.form.php&amp;_itemtype=PluginGlpiinventoryIPRange&amp;_glpi_tab=PluginGlpiinventoryIPRange_SNMPCredential$1&amp;id=7&amp;" data-bs-target="#tab-PluginGlpiinventoryIPRange_SNMPCredential_1-2108736603">Associated SNMP credentials <span class="badge">1</span></a>

and /marketplace/glpiinventory/front/iprange.form.php, which then gets us over to iprange_snmpcredential.class.php at which point a loop on $a_data tries to query and create a new SNMPCredential class instance for each entry.

$a_data is being populated by getAllDataFromTable....where plugin_glpiinventory_ipranges_id matches the id of the selected range, and in my particular case, that returns range ID #7 (correct) and this mysterious key plugin_glpiinventory_configsecurities_id - which I am unable to find referenced elsewhere, except for upgrade scripts where that similarly named table is dropped. And in my instance, glpi_plugin_glpiinventory_configsecurities is a non-existent table.

array(1) { [1]=> array(4) { ["id"]=> int(1) ["plugin_glpiinventory_ipranges_id"]=> int(7) ["plugin_glpiinventory_configsecurities_id"]=> int(0) ["rank"]=> int(1) } }

That above data appears to come from querying the table "glpi_plugin_glpiinventory_ipranges_snmpcredentials" - which shows the same data. If I manually update the table to change that configsecurities_id value to something else (eg: 'update glpi_plugin_glpiinventory_ipranges_snmpcredentials set plugin_glpiinventory_configsecurities_id = 1 where id = 1;'), the value comes in, but it doesn't seem to be crossreferenced to anything else, nor does any data from an SNMP credential become visible.

So... stuck trying to look at mysql failed query logs - of which there aren't any. My next step is nginx's error logs, which I did pull out:

 "PHP message: PHP Notice:  Undefined index: snmpcredentials_id in /xxxxxxxxx/glpi/marketplace/glpiinventory/inc/iprange_snmpcredential.class.php on line 234PHP message: PHP Notice:  Undefined index: snmpversion in /xxxxxxx/glpi/src/SNMPCredential.php on line 102" while reading upstream, client: xxxxxxxx, server: xxxxxxxxxxx, request: "GET /ajax/common.tabs.php?_target=/marketplace/glpiinventory/front/iprange.form.php&_itemtype=PluginGlpiinventoryIPRange&_glpi_tab=PluginGlpiinventoryIPRange_SNMPCredential$1&id=7& HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "xxxxxxxxxxxx", referrer: "https://xxxxxxxxxxxxx/marketplace/glpiinventory/front/iprange.form.php?id=7"

Ok, so now snmpcredentials_id doesn't exist in the array $data, (which is being used to get the credential name) and snmpversion also doesn't exist to satisfy a supplementary query for getRealVersion() inside of src/SNMPCredential.php

Which gets me to a complete dead-end. I am unable to find the query that SHOULD look at the valid table 'glpi_snmpcredentials' - which is where my snmp credentials are legitimately stored.

Any thoughts on how I can fix this?

Thanks,
Ted.

Offline

Board footer

Powered by FluxBB