Snmpbulkwalk triggered from discovery.php tries to get non-existant OID on LLDP targets

Hi Gents,

first of all thank you for your amazing project.

Today i encountered an issue with LLDP autodiscovery in combination with lldpd 0.9.6 / snmpd 5.7.3 running on debian 9.6 as target. The error results in autodiscovery not being able to add the host and eventlog stating LLDP discovery of HOSTNAME (10.10.1.111) failed - Could not connect to HOSTNAME, please check the snmp details and snmp reachability . When manually running ./discovery.php -h all -d -m discovery-protocols you can see several snmpbulkwalk commands returning “No Such Object available on this agent at this OID”, which makes me believe is the reason for this error. https://p.libren.ms/view/94e18aba

Manual snmpbulkwalk commands against the target hosts with same v3 auth data are successful. Manual adding the hosts via snmp-scan.py does also work. (had to add “any v3” arguments in line 125 in scan-scan.py in order to get it working, but thats offtopic)
Switching from LLDP/XDP to ARP results in the same error. Currently im not sure if the error is in the configuration , in the discovery.php code or in the old lldpd/snmpd version debian 9 is running.
EDIT: maybe im also just missing the point of autodiscovery with librenms. After reading the docs and some related posts here i was under the impression that the manual/cron usage of snmp-scan.py to add hosts from a network is just an optional way, as autodiscovery pulls its “targets” from LLDP/ARP
EDIT2: related posts arehttps://community.librenms.org/t/autodiscovery-by-ip/2933/7 and Snmp-scan.py error

  • The output of ./validate.php

Component Version
LibreNMS 1.47
DB Schema 275
PHP 7.0.33-0+deb9u1
MySQL 10.1.37-MariaDB-0+deb9u1
RRDTool 1.6.0
SNMP NET-SNMP 5.7.3

====================================

[OK] Composer Version: 1.8.0
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
[WARN] Disk space where /srv/librenms/rrd is located is less than 512Mb
[WARN] Your RRD directory is not set to 0775
[FIX]:
chmod 775 /srv/librenms/rrd}
[WARN] Your install is over 24 hours out of date, last update: Sun, 30 Dec 2018 14:29:16 +0000
[FIX]:
Make sure your daily.sh cron is running and run ./daily.sh by hand to see if there are any errors.
[WARN] Your local git branch is not master, this will prevent automatic updates.
[FIX]:
You can switch back to master with git checkout master
[WARN] Your local git contains modified files, this could prevent automatic updates.
[FIX]:
You can fix this with ./scripts/github-remove
Modified Files:
bootstrap/cache/.gitignore
snmp-scan.py
storage/app/.gitignore
storage/app/public/.gitignore
storage/debugbar/.gitignore
storage/framework/cache/.gitignore
storage/framework/sessions/.gitignore
storage/framework/testing/.gitignore
storage/framework/views/.gitignore
storage/logs/.gitignore
[FAIL] Some folders have incorrect file permissions, this may cause issues.
[FIX]:
sudo chown -R librenms:librenms /srv/www/librenms/sites/public
sudo setfacl -d -m g::rwx /srv/librenms/rrd /var/log/librenms /srv/www/librenms/sites/public/bootstrap/cache/ /srv/www/librenms/sites/public/storage/
sudo chmod -R ug=rwX /srv/librenms/rrd /var/log/librenms /srv/www/librenms/sites/public/bootstrap/cache/ /srv/www/librenms/sites/public/storage/
Files:
/srv/www/librenms/sites/public/storage/framework/cache/data/a2/e3/a2e33a1054e69b8e67fdec79e8e92f7ef1097c07
s

Regards,
Flynn

The error you get in eventlog is not related to unknow snmp oids.

In your config.php, you should have defined your communities and LibreNMS will try to add those devices with those communities.

If the device is not network reachable or have a different community defined in the config.php it will not be added.

The error sais itself: LLDP discovery of HOSTNAME (10.10.1.111) failed - Could not connect to HOSTNAME, please check the snmp details and snmp reachability

That means that the hostname 10.10.1.111 was discovered by LLDP but LibreNMS cant connect to it using the configured communities.

Hi Doc,
thank you for your comment. As already stated above SNMP v3 configuration is defined in config.php and if I add the target hosts via “./snmp-scan.py” (which pulls snmp params from config.php, pings them and then passes it on to addhost.php) the hosts are successfuly added without providing manual snmp v3 credentials. Below you can see related part of my config.php

### SNMP configuration
$config['snmp']['version'] = "v3";
$config['snmp']['v3'][0]['cryptoalgo'] = "AES";
$config['snmp']['v3'][0]['authpass'] = "MYPASS";
$config['snmp']['v3'][0]['cryptopass'] = "MYPASS";
$config['snmp']['v3'][0]['authname'] = "MYNAME";
$config['snmp']['v3'][0]['authalgo'] = "SHA";
$config['snmp']['v3'][0]['authlevel'] = "authPriv";
$config['snmp']['community'] = array("public");

So if im not completly missing the point here, libreNMS should pull the snmpv3 creds and use them when trying to add a device (likely its using addhosts.php too?). However as you mentioned the communities, i checked the target hosts and they are only reachable with snmp v3 . v1 and v2c requests receive no answers. Is this maybe a problem?

Regards,
Flynn

It should… Can you try with snmp v2? Just for testing if it works as expected.

If it works with v2, that means something is wrong when trying to discover with v3 credentials.

Hi,

just switched target hosts to v2, commented all snmp v3 related parameters in config.php and it works like a charm. Switched again to v3 on target hosts and reactivated v3 parameters in config.php and its broken (https://p.libren.ms/view/3e9931f5). Manual adding via php addhost.php HOSTNAME any v3 works. Out of curiosity i dumped the traffic on the target host and then ran ./discovery.php -h all -m discovery-protocols -d . Turns out beside the fping icmp probes there are no snmp packets received. I double checked this with the sending interface of the librenms host and there are indeed no snmp packets send???
I suspect the problem is either related to parsing the v3 credentials as you mentioned or the data received from lldp is interpreted wrong.

Try switching the addhost snmp order to check v3 first. (v2c is the first currently)

$config['snmp']['version'] = ['v3', 'v2c', 'v1'];

Also, you might have set this to just v2c in your config.php.

Hi murrant,

thank you for your response. After switching the line

$config['snmp']['version'] = "v3";

with

$config['snmp']['version'] = ['v3', 'v2c', 'v1'];

the autodiscovery now works with v3. So the intended behaviour of the autodiscovery is to default to v2c, get data and then use v3 even if i explicitly state in config.php to only use v3?
or is this some rare situation im experiencing here with my “v2 disabled / v3 enabled” setup ?
anyway, thank you guys for your help.

Regards,
Flynn

When you addhost manually, you specify the snmp version while in discovery will take the config.php details.

I had troubles setting single values to config.php variables

Try
$config['snmp']['version'] = ['v3']";
or
$config['snmp']['version'] = array('v3');

instead

$config['snmp']['version'] = "v3";

Regards,

1 Like