SNMPP Counter and SNMP Gauges

I have various sensors that uses gauges to show a scalar (e.g. voltage, temperature) and counters to show the integral of some value over time; e.g. kWh consumed, mBytes transmitted.

I can add these using “+Add New OID” – and initially set the GAUGE/COUNTER as I define them. This sometimes works. However - sometimes the graph is wrong - it seems to treat counters like scalars instead as on (scalar x time) with the graph of (scalar per ‘time unit’) expected.

Looking into the DB - I notice that the field is sometimes devoid of a value.

Is this a know bug/issue ? DB dump and versions below.

Dw

select device_id, customoid_id, customoid_descr, customoid_current, customoid_datatype, customoid_unit from customoids with device_id > 20 and device_id < 28
+-----------+--------------+--------------------------------+-------------------+--------------------+----------------+
| device_id | customoid_id | customoid_descr                | customoid_current | customoid_datatype | customoid_unit |
+-----------+--------------+--------------------------------+-------------------+--------------------+----------------+
|        23 |            3 | heater                         |           4333375 | COUNTER            | seconds        |
|        23 |            4 | pump                           |             23024 | COUNTER            | seconds        |
|        23 |            6 | water verbruik                 |             4.489 |                    | seconds        |
|        22 |            8 | CPU die temperature            |             53.35 |                    | K              |
|        23 |           15 | pump starts                    |               683 |                    | seconds        |
|        23 |           16 | heating starts                 |               176 | COUNTER            | seconds        |
|        25 |           17 | L1 Usage                       |                 0 | GAUGE              | Watt           |
|        25 |           18 | L2 Usage                       |                70 | GAUGE              | Watt           |
|        25 |           19 | L3 Usage                       |                60 | GAUGE              | Watt           |
|        23 |           21 | pump starts 2                  |               683 |                    | #              |
|        26 |           22 | Electricity Usage (kWh)        |          1810.456 |                    | kWh            |
|        26 |           23 | Electricity Consumption (Watt) |               180 |                    | Watt           |
|        26 |           24 | Packet loss on 868 Mhz         |                32 |                    | #              |
+-----------+--------------+--------------------------------+-------------------+--------------------+----------------+
13 rows in set (0.00 sec)
Version 23.11.0 - Fri Nov 17 2023 03:57:41 GMT+0100
Database Schema 2023_11_04_125846_packages_increase_name_column_length (273)
Web Server Apache/2.4.58 (FreeBSD) PHP/8.2.14
PHP 8.2.14
Python 3.9.18
Database MySQL 8.0.35
Laravel 10.16.1
RRDtool 1.8.0

Did you have a reason to use custom OID ? This is not the prefered way of doing things. YAML templates for devices are the way to do it, and can (should) be contributed to the LibreNMS repository. So next time you install a LibreNMS instance (you or others) you’ll get this by default instead of doing custom every time.

Given that some of these values rely on a 5mins hack of some ESP32 code as the ‘agent’ – not quite YAML and share territory. And main reason for asking that I suspect something is amiss with the UI or browser-compatibility. As I cannot recall having seen the customoid_datatype ever being empty / not retaining the GAUGE and COUNTER values.

OK, I get it. You are probably in the one and only reason the CustomOID code exists …

That being said, as it is not widely used, you’ll probably need to dig that one yourself.

Ok - it appears that specific older versions of Chrome on Windows (but not the latest on Win/Mac) and Safari (on Mac - all versions including most recent one) loose / do not set ‘customoid_datatype’ in the modal Custom OID form - but the most recent version of Chrome does not both Win and Mac.

That said - if the value in the customoid_datatype column of the customoids is set to counter or gauge correctly on creation - would the graph understand/use that information ? And give a ‘counter-change/time-unit’ display in the case of a counter and a simple scalar v.s time for the gauge ??