Community discussions

MikroTik App
 
VincentL
newbie
Topic Author
Posts: 34
Joined: Fri Feb 03, 2017 3:27 pm

[SNMP] Reset oid name

Wed Mar 30, 2022 9:53 am

Hello,

I need to retrieve the "name" field from queue simple.
From Telegraf, I'm asking a specific OID (.1.3.6.1.4.1.14988.1.1.2.1.1.2.1 and .1.3.6.1.4.1.14988.1.1.2.1.1.2.2).
The queue I'm asking for are in first position in /queue simple but, because other simple queue was previously created, the OID is incremented.
I'd like to reset this without reseting the router, but I don't know if it's possible.

Could you help me ?

Regards,

Vincent
 
VincentL
newbie
Topic Author
Posts: 34
Joined: Fri Feb 03, 2017 3:27 pm

Re: [SNMP] Reset oid name

Wed Mar 30, 2022 11:20 am

Ok,
I've found a workaround.
I just need to destroy all queues, reboot and recreate them in the order I'd like to have.
If you have a better way, without reboot, feel free to post.

Regards,

Vincent
 
pe1chl
Forum Guru
Forum Guru
Posts: 10195
Joined: Mon Jun 08, 2015 12:09 pm

Re: [SNMP] Reset oid name

Wed Mar 30, 2022 11:30 am

In SNMP you should never assume that you can control an index or even that it always remains the same.
So, to determine the order you should "walk" .1.3.6.1.4.1.14988.1.1.2.1.1.2 and retrieve the different queue names, and use the index received from that to access the further info.
It looks like now MikroTik attempts to keep indexes constant once they are created, but you can never count on that.
 
VincentL
newbie
Topic Author
Posts: 34
Joined: Fri Feb 03, 2017 3:27 pm

Re: [SNMP] Reset oid name

Wed Mar 30, 2022 12:09 pm

@pe1chl :

Thank you for your informations and advices.
I ll try to see if Telegraf is able to "walk" and how I can make it work with my Flux queries if indexes are differents from one router to another one.

Regards,

Vincent
 
pe1chl
Forum Guru
Forum Guru
Posts: 10195
Joined: Mon Jun 08, 2015 12:09 pm

Re: [SNMP] Reset oid name

Wed Mar 30, 2022 12:46 pm

Ok I do not know that tool, but hopefully they make available some mechanism for that.
E.g. using snmpwalk:
snmpwalk -v1 -c public router .1.3.6.1.4.1.14988.1.1.2.1.1.2
you get one or more lines back with the names of the queues.
The returned OIDs on my router end in .1 .2 and .4 so there is no .3. Maybe I have created and removed a queue in the past.
So really I would need to use this output to translate from queue name to index in some external tool.
I use e.g. MRTG and this recognizes this issue and indeed it is possible to reference things by name, and it does this search "behind the scenes".
 
VincentL
newbie
Topic Author
Posts: 34
Joined: Fri Feb 03, 2017 3:27 pm

Re: [SNMP] Reset oid name

Thu Mar 31, 2022 11:37 am

Hello pe1chl,

Based of what I've read on Telegraf forum, Telegraf only perform "snmpget" and can't "walk" on the tree.
Maybe nightly builds can do this, but I want to use only stable version.

Regards,

Vincent
 
pe1chl
Forum Guru
Forum Guru
Posts: 10195
Joined: Mon Jun 08, 2015 12:09 pm

Re: [SNMP] Reset oid name

Thu Mar 31, 2022 12:02 pm

That sounds like it is more geared towards polling fixed OIDs that come without an index, or for which the index is very clearly defined.
(e.g. CPU temperature, FAN state, PSU state etc)
Any dynamically created item like interface, queue, etc will always have an unpredictable index that they need to find somehow.
Probably people use external tools like snmpwalk to find the actual OID+index to be used, and hope for the best.

I remember it was like that in the first releases of MRTG. At that time I used Cisco routers. The index were different after every reboot.
So after every router reboot (which of course happened seldomly) one had to rework the entire MRTG config. Until they fixed that
and you could use names, which MRTG then found by itself.
It looks like Telegraf still have to make that.

Who is online

Users browsing this forum: Speedyboat13 and 28 guests