Adding state sensor

I’m attempting to add a state sensor to the sitemonitor device type using the new-ish yaml-style config.

The manufacturer of this device does not provide a MIB. I have created a new file called includes/definitions/discovery/sitemonitor.yaml which contains the following:

mib PACKETFLUX-SMI
modules:
    sensors:
      state:
        data:
            -
                oid: '.1.3.6.1.4.1.32050.2.1.26.5.3'
                num_oid: '.1.3.6.1.4.1.32050.2.1.26.5.3'
                descr: Switch Input
                state_name: switchInput
                states:
                    - { value: 0, generic: 0, graph: 1, descr: 'Open' }
                    - { value: 1, generic: 0, graph: 1, descr: 'Closed' }

I think the problem is that oid should be a named oid per the MIB, but since this device has no MIB, I am trying to provide the numeric ID. With this configuration, the sensor does not get discovered or polled.

Is there a way to accomplish this without having a named OID/MIB?

Not to my knowledge with the YAML style. If is, as far as I see, possible if you go the PHP way.

Ok - so I took a stab at this, but I must be doing something wrong, because even though the poller sees 1 for the SNMP value at this OID, the UI is still showing “Open”. Any tips? I think it may have something to do with the index.

check the poller.php -v -d -h to confirm that the poller is polling the correct value. You might indeed have a problem with the index.

I was able to get this sorted: https://github.com/librenms/librenms/pull/10994