ISAM Ports - empty graphs

Hi All,
Thanks for looking. Sorry novice question below…

I have LibreNMS set up to monitor a number of Nokia ISAM nodes - (R5.3.02 NFXS-D FANT-F ALCATEL-LUCENT ISAM)

The discovery has identified all the interfaces yet my graphs for these interfaces are empty.

Trying to understand what is going on behind the scenes, I ran a debug discovery and spotted

/usr/bin/snmpbulkwalk’ ‘-v2c’ ‘-c’ ‘COMMUNITY’ ‘-OQUs’ ‘-m’ ‘IF-MIB’ ‘-M’ ‘/opt/librenms/mibs:/opt/librenms/mibs/nokia’ ‘udp:HOSTNAME:161’ ‘ifXEntry’

I ran this manually and I see this amongst the output

(67108864 is just an example index)

Line 1: ifName.67108864 = P2P Ethernet interface
Line 511: ifHCInOctets.67108864 = "00 00 4B 67 50 D8 5A 52 "
Line 551: ifHCInUcastPkts.67108864 = "00 00 00 6D 97 50 30 CD "
Line 591: ifHCInMulticastPkts.67108864 = "00 00 00 00 00 15 A4 65 "
Line 631: ifHCInBroadcastPkts.67108864 = "00 00 00 00 00 2B 36 05 "
Line 671: ifHCOutOctets.67108864 = "00 03 E0 5A 7E 35 A3 63 "
Line 711: ifHCOutUcastPkts.67108864 = "00 00 00 BD 71 4D 57 A3 "
Line 751: ifHCOutMulticastPkts.67108864 = "00 00 00 00 02 8B 4E CC "
Line 791: ifHCOutBroadcastPkts.67108864 = "00 00 00 00 01 7E 86 24 "
Line 831: ifLinkUpDownTrapEnable.67108864 = enabled
Line 1489: ifHighSpeed.67108864 = 1000
Line 1561: ifPromiscuousMode.67108864 = true
Line 1597: ifConnectorPresent.67108864 = true

Now this is where my novice hat is worn, I’ve not come across an output for ifHCInOctets / ifHCOutOctets written in HEX. Does the poller script automatically handle this and covert it into decimal? Or is there something I need to enable to perform this magic to get my graphs working?

Thanks
Mark

I think this is “possibly” what I need but I’m unsure if this is the correct way to do it.

If I add this to nokia-isam.inc.php, would this give me the output Im looking for?

foreach (array ( 'ifHCInOctets','ifHCInUcastPkts','ifHCInMulticastPkts','ifHCInBroadcastPkts','ifHCOutOctets','ifHCOutUcastPkts','ifHCOutMulticastPkts','ifHCOutBroadcastPkts') as $oid_HEX_Object) {	
	$port_stats[$index][$oid_HEX_Object] = hexdecs(preg_replace("/[^0-9A-Fa-f]/", '', $port_stats[$index][$oid_HEX_Object]))
}

// -- SOURCE https://www.php.net/manual/en/function.hexdec.php
function hexdecs($hex)
{
    // ignore non hex characters
    $hex = preg_replace('/[^0-9A-Fa-f]/', '', $hex);
   
    // converted decimal value:
    $dec = hexdec($hex);
   
    // maximum decimal value based on length of hex + 1:
    //   number of bits in hex number is 8 bits for each 2 hex -> max = 2^n
    //   use 'pow(2,n)' since '1 << n' is only for integers and therefore limited to integer size.
    $max = pow(2, 4 * (strlen($hex) + (strlen($hex) % 2)));
   
    // complement = maximum - converted hex:
    $_dec = $max - $dec;
   
    // if dec value is larger than its complement we have a negative value (first bit is set)
    return $dec > $_dec ? -$_dec : $dec;
}

I think I got this working as I now have data in my graphs.

Only thing I cant see is realtime graphs…

Can someone please check that this will not break anything?

/opt/librenms/includes/polling/ports/os/nokia-isam.inc.php

<?php
/**
* nokia-isam.inc.php
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*
* @package    LibreNMS
* @link       http://librenms.org
* @copyright  2019 Vitali Kari
* @author     Vitali Kari <[email protected]>
*/

// Use proprietary asamIfExtCustomerId as ifAlias for Nokia ISAM Plattform. The default IF-MIB fields are here quite meaningless
$isam_port_stats = snmpwalk_cache_oid($device, 'asamIfExtCustomerId', [], 'ITF-MIB-EXT', 'nokia-isam');

foreach ($isam_port_stats as $index => $value) {
    $port_stats[$index]['ifAlias'] = $isam_port_stats[$index]['asamIfExtCustomerId'];
	
	foreach (array ( 'ifHCInOctets','ifHCInUcastPkts','ifHCInMulticastPkts','ifHCInBroadcastPkts','ifHCOutOctets','ifHCOutUcastPkts','ifHCOutMulticastPkts','ifHCOutBroadcastPkts') as $oid_HEX_Object) {	
		$port_stats[$index][$oid_HEX_Object] = hexdecs(preg_replace("/[^0-9A-Fa-f]/", '', $port_stats[$index][$oid_HEX_Object]));
	}	
	
	
}


unset($isam_ports_stats);


// -- SOURCE https://www.php.net/manual/en/function.hexdec.php
function hexdecs($hex)
{
    // ignore non hex characters
    $hex = preg_replace('/[^0-9A-Fa-f]/', '', $hex);
   
    // converted decimal value:
    $dec = hexdec($hex);
   
    // maximum decimal value based on length of hex + 1:
    //   number of bits in hex number is 8 bits for each 2 hex -> max = 2^n
    //   use 'pow(2,n)' since '1 << n' is only for integers and therefore limited to integer size.
    $max = pow(2, 4 * (strlen($hex) + (strlen($hex) % 2)));
   
    // complement = maximum - converted hex:
    $_dec = $max - $dec;
   
    // if dec value is larger than its complement we have a negative value (first bit is set)
    return $dec > $_dec ? -$_dec : $dec;
}

Hi @Mark_Kneen

I have exactly the same issue with Nokia ISAM. Will try to apply your fix to see if it also fixes it on my end.

MOD: after the modification, the ethernet (uplink) interfaces started to poll the correct stats, but nor the “nokia CGLT-C PHYSICALUNI” nor the “nokia CGLT-C PON” interfaces are not indicating any data.

Further analyzing the output, the reason why there is no data in at the "“nokia CGLT-C PHYSICALUNI” nor the “nokia CGLT-C PON” interfaces is because the unit is not reporting them:

The interface description looks like this (would be lovely if uploading of text files would be allowed…), data is from the IF-MIB:

Sent GET request to 10.10.10.1 : 161 
ifDescr.131072
Ethernet Link
ifDescr.262144
Ethernet Link
ifDescr.393216
Ethernet Link
ifDescr.4325376
LAG Interface Link
ifDescr.4456448
LAG Interface Link
ifDescr.12713984
Bridge
ifDescr.14811156
VlanPort
ifDescr.14811236
VlanPort
ifDescr.14811336
VlanPort
ifDescr.14811436
VlanPort
ifDescr.20971520
Nokia ASAM, Software Loopback interface
ifDescr.20972544
Nokia ASAM, OAM IP interface
ifDescr.20973056
Nokia ASAM, OAM IP interface
ifDescr.20973568
Nokia ASAM, OAM IP interface
ifDescr.33554464
nokia CGLT-C PHYSICALUNI
ifDescr.33554465
nokia CGLT-C PHYSICALUNI
ifDescr.33554466
nokia CGLT-C PHYSICALUNI
ifDescr.33554467
nokia CGLT-C PHYSICALUNI
ifDescr.33554468
nokia CGLT-C PHYSICALUNI
ifDescr.33554469
nokia CGLT-C PHYSICALUNI
ifDescr.33554470
nokia CGLT-C PHYSICALUNI
ifDescr.33554471
nokia CGLT-C PHYSICALUNI
ifDescr.33554472
nokia CGLT-C PHYSICALUNI
ifDescr.33554473
nokia CGLT-C PHYSICALUNI
ifDescr.33554474
nokia CGLT-C PHYSICALUNI
ifDescr.33554475
nokia CGLT-C PHYSICALUNI
ifDescr.33554880
nokia CGLT-C PHYSICALUNI
ifDescr.33554927
nokia CGLT-C PHYSICALUNI
ifDescr.33554976
nokia CGLT-C PHYSICALUNI
ifDescr.33554977
nokia CGLT-C PHYSICALUNI
ifDescr.33554978
nokia CGLT-C PHYSICALUNI
ifDescr.33554979
nokia CGLT-C PHYSICALUNI
ifDescr.33554980
nokia CGLT-C PHYSICALUNI
ifDescr.33554981
nokia CGLT-C PHYSICALUNI
ifDescr.33554982
nokia CGLT-C PHYSICALUNI
ifDescr.33554983
nokia CGLT-C PHYSICALUNI
ifDescr.33554984
nokia CGLT-C PHYSICALUNI
ifDescr.33554985
nokia CGLT-C PHYSICALUNI
ifDescr.33554986
nokia CGLT-C PHYSICALUNI
ifDescr.33554987
nokia CGLT-C PHYSICALUNI
ifDescr.33555392
nokia CGLT-C PHYSICALUNI
ifDescr.33555439
nokia CGLT-C PHYSICALUNI
ifDescr.33586720
nokia CGLT-C PHYSICALUNI
ifDescr.33586721
nokia CGLT-C PHYSICALUNI
ifDescr.33586722
nokia CGLT-C PHYSICALUNI
ifDescr.33586723
nokia CGLT-C PHYSICALUNI
ifDescr.33586724
nokia CGLT-C PHYSICALUNI
ifDescr.33586725
nokia CGLT-C PHYSICALUNI
ifDescr.33586726
nokia CGLT-C PHYSICALUNI
ifDescr.33586727
nokia CGLT-C PHYSICALUNI
ifDescr.33586728
nokia CGLT-C PHYSICALUNI
ifDescr.33586729
nokia CGLT-C PHYSICALUNI
ifDescr.33586730
nokia CGLT-C PHYSICALUNI
ifDescr.33586731
nokia CGLT-C PHYSICALUNI
ifDescr.33587136
nokia CGLT-C PHYSICALUNI
ifDescr.33587183
nokia CGLT-C PHYSICALUNI
ifDescr.33620000
nokia CGLT-C PHYSICALUNI
ifDescr.33620001
nokia CGLT-C PHYSICALUNI
ifDescr.33620002
nokia CGLT-C PHYSICALUNI
ifDescr.33620003
nokia CGLT-C PHYSICALUNI
ifDescr.33620004
nokia CGLT-C PHYSICALUNI
ifDescr.33620005
nokia CGLT-C PHYSICALUNI
ifDescr.33620006
nokia CGLT-C PHYSICALUNI
ifDescr.33620007
nokia CGLT-C PHYSICALUNI
ifDescr.33620008
nokia CGLT-C PHYSICALUNI
ifDescr.33620009
nokia CGLT-C PHYSICALUNI
ifDescr.33620010
nokia CGLT-C PHYSICALUNI
ifDescr.33620011
nokia CGLT-C PHYSICALUNI
ifDescr.33620416
nokia CGLT-C PHYSICALUNI
ifDescr.33620463
nokia CGLT-C PHYSICALUNI
ifDescr.37748736

ifDescr.37814272

ifDescr.37879808

ifDescr.37945344

ifDescr.38010880

ifDescr.38076416

ifDescr.38141952

ifDescr.38207488

ifDescr.46137792
Bridge
ifDescr.46138304
Bridge
ifDescr.46138351
Bridge
ifDescr.46170048
Bridge
ifDescr.46203328
Bridge
ifDescr.46203375
Bridge
ifDescr.48234496
VlanPort
ifDescr.48234497
VlanPort
ifDescr.48234498
VlanPort
ifDescr.48234499
VlanPort
ifDescr.48234500
VlanPort
ifDescr.48234501
VlanPort
ifDescr.48234502
VlanPort
ifDescr.48300039
VlanPort
ifDescr.48300040
VlanPort
ifDescr.48300041
VlanPort
ifDescr.60817408
nokia CGLT-C PON
ifDescr.60882944
nokia CGLT-C PON
ifDescr.60948480
nokia CGLT-C PON
ifDescr.61014016
nokia CGLT-C PON
ifDescr.61079552
nokia CGLT-C PON
ifDescr.61145088
nokia CGLT-C PON
ifDescr.61210624
nokia CGLT-C PON
ifDescr.61276160
nokia CGLT-C PON
ifDescr.62914560
nokia CGLT-C ONT
ifDescr.62915072
nokia CGLT-C ONT
ifDescr.62946816
nokia CGLT-C ONT
ifDescr.62980096
nokia CGLT-C ONT

And the Interface In / Out octets are like this:

Sent GET request to 10.10.10.1 : 161 
ifInOctets.131072
3409747631
ifInOctets.262144
3060237699
ifInOctets.393216
0
ifInOctets.4325376
2175018619
ifInOctets.4456448
0
ifInOctets.20971520
0
ifInOctets.20972544
0
ifInOctets.20973056
33969278
ifInOctets.20973568
0
Sent GET request to 10.10.10.1 : 161 
ifOutOctets.131072
2982186095
ifOutOctets.262144
2618687804
ifOutOctets.393216
0
ifOutOctets.4325376
1305906783
ifOutOctets.4456448
0
ifOutOctets.20971520
0
ifOutOctets.20972544
0
ifOutOctets.20973056
84134402
ifOutOctets.20973568
0

It is clear that data is only reported for the ethernet interfaces, the LAG interfaces and for the VLAN interfaces. However, the LAG and VLAN interfaces are not detected, while the other non-reporting empty interfaces are.