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 2024-04-08 17:08:20

helicube
Member
Registered: 2024-04-08
Posts: 3

SNMP Credentials issues for SNMP Inventory

Hi

I'm trying to set up an SNMP inventory, but it's not working. There seems to be a problem when retrieving SNMP credentials from the "IP Range".

To do SNMP discovery and inventory, I use SNMPv3. I stored my SNMP credentials in "Administration > Inventory > SNMP credentials". It seems to work, I even checked the contents in the database.
Then I create my "IP range" in "Administration > GLPI Inventory > IP Ranges". But when I add SNMP credentials under the "Associated SNMP credentials" tab, the following error appears:

PHP Warning (2): Undefined array key "snmpcredentials_id" in /var/www/glpi/plugins/glpiinventory/inc/iprange_snmpcredential.class.php at line 173

And in the server logs (php-errors.log):

[2024-04-08 16:11:50] glpiphplog.WARNING:   *** PHP Warning (2): Undefined array key "snmpcredentials_id" in /var/www/glpi/plugins/glpiinventory/inc/iprange_snmpcredential.class.php at line 173
  Backtrace :
  ...entory/inc/iprange_snmpcredential.class.php:123 PluginGlpiinventoryIPRange_SNMPCredential->showItemForm()
  src/CommonGLPI.php:694                             PluginGlpiinventoryIPRange_SNMPCredential::displayTabContentForItem()
  ajax/common.tabs.php:120                           CommonGLPI::displayStandardTab()
  public/index.php:82                                require()

I installed the latest version of GLPI (10.0.14) and GLPI Inventory (1.3.5).
I think I had the same problem on the previous version, but I didn't get this explicit error message. It just showed me an authentication error when running the SNMP inventory task.

SNMP communication error: authentication error on host

Can someone help me please?

Offline

#2 2024-04-19 17:38:03

helicube
Member
Registered: 2024-04-08
Posts: 3

Re: SNMP Credentials issues for SNMP Inventory

Hello,

I still have the same problem.
I just noticed that I also have a SQL error appearing in the sql-errors.log file:

[2024-04-19 17:29:58] glpisqllog.WARNING: DBmysql::doQuery() in /var/www/glpi/src/DBmysql.php line 443
  *** MySQL query warnings:
  SQL: SELECT DISTINCT `glpi_snmpcredentials`.* FROM `glpi_snmpcredentials` WHERE `glpi_snmpcredentials`.`is_deleted` = '0' AND  NOT (`glpi_snmpcredentials`.`id` IN ('', '', '')) ORDER BY `glpi_snmpcredentials`.`name` LIMIT 100
  Warnings:
1292: Truncated incorrect DECIMAL value: ''
1292: Truncated incorrect DECIMAL value: ''
1292: Truncated incorrect DECIMAL value: ''
1292: Truncated incorrect DECIMAL value: ''
  Backtrace :
  src/DBmysqlIterator.php:112                        DBmysql->doQuery()
  src/DBmysql.php:1109                               DBmysqlIterator->execute()
  src/Dropdown.php:3347                              DBmysql->request()
  ajax/getDropdownValue.php:50                       Dropdown::getDropdownValue()
  public/index.php:82                                require()
  {"user":"11@glpi-serveur"}

Offline

#3 2024-04-24 10:32:35

helicube
Member
Registered: 2024-04-08
Posts: 3

Re: SNMP Credentials issues for SNMP Inventory

Hi,

I finally solved my problem. This was apparently caused by a column in a table that had not been renamed during a migration.

This is the “glpi_plugin_glpiinventory_ipranges_snmpcredentials” table which allows me to link my SNMP identifiers to the IP lists. One of the columns was named "plugin_glpiinventory_configsecurities_id" instead of "snmpcredentials_id".
This is apparently a name given in an old version, which I don’t understand because my installation is relatively recent (less than a year old). But it may be data retrieved from Fusion Inventory.

I tried to install the plugin again by doing a “php bin/console glpi:plugin:install --username=glpi glpiinventory”, but nothing happens. I manually ran the update.native.php script but it doesn't change anything.

So I simply renamed the column with the following command:

ALTER TABLE `glpi_plugin_glpiinventory_ipranges_snmpcredentials` CHANGE `plugin_glpiinventory_configsecurities_id` `snmpcredentials_id` INT(10) UNSIGNED NOT NULL DEFAULT '0';

It works fine. My credentials appear correctly when I link them to my IP range.

HOWEVER, when I restart my inventory task, my authentication-related error was still present in the logs. My inventory task still didn't work.

As I continued my research, I understood 2 things:
1 - To carry out a “network inventory”, you must first do a “network discovery”. The hardware is created by this discovery task then the different information (ports, components) is updated by the inventory task.
2 - The materials that I want to inventory already existed in my inventory. The new SNMP credentials should not bind to the old hardware. So, it was trying to log in with the old credentials, which couldn't work.

So, I simply deleted my old materials and restarted my discovery and inventory tasks. And it works!

Problem solved!

Offline

Board footer

Powered by FluxBB