OS definition yaml working, how do I add custom OIDs?


We are using a custom device and I’ve created the os.yaml for it’s discovery and it’s working and shows the icon too.
How it looks in the mib file

1. rHumidity OBJECT-TYPE

2. SYNTAX Integer32 (0..100)

3. MAX-ACCESS read-only

4. STATUS current


6. "Relative Humidity measured by the sensor embedded on the diagnostic board."

7. DEFVAL { 0 }

8. --

9. ::= { environment 2 }


What I have done it added some custom OIDs to it and they work too, but I have to add 80-100 of these devices. As I have the OIDs how to I add them to LibreNMS so they are auto discovered?

I did add this to includes/definitions/discovery

Just running a re-discovery.


Component Version
LibreNMS 1.70.1-70-g17f5a3f23
DB Schema 2020_11_02_164331_add_powerstate_enum_to_vminfo (191)
PHP 7.4.3
Python 3.8.5
MySQL 10.3.25-MariaDB-0ubuntu0.20.04.1
RRDTool 1.7.2

[OK] Composer Version: 2.0.9
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct

If you are having troubles with discovery/polling include the pastebin output of:

./discovery.php -h HOSTNAME -d | ./pbin.sh
./poller.php -h HOSTNAME -r -f -d | ./pbin.sh

If you need to post any text longer than a few lines, please use a pastebin service such as https://p.libren.ms using non-expiring pastes.

I read that the yaml file is the preferred place when adding new devices for initial detection but I couldn’t get it to write any sensor data to the rrd or even add the sensor oids into the database. Even though the librenms page says not to use the php file, it was the only place Ifound that would get me what I wanted to see. The 3 places I modified to get an unsupported apc non switched PDU that had bank and phase information are below.


Hmm this is definitely not straight forward.

So I need to create a php file and put in /opt/librenms/includes/discovery/sensors/current/gds.php?

Also my screenshot shows:
oid: Temperature

Does this need to match whats in that mib file (above) rHumidity OBJECT-TYPE?

If the yaml file is the method that should be used, then that should be the way to go… But the below link shows “advanced” discovery for a sample sensor so the PHP file might be required.


Depending on the sensor type, the directory will change. Current is for electricity. You are looking at environmental, so you will probably be interested in the humidity and temperature directories. You could probably use a php file that is already in those directories and make the necessary changes.


discover_sensor is what you are interested in. The below link shows the different types of sensor output and how it is defined (current, voltage, temperature, humidity…)


Thanks I will take look.

I’ve just ran a discovery.php -d -h x.x.x.x and I can see my custom temp OIDs are in there.

What does this mean and would I need that php file to get those to show on my devices?

Do you see + . or - during discovery? If the OIDs were added you should see a “+” and would see an entry in your database. The information should show up on your devices main page.

you could log into your mysql database and query devices to find the device_id for one of your GDS… then query the sensors table for the sensor_class, sensor_oid, and sensor_index for that device_id to see if the OID is actually discovered properly for your GDS device and exists in the database.

Below is a pic of what I mentioned earlier where I had to add OIDs for bank information on a PDU to get the data.

Silly question how do I get into the database?

So I have got my gds.yaml in /includes/definitions which works and discovers this device and adds the icon etc, I have all added 2 custom temperature OIDs to my gds.yaml in /includes/definitions/discovery (https://imgur.com/1UTgUnd) and ran ./discovery -d -h and I see them show up (https://imgur.com/kPq6tXP)

I’m not sure where you see these +'s in the discovery as there is an awful lot in the output.

How do I now graph these if I go to the device in the GUI unto the overview tab?

If you didn’t set a root password for mysql you can leave off the -p

sudo mysql -u root -p


sudo su -
mysql -u root -p

Then to use the database at the mariadb prompt…

use librenms;

Have you done an snmpwalk on your device to see what fields are available with your mib?

For your PHP file you will want to fill in the variables for discover_sensor based either on mib values or manually defining them.

You will want to walk your device to see what is returned. That will help you with the different values that will get stored in the RRD files. If an OID does not exist for one of the variables you can set it in the php file manually or later specify it through the web UI.

discover_sensor($valid[‘sensor’], ‘temperature’, $device, $oid, $index, $sensorType, $descr, 1, 1, $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current);

I assume with temperature you want the following values if the device has those OIDs. If the device does not have an OID relating to one of these variables then manually specify it or use null

  • Device (this variable should be provided to the php)
  • Description
  • Sensor Type
  • OID
  • Index
  • Current temperature
  • Low temperature warning
  • Low temperature limit
  • High temperature warning
  • High temperature limit

I read you need a OS definition yaml which I have done and seems to work, then a discovery yaml which I don’t think works, then I read I need to create a php in /includes/discovery/sensors/temperatures or humidity for my device?

Is that the right order so 2 yaml files and a php in temperature and humidity to get this to work?

If I do a snmpwalk to some of the OIDs they come back, but I can’t seem to get it to work if I select the mib file:


I managed to get access to the DB from your commands, but any show commands don’t work, I only have 4 d-5 devices in the LibreNMS:

MariaDB [(none)]> use librenms

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

MariaDB [librenms]>

Also if I just run:

snmpwalk -v2c -c public123

Then I will get hardly any info at all, if I add my OIDs at the end as in the screenshot above I get the correct info, weird.

If I run ./discovery.php -d -h

Then I get pages of info, but 99% is failed stuff as it’s tried to use Cisco, wireless, FreeNAS OIDs, I guess it goes through all the discovery yaml files?

However with the output of the discovery.php I see my 2 OIDs I put in /opt/librenms/includes/definitions/discovery/gds.yaml and my os from /opt/librenms/includes/definitions/gds.yaml which I think is promising?

Try something like thi

snmpwalk -v2c -c XXXXXX -m /opt/librenms/mibs/GDS-DIAG-MIB/GDS-DIAG-MIB .

Wow running that lists lots and in the output all the OIDs I want added (about 6) to the devices but can’t atm.

snmpwalk -v2c -c xxxx -m /opt/librenms/mibs/GDS-DIAG-MIB/GDS-DIAG-MIB .

For example it’s these that show up I need in each GDS screen I add, it would be nice to show as values and graphs:

GDS-DIAG-MIB::rIntTemp.0 = INTEGER: 39
GDS-DIAG-MIB::rFrontTemp.0 = INTEGER: 28
GDS-DIAG-MIB::rHumidity.0 = INTEGER: 14
GDS-DIAG-MIB::rPanelBacklight1.0 = INTEGER: 126
GDS-DIAG-MIB::rtIntOverTemperatureAlarm.0 = INTEGER: 0
GDS-DIAG-MIB::rwVideoPort.0 = INTEGER: 0

On one devices I’ve had to manually add these as custom OIDs, imaging doing that for 80+ devices :frowning:

How do the MIBs you posted relate to the “discover_sensor” I posted earlier.

discover_sensor($valid[‘sensor’], ‘temperature’, $device, $oid, $index, $sensorType, $descr, 1, 1, $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current);

GDS-DIAG-MIB::rIntTemp.0 = INTEGER: 39
GDS-DIAG-MIB::rFrontTemp.0 = INTEGER: 28
GDS-DIAG-MIB::rHumidity.0 = INTEGER: 14
GDS-DIAG-MIB::rPanelBacklight1.0 = INTEGER: 126
GDS-DIAG-MIB::rtIntOverTemperatureAlarm.0 = INTEGER: 0
GDS-DIAG-MIB::rwVideoPort.0 = INTEGER: 0

Temperature will be a temperature sensor PHP file and humidity will be a humidity sensor PHP file. Back panel light, temperature alarm, and video port seem they are more sensor state related which would be a third “state” PHP file.

Unless someone else speaks up. I think you need a temperature, humidity, and state PHP file to graph or alert on these MIBS.

Well I’ve not created a discover sensor in php, sounds like I need 3?

To summarise I have just created the 2 yaml files:


Mib here:


My includes/definitions/discovery/gds.yaml only has 2 out of the 6 OIDs in here. I used the OIDs, but the discovery.php replaced the OIDs with proper names and I’m not sure if that is an issue or not:

                        - Operator
                    oid: rHumidity
                    value: Temperature
                    num_oid: '{{ $index }}'
                    descr: Humidity
                    index: 'Temperature.{{ $index }}'
                    divisor: 10

                    oid: rFrontTemp
                    value: Temperature
                    num_oid: '{{ $index }}'
                    descr: FrontTemp
                    index: 'Temperature.{{ $index }}'
                    divisor: 10

So that is where I am. The is “discover_sensor” you mention, I assume you mean I need to create a 3 php files in:?



My includes/definitions/discovery/gds.yaml looks like:

        hardware: GDS-DIAG-MIB::rDisplayType.0
        serial: GDS-DIAG-MIB::rSerialNo.0
        version: GDS-DIAG-MIB::rFWVersion.0
                    oid: rFrontTemp
                    value: Temperature
                    num_oid: '{{ $index }}'
                    descr: FrontTemp
                    index: 'Temperature.{{ $index }}'
                    divisor: 10
                    oid: rHumidity
                    value: Temperature
                    num_oid: '{{ $index }}'
                    descr: Humidity
                    index: 'Temperature.{{ $index }}'
                    divisor: 10

It looks like your index: is colliding. I suggest omitting if there is only one of each type.

Discovery debug output would be helpful otherwise I can’t really tell you much.

I have 5 more temperature related OIDs to add, can I name the indexes to match the OID name?

I ran a discovery like you asked https://pastebin.com/gGh9GpFR

This is what I see, I’m glad the OS and Icons are now showing, just no the temps etc

The good news it the 2 values show in the poller.php https://pastebin.com/ijMYDueZ but I get these warnings which I don’t understand, these must be why the ‘Overview’ tab shows ‘0’ values and not the real value in the red squares?


I have added a custom device to LibreNMS by creating the definition and discovery yaml files.

When I add a device the values come in nicely for the first poll

Then I leave it 3-5 mins and zero values are polled.

And it stays like this, if I delete the device and re-add again I get the values come through at firs then they go again.

Is it not polling?

Gonzo got this figured out. He omitted the leading . in num_oid

1 Like

This topic was automatically closed 186 days after the last reply. New replies are no longer allowed.