SNMP/OS/MIBs

Tags: #<Tag:0x00007f9759206820> #<Tag:0x00007f9759206640>

I’m having issues adding MIBs(OSs) to LibreNMS.
I’m following directions from https://docs.librenms.org/
Used: Auto-discovery setup; SNMP trap handler and many others.
I can get the new “OS” in LibreNMS. But on the next scan of any sort nearly all my devices change their OS to the most recent one I put in. I only want the ones that match that OS to use it, but quite a few changed.
After the change I had 2 cisco small business Software, a Generic device, and a LInux device remain outside of the OS I loaded.
2 of the devices that changed are Ruckus, and the ruckus info was preloaded into LibreNMS already.

Daily is all OK
Ran validation, everything shows OK.
Tried a manual discovery -h all but it just keeps miss identifying them. I’m not even sure it’s using the correct MIB for the ones that actually are this OS. When I look at the devices/MIB page there are no assoiations. And under inventory there are some “Bad file descriptor” which I don’t think would be there if the MIB took.

Running LibreNMS - 1.61

Hi @Trevor_Stuart
Please let us know what you tried to do. Basically, if the definition of the new OS is correct, it will only match the device you want to match.
Bye

Followed the Support for new OS: https://docs.librenms.org/Developing/Support-New-OS/
Very well may have missed/not understood something though.
I did this twice. First time it changed all to the one just created. Then second attempt it changed all(including the previous ones) to this new OS.

first I copied the MIB to my server and placed it in a subfolder under /opt/librenms/mibs/sencore
Edited /etc/systemd/system/multi-user.target.wants/snmptrapd.service
This is the full file as it stands now. However for my first attempt all that was done was the change to
Environment= and I added just /opt/lirenms/mibs/sencore/ Everything else was left at it’s defaults from there so ExecStart was actually /usr/sbin/snmptrapd -f -m IF-MIB -M /opt/librenms/mibs

When I did the second OS addition that is when I added the additional Environment paths and the 2 additional MIBs to execstart. I never did try the cisco/ruckus/radwin mibs because I noticed that everything had again changed, not just the devices specific…

[Unit]
Description=Simple Network Management Protocol (SNMP) Trap Daemon.
After=network.target
ConditionPathExists=/etc/snmp/snmptrapd.conf

[Service]
Environment=“MIBSDIR=/opt/lirenms/mibs:/opt/lirenms/mibs/cisco:/opt/lirenms/mibs/sencore/:/opt/lirenms/mibs/cobalt:/opt/lirenms/mibs/ruckus:/opt/lirenms/mibs/radwin”
Type=simple
ExecStart=/usr/sbin/snmptrapd -f -m IF-MIB:COBALT-9223:SENCORE -M /opt/librenms/mibs
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

Reloaded service files, enabled, and started the snmptrapd service

After that it wasn’t auto discovering anything YET, and using the discovery script wasn’t changing anything.
I then found the script new-os.php info in the documentation.
So I ran ./scripts/new-os.php -h 101 -o SENCORE-os -t network -v sencore
At prompts in script I entered
Description for OS: Sencore
Logo: left blank and hit enter.
MIB name inc path: /opt/librenms/mibs/sencore/SENCORE-MIB.MIB

Doing this does seem to generate errors, and these are likely pointing to the problem but I don’t know
MIB search path: /opt/librenms/mibs:/opt/librenms/mibs/sencore
Cannot find module (SENCORE-MIB.MIB): At line 1 in (none)
Unable to find a matching object identifier for “.*Table$”
Failed to create new discovery file /opt/librenms/includes/definitions/discovery/[email protected]:~$

Even though it says it failed to create the new file did generate.But it’s empty.

Scripts and other commands all run as the librenms account. only used sudo when editing conf file.

After doing this I did the discovery -h all and that’s when it changed most of my devices to sencore. I later tried adding cobalt in the same manor and after doing so run discover and that’s when it changed most devices to cobalt… I did change the ID number each time I ran the newos script.

I deleted the yaml files that were generated in /opt/librenms/includes/definitions/discovery. However that alone didn’t put things back it seemed. I then found the same yaml files in the includes/definitions/os folder. Basically just did a find for anything on the system with the new OS names I tried to generate. Deleted these, and re-ran the discovery. My inventory is now back to “normal” but I still don’t know how to go about adding these new OS/MIBs?

With everything back to its original state I’m trying from scratch to create a new OS using the script.
Ran the command:
./scripts/new-os.php -h 101 -o cobalt-os -t appliance -v cobalt

Here is what I used for the 2 prompts that I believe is linked to my issue:
Base discovery file created,ctrl+c to exit now otherwise please enter the MIB name including path (url is also fine) for us to check for sensors: /opt/librenms/mibs/cobalt/

Result:
MIB search path: /opt/librenms/mibs/cobalt/COBALT-9223.mib
Cannot find module (COBALT-9223.mib): At line 1 in (none)
Unable to find a matching object identifier for “.*Table$”
Failed to create new discovery file /opt/librenms/includes/definitions/discovery/[email protected]:~$

However that MIB is in that folder:
ls /opt/librenms/mibs/cobalt/
CDI-ROOT.mib COBALT-9223.mib OPEN-GEAR-CARD.mib OPEN-GEAR-FRAME.mib OPEN-GEAR.mib OPEN-GEAR-NODE.mib ROSS-VIDEO.mib

I was afraid I might have missed/added spaces or something in the names, so I copied and pasted to ensure I had it right.

another update.
I looked at the file /includes/definitions/cobalt-os.yaml
In there I “fixed” the sysobjectID with the actual ID
.1.3.6.1.4.1.29693.1.9223
In the help page it “looks” like you need to leave a trailing . however I think that actually meant it starts with a .
Also added
mib_dir:
- cobalt

It now identifies the OS for the proper devices, which is HUGE progress. But the MIB still isn’t getting used.
I tried re-running the OS script. it asks for MIB path, I put it in as I did before and same error. Cannot find module…
It then creates a yaml file in teh discovery folder, but it’s empty.

Hi,

Forget about the script I would say. You’d rather follow the documentation and look at other YAML files to replicate.
For the MIB, the name of the file must be exactly the one of the MIB itself. Open the MIB file and look for:
xxxxx-xxxxx-xxxxx DEFINITIONS ::= BEGIN
xxxxx-xxxxx-xxxxx is the name of the file. So rename it if it is different, and always use this.

Then, in the includes/definitions folder you define your OS. Means :

  • When does it match ?
  • What icon ?
  • What mib directory ?
  • etc

In the inculdes/definitions/discoveryyou define the sensors of your OS:

  • Temperature
  • Power for Lasers
  • Signal/noise ratio etc etc

And then using the PHP files you can do more difficult things.

This is where my knowledge gap was happening. I wasn’t putting together the 2 separate include directories and there purpose.
I did notice in the MIB file itself the xxxxx-xxxxx-xxxxx DEFINITIONS ::= BEGIN does NOT match the file name. I’ll rename as you suggested.
Am I safe to assume that since the MIB doesn’t include the extension that part is always just implied as .mib? Only reason I’m asking is for the YAML files when I put in the path do I include the full path with file name AND extension. Or just the path with filename?
/opt/librenms/mibs/cobalt/COBALT-9223.mib
OR
/opt/librenms/mibs/cobalt/COBALT-9223

Or will both of those work ultimatly?

Along this same line.
MIB file name is COBALT-9223.mib
First line:
COBALT-9223-MIB DEFINITIONS ::= BEGIN

Does this mean I rename to COBALT-9223-MIB.mib?
Or is the -MIB at the end implied somehow? Asking because all the MIB’s, at least from this manufacture, have -MIB inside the mib file. But are not named that way.