Existing Device with Custom OID

Hi Community,

I have try to monitor juniper firewall filter counter with OID: .1.3.6.1.4.1.2636.3.5.2.1 .
Just follow this case Add OID to existing OS to add OID to yaml file and polling is failed with returning 0.

Any other files I need to config it ? How can I classify the value object to this setting?

Moreover, is it possible to monitor non if-mib interfaces with custom OID?

Many thanks.

/opt/librenms/includes/definitions/discovery/junos.yaml
count:
data:
-
oid: jnxFirewallCounterTable
value: jnxFWCounterPacketCount
num_oid: ‘1.3.6.1.4.1.2636.3.5.2.1.4.{{ $index }}’
descr: '{{ $jnxFWCounterDisplayFilterName }} : {{ $jnxFWCounterDisplayName }} (Packet)’
index: ‘jnxFWCounterPacketCount.{{ $index }}’
-
oid: jnxFirewallCounterTable
value: jnxFWCounterByteCount
num_oid: ‘1.3.6.1.4.1.2636.3.5.2.1.5.{{ $index }}’
descr: '{{ $jnxFWCounterDisplayFilterName }} : {{ $jnxFWCounterDisplayName }} (Byte)’
index: ‘jnxFWCounterByteCount.{{ $index }}’

Count value display 0
56%20PM

./poller.php -h deviceIP -m sensors -v -d

Warning: A non-numeric value encountered in /opt/librenms/includes/polling/functions.inc.php on line 167
0
RRD[update /opt/librenms/rrd/103.15.181.172/sensor-count-junos-jnxFWCounterPacketCount.A-Filter.Incoming.rrd N:0]
RRDtool Output:

Hey @albee555,

Looks like you made a similar config error that I made towards the end of my post that you linked to.

Your num_oid lines are missing the leading ‘.’

Regards,
Derova

FYI: The pre-commit will validate the yaml and throw an error for that. It is mentioned in the docs I think.

Thanks @Derova and @murrant for your help.

After added the leading ‘.’, run rediscovery and clear cache config, it’s still return 0.

I have also found this record after poll. Is it related to the value?

.1.3.6.1.4.1.2636.3.5.2.1.5.A-Filter.Incoming.counter: Unknown Object Identifier (Sub-id not found: enterprises → A-Filter.Incoming.counter)

I think it is related to num_oid changed to text instead of number. How can I detected as number?

MariaDB [librenms]> select sensor_oid, sensor_descr, sensor_current, sensor_prev from sensors where device_id = 1 and sensor_class = “count” ;
±----------------------------------------------------------------------------------------±---------------------------------------------------------------±---------------±----------------+
| sensor_oid | sensor_descr | sensor_current | sensor_prev |
±----------------------------------------------------------------------------------------±---------------------------------------------------------------±---------------±----------------+
| .1.3.6.1.4.1.2636.3.5.2.1.5.A-Filter.Incoming.counter | A-Filter : Incoming (Packet) | 0 | 35714053960 |

[root@librenms librenms]# snmpget -v2c -c network IP.address -M /opt/librenms/mibs:/opt/librenms/mibs/junos .1.3.6.1.4.1.2636.3.5.2.1.5.12.67.84.71.45.70.105.108.116.101.114.73.78.18.80.111.108.105.99.101.114.45.72.82.45.67.111.117.110.116.101.114.2
SNMPv2-SMI::enterprises.2636.3.5.2.1.5.12.67.84.71.45.70.105.108.116.101.114.73.78.18.80.111.108.105.99.101.114.45.72.82.45.67.111.117.110.116.101.114.2 = Counter64: 4336995207243

[root@librenms librenms]# snmpget -v2c -c network IP.address -M /opt/librenms/mibs:/opt/librenms/mibs/junos .1.3.6.1.4.1.2636.3.5.2.1.5.HKIX-FilterIN.HKIX-HOST-IN.counter
.1.3.6.1.4.1.2636.3.5.2.1.5.HKIX-FilterIN.HKIX-HOST-IN.counter: Unknown Object Identifier (Sub-id not found: enterprises → HKIX-FilterIN.HKIX-HOST-IN.counter)

Hi

The oid is a string_indexed OID, and that is not supported by LibreNMS right now (nor by any snmp command in fact). The only option is to change the query to a real numoid.
There is a PR ongoing to allow YAML discovery to deal with those, you can follow it.

1 Like

Sorry for not replying sooner.

After deploy your pull request, it can change num_oid from string to number. But it seems not the correct OID for each object.

MariaDB [librenms]> select sensor_oid, sensor_index, sensor_descr, sensor_current, sensor_prev from sensors where device_id = 1 and sensor_class = “count” ;
±--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------±------------------------------------------------------------------------------------±-------------------------------------------------------------±---------------±----------------+
| sensor_oid | sensor_index | sensor_descr | sensor_current | sensor_prev |
±--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------±------------------------------------------------------------------------------------±-------------------------------------------------------------±---------------±----------------+
| .1.3.6.1.4.1.2636.3.5.2.1.5.39.67.84.71.45.70.105.108.116.101.114.73.78.46.80.111.108.105.99.101.114.45.72.82.45.67.111.117.110.116.101.114.46.99.111.117.110.116.101.114 | jnxFirewallCounterTable.CTG-FilterIN.Policer-HR-Counter.counter | CTG-FilterIN : Policer-HR-Counter (Byte) | 0 | 4363429705937 |

When snmpget DB storded OID

[root@librenms librenms]# snmpget -v2c -c network ip.address .1.3.6.1.4.1.2636.3.5.2.1.5.39.67.84.71.45.70.105.108.116.101.114.73.78.46.80.111.108.105.99.101.114.45.72.82.45.67.111.117.110.116.101.114.46.99.111.117.110.116.101.114
SNMPv2-SMI::enterprises.2636.3.5.2.1.5.39.67.84.71.45.70.105.108.116.101.114.73.78.46.80.111.108.105.99.101.114.45.72.82.45.67.111.117.110.116.101.114.46.99.111.117.110.116.101.114 = No Such Instance currently exists at this OID

And snmpwalk jnxFirewallCounterTable OID can get below object.

[root@librenms librenms]# snmpwalk -v1 -c network IP.address .1.3.6.1.4.1.2636.3.5.2.1.5
SNMPv2-SMI::enterprises.2636.3.5.2.1.5.12.67.84.71.45.70.105.108.116.101.114.73.78.18.80.111.108.105.99.101.114.45.72.82.45.67.111.117.110.116.101.114.2 = Counter64: 4371498867665

After compare both OID, I found this different.
DB:
.2636.3.5.2.1.5.39.67.84.71.45.70.105.108.116.101.114.73.78.46.80.111.108.105.99.101.114.45.72.82.45.67.111.117.110.116.101.114.46.99.111.117.110.116.101.114
snmpwalk:
.2636.3.5.2.1.5.12.67.84.71.45.70.105.108.116.101.114.73.78.18.80.111.108.105.99.101.114.45.72.82.45.67.111.117.110.116.101.114.2

Hi, is it using snmptranslate to convert num_oid from string to number after we get that string by MIB?

Yes and No. The conversion is not using the mib. 1st number should gives the length, and other numbers are ASCII code characters.
In that aspect, DB looks good, snmpwalk looks wrong.

@PipoCanaja Thank you to explain the OID dinfination.

If the discovery OID is right, it should be another problem exist as I still poll 0.

image

Here is my config.

vi /opt/librenms/includes/definitions/discovery/junos.yaml

mib: JUNIPER-IFOPTICS-MIB:JNX-OPT-IF-EXT-MIB:IF-MIB:JUNIPER-MIB:JUNIPER-SRX5000-SPU-MONITORING-MIB:JUNIPER-ALARM-MIB:JUNIPER-VIRTUALCHASSIS-MIB:JUNIPER-FIREWALL-MIB
count:
data:
-
oid: jnxFirewallCounterTable
value: jnxFWCounterByteCount
num_oid: ‘.1.3.6.1.4.1.2636.3.5.2.1.5.{{ $index_string }}’
descr: ‘{{ $jnxFWCounterDisplayFilterName }} : {{ $jnxFWCounterDisplayName }} (Byte)’
index: ‘jnxFirewallCounterTable.{{ $index }}’
group: Byte Count

Poller

[root@librenms librenms]# ./poller.php -h IP.address -m sensors -v -d
Poller
SQL[select migration from migrations order by id desc limit 1 0.94ms]

SQL[select count(*) as aggregate from migrations limit 1 0.77ms]

SQL[SELECT version() 0.48ms]

===================================
Version info:
Commit SHA: b4384493320da5600de686484f01248f1a6df7de
Commit Date: 1564384692
DB Schema: 2019_07_03_132417_create_mpls_saps_table (139)
PHP: 7.2.19
MySQL: 5.5.60-MariaDB
RRDTool: 1.4.8
SNMP: NET-SNMP 5.7.2
==================================DEBUG!
Updating os_def.cache

Done
Override poller modules: sensors
Starting polling run:
.
.
.

Load poller module sensors

SQL[SELECT sensor_class FROM sensors WHERE device_id = ? GROUP BY sensor_class [1] 1.21ms]

SQL[SELECT * FROM sensors WHERE sensor_class = ? AND device_id = ? [“count”,1] 1.22ms]

SNMP[‘/usr/bin/snmpget’ ‘-v2c’ ‘-c’ ‘ud_network’ ‘-OUQnte’ ‘-M’ ‘/opt/librenms/mibs:/opt/librenms/mibs/junos’ ‘udp:103.15.181.172:161’ ‘.1.3.6.1.4.1.2636.3.5.2.1.5.39.67.84.71.45.70.105.108.116.101.114.73.78.46.80.111.108.105.99.101.114.45.72.82.45.67.111.117.110.116.101.114.46.99.111.117.110.116.101.114’]
.1.3.6.1.4.1.2636.3.5.2.1.5.39.67.84.71.45.70.105.108.116.101.114.73.78.46.80.111.108.105.99.101.114.45.72.82.45.67.111.117.110.116.101.114.46.99.111.117.110.116.101.114 = No Such Instance currently exists at this OID

Checking (snmp) count CTG-FilterIN : Policer-HR-Counter (Byte)


Warning: A non-numeric value encountered in /opt/librenms/includes/polling/functions.inc.php on line 167
0
RRD[update /opt/librenms/rrd/ip.address/sensor-count-junos-jnxFirewallCounterTable.CTG-FilterIN.Policer-HR-Counter.counter.rrd N:0]
RRDtool Output: OK u:0.01 s:0.01 r:1.10

Are there any way to fact check snmpwalk result? Which coding is using to get that OID when discovering?

Hope to see your reply. Thanks.

Hi,

If the OID is always the same for all Juniper devices, you can configure the oid_num completely manually (without the {{ $index }} ) so it won’t be calculated dynamically.
If the OID is changing (so if the text in the OID is changing) between devices, then you won’t be able to add it via YAML until this PR 10410 is merged (or another equivalent one).