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 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.
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…)
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.
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 1.2.3.4 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
or
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.
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)
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 10.1.2.3
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 10.1.2.3
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?
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.
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:
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?