Groups by Vendor

Hi is it possible to create a group by Vendor? I created this topology for oxidized to then use different parsers per vendor. is it possible to do the same on LNMS?

Hey networkpadawan,

you could try in Device Groups … maybe try by devices.os

i will try thks, to see if it still integrates with oxidized!

For creating groups to use with Oxidized integration you have these:

$config['oxidized']['group']['hostname'][] = array('regex' => '/^lon-sw/', 'group' => 'london-switches');
$config['oxidized']['group']['location'][] = array('regex' => '/london/', 'group' => 'london-switches');
$config['oxidized']['group']['os'][] = array('match' => 'edgeos', 'group' => 'wireless');

So you then can target groups in oxidized for login credentials. Is that what you meant?

is it possible to add a “Vendor” one? because I created groups on oxidized based on vendor. to later help me on parsing configs. like Juniper, Arista, Dell, Cisco ?

You’d have to do that like:

$config['oxidized']['group']['os'][] = array('match' => 'ios', 'group' => 'cisco');
$config['oxidized']['group']['os'][] = array('match' => 'iosxe', 'group' => 'cisco');

What is the value sent to oxidzed? the OS or the group name? when i do a API call i get a list of devices with the os:
{
“hostname”: “switch706”,
“os”: “arista_eos”
},

on the group definition I have:
#$config[‘oxidized’][‘group’][‘os’][] = array(‘match’ => ‘arista_eos’, ‘group’ => ‘arista’);

I was expecting that the api return “arista” and not “arista_eos”.

Have you added $config['oxidized']['group_support'] = true; to turn group support on?

i enabled it on the webui, do I need to put it on the config.php?

No if you’ve done it in the webui then that’s fine. It doesn’t look like it’s sending groups back though. Maybe try config.php to see.

lnms is not sending the group on the request:

10.189.0.90 - - [19/Jun/2017:10:53:51 +0100] “GET /node/show/router01?format=json HTTP/1.0” 500 148362 “-” "-"
10.189.0.90 - - [19/Jun/2017:10:53:51 +0100] “GET /node/version?node_full=router01&format=json HTTP/1.0” 500 114688 “-” "-"
10.189.0.90 - - [19/Jun/2017:10:53:51 +0100] “GET /node/fetch/router01 HTTP/1.0” 500 148049 “-” “-”

my config is :
$config[‘oxidized’][‘group’][‘os’][] = array(‘match’ => ‘arista_eos’, ‘group’ => ‘arista’);
$config[‘oxidized’][‘group’][‘os’][] = array(‘match’ => ‘junos’, ‘group’ => ‘juniper’);
$config[‘oxidized’][‘group’][‘os’][] = array(‘match’ => ‘dnos’, ‘group’ => ‘dell’);
$config[‘oxidized’][‘group_support’] = true;
$config[‘oxidized’][‘enabled’] = true;
$config[‘oxidized’][‘url’] = ‘http://oxidized.example.com’;
$config[‘oxidized’][‘features’][‘versioning’] = true;

on the API curl now that I setup on the config.php, the group appears:

     "hostname": "switch706",
    "os": "arista_eos",
    "group": "arista"

(noob at php!)

im looking at the code for fetching the config, and I´m not seeing where lnms inserts the group:

$node_info = json_decode(file_get_contents($config[‘oxidized’][‘url’].’/node/show/’.$oxidized_hostname.’?format=json’), true);

shouldnt there be a flag for the group?

am I looking at this wrong?

Ahh, we’re talking about different things here. Our group support is what we feed to oxidized if you use LibreNMS as the source for nodes.

In the webui, we do some group look ups but that’s based on what Oxidized sends us afaik: https://github.com/librenms/librenms/blob/e20a242785de0acd849734c0fa9740179d2d30ac/html/pages/device/showconfig.inc.php#L158

I understand, but then for now Groups on the config tab will not work for now right?

could it be possible to load the group to a variable and add it to the path? and empty if not? that way the construnction of the URL should work fine because the get request on oxidized is : /node/fetch/GROUP/router01 and currently lnms does /node/fetch/router01

Devices in groups work for me in the config tab. /node/fetch/NODE works as far as I’m aware.

In my case it does not, because oxidized creates one folder per group, and the fetch needs the full path folder + file to get the config.

are you using git as a backend for oxidized? if you do a checkout what is the structure that you have? all configs in one folder?

I am using git.

So here’s what we do:

A call to /node/show/NODE - this isn’t dependent on the groups. We then use that response to build the url, this includes the groups then.

We’re using groups at work and I don’t have an issue with viewing configs in LibreNMS. It does take a while which I need to look into but that could be the size of the git repo now, 450Mb>

on my side it does not work, not even on oxidized itself. for example:

http://oxidized.example/node/fetch/juniper/router01 > ok
http://oxidized.example/node/fetch/router01 > node not found

this is my config:
output:
default: git
git:
single_repo: true
repo: “/app/device_backups/git”

is you config similar?