Discovery can't add nodes to the database

Hello! I have a new install of LibreNMS and have added a couple of devices via the GUI without problems. When I run a manual discovery, I can see that LibreNMS is connecting to various devices over SNMP, however when it tries to actually add the new nodes to the database, I get the error that it failed to add the host to the database. Running ./validate.php as it suggests shows everything is okay, and as I said before, I can add nodes manually through the GUI without problems. I’ve also tested that addhost.php adds a device properly.

A chunk of the log showing the discovery of the device and failure to add it to the DB can be seen at https://pastebin.com/iQj9J4Cz - names changed to protect the innnocent.

Can you post the full discovery output, I can’t tell the context to what you’ve posted so far as it looks like a mix of a normal discovery and auto-discovery.

The full output can be seen at https://pastebin.com/e3r502Qr - the part that seems to be making the discovery incomplete are the sections which end in the following

SQL[SELECT COUNT() FROM devices WHERE hostname = ‘pm1.somewhere.com’]
SQL[SELECT COUNT(
) FROM devices WHERE sysName = ‘pm1.somewhere.com’]
SQL[INSERT INTO devices (hostname,sysName,os,community,port,transport,status,snmpver,poller_group,status_reason,port_association_mode,authlevel,authname,authpass,authalgo,cryptopass,cryptoalgo,cryptoalso) VALUES (‘pm1.somewhere.com’,‘pm1.somewhere.com’,‘linux’,’’,‘161’,‘udp’,‘1’,‘v3’,‘0’,’’,‘1’,‘authPriv’,‘secret1’,‘secret2’,‘SHA’,‘secret3’,‘AES’,‘AES’)]
SQL[INSERT INTO eventlog (host,device_id,reference,type,datetime,severity,message,username) VALUES (‘1’,‘1’,‘NULL’,‘discovery’,NOW(),‘5’,‘ARP discovery of pm1.somewhere.com (10.10.8.21) failed - Failed to add host to the database, please run ./validate.php’,’’)]

Thanks!

validate your install
to validate your install run ./validate.php and then pastebin your results

Not enough to warrant pastebin…

[root@librenms librenms]# ./validate.php
==========================================================
Component | Version
--------- | -------
LibreNMS  | 5581c40e1989d32436d06e3161b2bedf115b5c20
DB Schema | 194
PHP       | 7.0.19
MySQL     | 5.5.52-MariaDB
RRDTool   | 1.4.8
SNMP      | NET-SNMP 5.7.2
==========================================================

[OK]    Database connection successful
[OK]    Database schema correct

do you have ARP Discovery on?

Yes - I turned ARP on. Any reason not to use the ARP tables to find other hosts on the network? I found it interesting that it is disabled by default…

ARP can be a big discovery process and isn’t usually needed in a network based environment where you just monitor network kit that runs xDP.

I am using LibreNMS to monitor server equipment rather than network equipment. After disabling ARP discovery, LibreNMS is no longer able to see any other devices during the discovery process, making the autodiscovery feature worthless to me. CDP is enabled on our vSphere virtual switched, so it should be good to go with the

Regardless of the discovery process used, there must be something keeping the discovered devices from being added to the database…

Have you configured the snmp credentials auto discovery should use to add these devices?

Yes - I’ve configured SNMP credentials, and you can see them working correctly in the output from the discovery command.

Run the sql query manually and see what it says:

INSERT INTO `devices` (`hostname`,`sysName`,`os`,`community`,`port`,`transport`,`status`,`snmpver`,`poller_group`,`status_reason`,`port_association_mode`,`authlevel`,`authname`,`authpass`,`authalgo`,`cryptopass`,`cryptoalgo`,`cryptoalso`) VALUES ('pm1.somewhere.com','pm1.somewhere.com','linux','','161','udp','1','v3','0','','1','authPriv','secret1','secret2','SHA','secret3','AES','AES');

So it looks like there may be a typo in the SQL query that discovery is using to add the node. When I run the query above, I get the error

ERROR 1054 (42S22): Unknown column 'cryptoalso' in 'field list'

Looking at the columns, there is no cryptoalso column in the table, and removing the erroneous column and unnecessary second value of 'AES" allows the SQL query to complete and the device is added without error.

What’s the preferred method to report this bug?

OK, so I found the problem - no need for a bug report. It appears that when I was configuring the snmp credentials in config.php, I mistyped cryptoalgo as cryptoalso. Once I fixed that, my discovery.php was able to add devices to the database without issues.

Thanks for the assistance with this one!

No probs, glad you got it sorted.