New Nokia MPLS path visualisation issue during discovery on Nokia SAR

I ran into an issue with the new Nokia MPLS path visualisation feature https://github.com/librenms/librenms/pull/10936 added to master in v1.59. Looks like all works good on an 7750SR device, not on a 7705SAR.

During discovery I see the following error:

`SQL[select * from `mpls_lsp_paths` where `mpls_lsp_paths`.`device_id` = ? and `mpls_lsp_paths`.`device_id` is not null [319] 0.89ms]
    #0 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connection.php(624): Illuminate\Database\Connection->runQueryCallback('insert into `mp...', Array, Object(Closure))
    #1 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connection.php(459): Illuminate\Database\Connection->run('insert into `mp...', Array, Object(Closure))
    #2 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connection.php(411): Illuminate\Database\Connection->statement('insert into `mp...', Array)
    #3 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php(32): Illuminate\Database\Connection->insert('insert into `mp...', Array)
    #4 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2690): Illuminate\Database\Query\Processors\Processor->processInsertGetId(Object(Illuminate\Database\Query\Builder), 'insert into `mp...', Array, 'lsp_path_id')
    #5 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1353): Illuminate\Database\Query\Builder->insertGetId(Array, 'lsp_path_id')
    #6 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(839): Illuminate\Database\Eloquent\Builder->__call('insertGetId', Array)
    #7 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(804): Illuminate\Database\Eloquent\Model->insertAndSetId(Object(Illuminate\Database\Eloquent\Builder), Array)
    #8 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(667): Illuminate\Database\Eloquent\Model->performInsert(Object(Illuminate\Database\Eloquent\Builder))
    #9 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php(252): Illuminate\Database\Eloquent\Model->save()
    #10 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php(264): Illuminate\Database\Eloquent\Relations\HasOneOrMany->save(Object(App\Models\MplsLspPath))
    #11 /opt/librenms/LibreNMS/DB/SyncsModels.php(56): Illuminate\Database\Eloquent\Relations\HasOneOrMany->saveMany(Object(Illuminate\Support\Collection))
    #12 /opt/librenms/LibreNMS/Modules/Mpls.php(56): LibreNMS\Modules\Mpls->syncModels(Object(App\Models\Device), 'mplsLspPaths', Object(Illuminate\Support\Collection))
    #13 /opt/librenms/includes/discovery/mpls.inc.php(31): LibreNMS\Modules\Mpls->discover(Object(LibreNMS\OS\Timos))
    #14 /opt/librenms/includes/discovery/functions.inc.php(178): include('/opt/librenms/i...')
    #15 /opt/librenms/discovery.php(121): discover_device(Array, false)
    #16 {main}
    Error in mpls module. SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'mplsLspPathOperMetric' cannot be null (SQL: insert into `mpls_lsp_paths` (`lsp_id`, `path_oid`, `device_id`, `mplsLspPathRowStatus`, `mplsLspPathLastChange`, `mplsLspPathType`, `mplsLspPathBandwidth`, `mplsLspPathOperBandwidth`, `mplsLspPathAdminState`, `mplsLspPathOperState`, `mplsLspPathState`, `mplsLspPathFailCode`, `mplsLspPathFailNodeAddr`, `mplsLspPathMetric`, `mplsLspPathOperMetric`, `mplsLspPathTunnelARHopListIndex`, `mplsLspPathTunnelCHopListIndex`) values (431, 1, 319, active, 44280, primary, 0, 0, inService, inService, active, noError, 0.0.0.0, 400, ?, 4, 80))Preformatted text
    Runtime for discovery module 'mpls': 110.3000 seconds with 499320 bytes

Running discovery.php by hand gives me the following log:

#### Load disco module mpls ####

MPLS LSPs: SNMP['/usr/bin/snmpbulkwalk' '-v2c' '-c' 'COMMUNITY' '-OQUs' '-m' 'TIMETRA-MPLS-MIB' '-M' '/opt/librenms/mibs:/opt/librenms/mibs/nokia' '-t' '2' '-r' '3' 'udp:HOSTNAME:161' 'vRtrMplsLspTable'
]
SNMP['/usr/bin/snmpbulkwalk' '-v2c' '-c' 'COMMUNITY' '-OQUst' '-m' 'TIMETRA-MPLS-MIB' '-M' '/opt/librenms/mibs:/opt/librenms/mibs/nokia' '-t' '2' '-r' '3' 'udp:HOSTNAME:161' 'vRtrMplsLspLastChange']
.........
MPLS LSP Paths: SNMP['/usr/bin/snmpbulkwalk' '-v2c' '-c' 'COMMUNITY' '-OQUs' '-m' 'TIMETRA-MPLS-MIB' '-M' '/opt/librenms/mibs:/opt/librenms/mibs/nokia' '-t' '2' '-r' '3' 'udp:HOSTNAME:161' 'vRtrMplsLspPathTable']
SNMP['/usr/bin/snmpbulkwalk' '-v2c' '-c' 'COMMUNITY' '-OQUst' '-m' 'TIMETRA-MPLS-MIB' '-M' '/opt/librenms/mibs:/opt/librenms/mibs/nokia' '-t' '2' '-r' '3' 'udp:HOSTNAME:161' 'vRtrMplsLspPathLastChange'
]
#0 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connection.php(624): Illuminate\Database\Connection->runQueryCallback('insert into `mp...', Array, Object(Closure))
#1 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connection.php(459): Illuminate\Database\Connection->run('insert into `mp...', Array, Object(Closure))
#2 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connection.php(411): Illuminate\Database\Connection->statement('insert into `mp...', Array)
#3 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php(32): Illuminate\Database\Connection->insert('insert into `mp...', Array)
#4 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2690): Illuminate\Database\Query\Processors\Processor->processInsertGetId(Object(Illuminate\Database\Query\Builder), 'insert
 into `mp...', Array, 'lsp_path_id')
#5 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1353): Illuminate\Database\Query\Builder->insertGetId(Array, 'lsp_path_id')
#6 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(839): Illuminate\Database\Eloquent\Builder->__call('insertGetId', Array)
#7 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(804): Illuminate\Database\Eloquent\Model->insertAndSetId(Object(Illuminate\Database\Eloquent\Builder), Array)
#8 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(667): Illuminate\Database\Eloquent\Model->performInsert(Object(Illuminate\Database\Eloquent\Builder))
#9 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php(252): Illuminate\Database\Eloquent\Model->save()
#10 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php(264): Illuminate\Database\Eloquent\Relations\HasOneOrMany->save(Object(App\Models\MplsLspPath))
#11 /opt/librenms/LibreNMS/DB/SyncsModels.php(56): Illuminate\Database\Eloquent\Relations\HasOneOrMany->saveMany(Object(Illuminate\Support\Collection))
#12 /opt/librenms/LibreNMS/Modules/Mpls.php(56): LibreNMS\Modules\Mpls->syncModels(Object(App\Models\Device), 'mplsLspPaths', Object(Illuminate\Support\Collection))
#13 /opt/librenms/includes/discovery/mpls.inc.php(31): LibreNMS\Modules\Mpls->discover(Object(LibreNMS\OS\Timos))
#14 /opt/librenms/includes/discovery/functions.inc.php(178): include('/opt/librenms/i...')
#15 /opt/librenms/discovery.php(121): discover_device(Array, false)
#16 {main}
Error in mpls module. SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'mplsLspPathOperMetric' cannot be null (SQL: insert into `mpls_lsp_paths` (`lsp_id`, `path_oid`, `device_id`, `mplsL
spPathRowStatus`, `mplsLspPathLastChange`, `mplsLspPathType`, `mplsLspPathBandwidth`, `mplsLspPathOperBandwidth`, `mplsLspPathAdminState`, `mplsLspPathOperState`, `mplsLspPathState`, `mplsLspPathFailCode`, `m
plsLspPathFailNodeAddr`, `mplsLspPathMetric`, `mplsLspPathOperMetric`, `mplsLspPathTunnelARHopListIndex`, `mplsLspPathTunnelCHopListIndex`) values (431, 1, 319, active, 44280, primary, 0, 0, inService, inServ
ice, active, noError, 0.0.0.0, 400, ?, 4, 80))

>> Runtime for discovery module 'mpls': 98.4500 seconds with 499320 bytes
>> SNMP: [4/98.44s] MySQL: [0/0.00s] RRD: [0/0.00s]
#### Unload disco module mpls ####

After this error the MPLS discovery is ended directly while normally there should be more MIB’s to query like SDP etc.

I checked the output of the SNMP queries and I can indeed see that the mplsLspPathOperMetric is not in there while I can see it in the SR discovery. Is it possible to implement a work around for these missing mplsLspPathOperMetric values?

Pastebin for snmp output:
https://pastebin.com/Lmhby3xi

Hello,

I had the same issue on the 7705 SAR running versions from 6.0 to 9.0.

I did the following to allow a NULL value for the mpls_lsp_paths table.

ALTER TABLE mpls_lsp_paths CHANGE mplsLspPathOperMetric mplsLspPathOperMetric int(10) unsigned NULL ;

I have been meaning to open a issue, but I have been spending all my time working on distributed polling as I have over 180 of these routers.

1 Like

That is great. I would love to make a PR for this but I’m a bit in doubt. Is it correct that I should rename all files in the sql-schema directory, numbering 001.sql to 002.sql etc. and create a new 001.sql with this change. Furthermore no changes are needed to the build.sql file I guess.

I think we need to post the issue under https://github.com/librenms/librenms/pull/10936.

Craig

Please check that out https://github.com/librenms/librenms/pull/11021