Possible bug: custom OID

I was trying to add a cusom OID to one of my devices. When I attempted to add it the tests were failing. The failed tests resulted in a librenms.log entry of:

[datetime][ERROR] snmp_get called for multiple OIDs: ###  {"userId":5,"exception":"[object] (Exception(code: 0): snmp_get called for multiple OIDs: ###  at /opt/librenms/includes/snmp.inc.php:286)"}

Where ### was the OID digits. The odd thing was it only listed the single OID that I had given it, not multiples.

After some poking around I found something that looked odd in the file ~/includes/html/forms/customoid.inc.php where line line 16 read:

$id = $_POST['ccustomoid_id'];

The string customoid_id appeared elsewhere in the file, but ccustomoid_id did not. I edited the file to remove what appeared to be a spuriuos c and lo! my tests are now successful.

I didn’t think I’d been in this file before to screw it up, so I checked Github (https://github.com/librenms/librenms/blob/master/includes/html/forms/customoid.inc.php) and found the same spelling here.

:man_shrugging:

I’ve got no idea what I’m doing, but removing one little letter from a file cause a failure to become a success, so I thought I would report it here just in case.

Of course, validation failed after I did this.

~$ ./validate.php
===========================================
Component | Version
--------- | -------
LibreNMS  | 25.2.0-18-g4cfd5a886 (2025-02-28T03:09:23-06:00)
DB Schema | 2025_01_20_125000_create_ospfv3_ports_table (319)
PHP       | 8.3.14
Python    | 3.8.10
Database  | MariaDB 10.3.39-MariaDB-0ubuntu0.20.04.2
RRDTool   | 1.7.2
SNMP      | 5.8
===========================================

[OK]    Composer Version: 2.8.6
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database connection successful
[OK]    Database Schema is current
[OK]    SQL Server meets minimum requirements
[OK]    lower_case_table_names is enabled
[OK]    MySQL engine is optimal
[OK]    Database and column collations are correct
[OK]    Database schema correct
[OK]    MySQL and PHP time match
[OK]    Active pollers found
[OK]    Dispatcher Service not detected
[OK]    Locks are functional
[OK]    Python poller wrapper is polling
[OK]    Redis is unavailable
[OK]    rrd_dir is writable
[OK]    rrdtool version ok
[WARN]  Your local git contains modified files, this could prevent automatic updates.
        [FIX]:
        You can fix this with ./scripts/github-remove
        Modified Files:
         includes/html/forms/customoid.inc.php
~$

Well spotted, if you can submit a pull request that would be ace.

@Harmon20 as a test I just made the necessary edit entirely in my web browser via github (never tried that before just using the web interface). Use that as an example to learn the process:

  • Fork the librenms project on github GitHub - librenms/librenms: Community-based GPL-licensed network monitoring system - Fork option top right.
  • Go to your fork, find the file, edit (pencil icon top right), make changes
  • Commit via button top right (choose to create a new branch - use some short name relevant to you like coid-fix or something).
  • Then you can start the Pull Request process from the prompts it gives to get it across to the main project where it can be reviewed and merged.

Show us how you go if you get stuck and we can nudge you in the right direction, or maybe easier to ask for tips on Discord