Oxidized - Vendor Model Type

Hi all - here’s an interesting one;

I’m using the LibreNMS Docker container integrated with the Oxidized Docker container and grabbing configuration from a few vendor devices. Via the /api/v0/oxidized API, LibreNMS reports the OS name as the same for all devices by this vendor, but they have multiple device types which require different commands to retrieve configurations. I need to find a way to get LibreNMS to report the Model type rather than just the OS.

Is there a way to get LibreNMS to:

a) Grab a custom OID (in this case, the product name) and store it whenever it discovers a device of OS “XYZ”? I’m guessing I’d need to update the OS model within LibreNMS to do this? I see we can add Custom OIDs to devices themselves, but this is only relevant to values which can result in trends I think…?

b) Present this custom OID data to Oxidized - we’d need to add a new field to the Oxidized API in LibreNMS and add the corresponding field in the Oxidized config, which could then be used to select which “Model” to use. If so - how do we do this?

c) I think this may be a separate bug - the IP address field is always empty when I query the Oxidized API - is this because I am using the IP address as the hostname? If so, should it be copied into the IP Address field anyway?

Sample API output:
{
“hostname”: “ipaddress”,
“os”: “osname”,
“ip”: “”,
“group”: “default”
},

You should be able to use the group mapping to specify a specific model.

Otherwise there is a built in list of model conversions for LibreNMS, you could update that and send a PR.

Great idea - I’ll have a go at grouping based on other parameters.

If not, I’ll have a look at converting the model - I’d just need to specifiy which OID to look at to get the model name… (could you please point me at the guide for doing this?).

model name should be stored in the database already under hardware field.

Yeah there’s nothing appearing in the LibreNMS Hardware field for this vendor’s devices, whereas it is populated for other vendors.

I’ve checked the includes/polling/os/bluecatnetworks.inc.php file and it has what I think are the correct OIDs mapped for version/hardware/serial:

$version = $bcn[0]['bcnSysIdOSRelease.0'];
$hardware = $bcn[0]['bcnSysIdPlatform.0'];
$serial = $bcn[0]['bcnSysIdSerial.0'];

Running a snmpwalk against a real server returns values for these fields though, so perhaps there’s something wrong with the mappings or the MIBs?

BCN-SYSTEM-MIB::bcnSysIdProduct.0 = OID: BCN-PRODUCTS-MIB::bcnProductsAdonis
BCN-SYSTEM-MIB::bcnSysIdOSRelease.0 = STRING: 8.1.1-100.GA.bcn
BCN-SYSTEM-MIB::bcnSysIdSerial.0 = STRING: Unknown
BCN-SYSTEM-MIB::bcnSysIdServiceTag.0 = STRING: Unknown
BCN-SYSTEM-MIB::bcnSysIdPlatform.0 = STRING: VMware

I think the bcnSysIdProduct value is the one that I need to differentiate models within Oxidized; so it’ll be a matter of fixing the bluecatnetworks.inc.php file to get the serial/platform/release passed to LibreNMS correctly, then adding the bcnSysIdProduct mapping to an additional field within LibreNMS (any idea which field should be used?).

No idea. What are the different oxidized models?

I just noticed that code is wrong :smiley: I think it should be:

$version = $bcn[0]['bcnSysIdOSRelease'];
$hardware = $bcn[0]['bcnSysIdPlatform'];
$serial = $bcn[0]['bcnSysIdSerial'];

Hi @murrant -

My question was which field within LibreNMS can be used to store the bcnSysIdProduct value - we’re already populating version, hardware and serial - is there a “model” field or equivalent?

Re the OIDs - they’re actually right I think - the .0 at the end is required to grab the first value (unless the snmp_get_multi_oid function does this by default?):

BCN-SYSTEM-MIB::bcnSysIdProduct.0 = OID: BCN-PRODUCTS-MIB::bcnProductsAdonis

The full OID is this:
1.3.6.1.4.1.13315.3.2.2.1.1.0

Just to be clear you know that “model” in Oxidized is equivalent to “os” in LibreNMS right?

They are all grouped by index, notice the [0] on the left :wink:

Hi - I tried removing the .0 from the end of each of the lines and restarting LibreNMS; that didn’t work - so I then tried removing the [0] and that did.

I’ve updated the hardware field to show both the product type and the hardware model (which is always vmware for VMs) which works pretty well:

<?php

use LibreNMS\RRD\RrdDefinition;

$oid_list = ['bcnSysIdOSRelease.0', 'bcnSysIdSerial.0', 'bcnSysIdPlatform.0' ];

$bcn = snmp_get_multi_oid($device, $oid_list, '-OUQs', 'BCN-SYSTEM-MIB');
$boxtype = substr(snmp_translate($device['sysObjectID'], 'BCN-PRODUCTS-MIB', null, null, $device),11);

if ($boxtype == "Proteus") {
  $boxtype = "BAM";
}
if ($boxtype == "Adonis") {
  $boxtype = "BDDS";
}

$version = $bcn['bcnSysIdOSRelease.0'];
$hardware = $boxtype." - ".$bcn['bcnSysIdPlatform.0'];
$serial = $bcn['bcnSysIdSerial.0'];

I’ve added LibreNMS Groups to filter based on the Hardware value and this is working in LibreNMS (the devices are filtered into groups), but everything that is exposed via the Oxidized API is showing “group” : “default”.

I’ve got lines in config/oxidized.php which enable group_support and set the default group:

$config['oxidized']['group_support'] = true;
$config['oxidized']['default_group'] = 'default';

Any idea how to get the group values to work?

2 other things:

1: I’m conscious that this BluecatNetworks change is only local to my system, but also that it might not be accepted as a pull request - is there a way to persist custom models locally, if I update the Docker container? There’s a directory for config and another for monitoring plugins - is there an equivalent for OS/Models?

2: Within an OS model, is it possible to update the $os name itself dependent on a value from SNMP? I’d ideally like the OS name to be split into 2, dependent on the value in
sysObjectID (which itself should be translated using the snmp_translate line above). I’d then be able to differentiate between them in Oxidized and run different commands (they’re completely different types of appliance):

Bluecat BDDS
Bluecat BAM

@murrant - thanks again for your help yesterday; I just realised I didn’t tag you in my latest response.

Please let me know if you have any ideas on how to get the Group populated properly, or suggestions on how to diagnose what is going on.

Something else I’ve noticed as well - now that I’ve updated the blucat-networks.inc.php file, the devices in LibreNMS get updated correctly whenever I run poller.php, but then revert to a different configuration. I’m guessing discovery and polling are clashing somehow - but am not sure how to check this.

Summary of outstanding questions from here & above:

  • Why is the “Group” parameter not being populated in the Oxidized API output (everything is “Default”)
  • How can I add persistent custom OS / Model variants to my instance of LibreNMS without updating your source code? I’m running the Docker container, so pulling a new version wipes out changes within /includes/polling/os/. Is there an equivalent to the $LIBRENMS_HOME/monitoring-plugins folder for OS / Model updates?
  • Is it possible to update the OS name dependent on a SNMP value? Guessing this needs to be done via Discovery rather than Polling?
  • Why is my change within includes/polling/os/bluecatnetworks.inc.php only showing in LibreNMS whenever I run poller.php manually and why is everything being overwritten again shortly afterwards?

Let me know if you need any more information.

Thanks

Go read the docs on setting up Oxidized groups etc https://docs.librenms.org/Extensions/Oxidized/

Hey @murrant - yes I have read that and already applied this line to the librenms configuration:

$config['oxidized']['group_support'] = true;

But when I query the Oxidized API like this, all the Groups are “default” - even though they are showing correctly in the LibreNMS GUI.

curl http://librenms:8000/api/v0/oxidized -H “X-Auth-Token: 123456789123456789”

{
    "hostname": "172.26.162.54",
    "os": "bluecatnetworks",
    "ip": "",
    "group": "default"
},
{
    "hostname": "172.26.162.100",
    "os": "linux",
    "ip": "",
    "group": "default"
},
{
    "hostname": "172.26.162.60",
    "os": "generic",
    "ip": "",
    "group": "default"
}

I tried changing the default group name to something else and the group name changed for everything - so there must be some disconnect between the LibreNMS data and the Oxidized API at /api/v0/oxidized.

Note also that the IP is blank for each device - guessing that should be populated?

IP is unused I think.

You haven’t set up any groups, it tells you how in the doc.

I do have Device Groups set up and populating within LibreNMS (see screenshot) - is this what should map to “Groups” via the API, or is there somewhere else to create groups within LibreNMS that I am missing?

Those are device groups.

OK I understand now - Groups are not derived from Device Groups in LibreNMS; you have to specifically program them in the configuration file:

$config[‘oxidized’][‘maps’][‘group’][‘hardware’][] = array(‘regex’ => ‘/^BAM/’, ‘group’ => ‘BluecatBAM’);

This then returns the Group via the API.

It’d be great to be able to map the Hardware to the Group directly (or something else) - will have a play and see if I can get that to work.

@murrant - I’ve proposed a change to the Oxidized instructions to make it clear that you have to add an Override to get Groups to match/show.

Someone has a PR to do that. :wink: but it gets tricky since they are two different things.