Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need a simple way of selecting large range of OIDs #28

Open
JonnyPhenomenon opened this issue Oct 4, 2023 · 3 comments
Open

Need a simple way of selecting large range of OIDs #28

JonnyPhenomenon opened this issue Oct 4, 2023 · 3 comments
Assignees
Labels
question Further information is requested

Comments

@JonnyPhenomenon
Copy link

I imagine this is more of a feature request than an issue, please forgive me.

I want to use an esp32 to poll the ifInOctets and ifOutOctets for up to 48 ports on a network switch, so I can control several addressable LED strips in the classroom to show where the network traffic is flowing.
Is there an easier way to create entire ranges of variables and callbacks and oid handlers and so on?

Currently, there is like 20 different locations that I have to create a new mention of each of the oid's I want to poll and process, and I would love to be able to just say "grab all the oid's from .1.3.6.1.2.1.2.2.1.10.1 through 48", but I don't know what I am doing . :(

can someone help us out here?

@shortbloke shortbloke self-assigned this Oct 10, 2023
@shortbloke shortbloke added the question Further information is requested label Oct 10, 2023
@allacmc
Copy link

allacmc commented Oct 12, 2023

I have the same need.
I need to monitor several different pieces of equipment and I can't have this in a fixed way.

I can't write directly in code which IP address will be addressed.

I need this to be configurable from a variable.

Can we contribute with a solution?

I'm trying to put all of this into matrices to see if I can increase the monitoring size.

@JonnyPhenomenon
Copy link
Author

Perhaps I should clarify: I wanted it to be easier to poll entire ranges of octets on a single network device. In my specific situation, I want to be able to poll the number of packets coming in and out of all (or up to) 48 of the ports on my core network switch.

I have worked out how to scan entire ranges of octets, and got some functional code working for it. I can scan up to 30 ports before I have issues with the device crashing for reason I do not know.

I will attach the code that I have worked out. - with some caveats:

  • First, I am not a trained programmer. In fact, I am so green here, I couldn't tell you what language this is programmed in if I hadn't been told "it looks like C or something" earlier today. Nevertheless, I have this code working on my device and I think it would be a good starting point for someone in a similar situation.

  • Second, I don't quite understand how to contribute stuff to github. I think my code is good enough to include with this library as an example, but I don't know how to go about contributing it. I'm all ears if someone wants to coach me through it. Also, please forgive me if this is a totally inappropriate way of posting this. - Tell me what to do and I'll correct it.

  • I tried to copy and past the code in here, but the code read some of my asterisks as formatting symbols and screwed it all up. So I'll attach it as a file. aaaaaand turns out I can't attach a .ino file, so I will rename it as a .txt file and try again.
    ESP32_SNMP_Traffic_Counter_example.ino.txt

I hope this works. :)

@shortbloke
Copy link
Owner

Thanks @JonnyPhenomenon I think your example may help others and I appreciate all the comments you've added, though a couple slightly misunderstand what's going on, but those can be easily fixed. I'll leave the code here for now, but I might look to add a version of it (with credit to you) to the examples section when a find a bit of spare time.

What I really like to do is create a more flexible option where a device can be defined/modelled to make it easier to poll multiple and different devices for differing data. Where data is available in tables, like switch ports, ideally the size of the table should be able to be calculated and data structures created to support the variable size of the tables, rather than using hard coded values.

However finding the time, and managing this complexity in a ESP32 library would be quite time consuming, especially when you can there are existing Standard libraries for Linux which would allow relatively low power devices like a Raspberry Pi to do this already.

An SNMP Manager (not agent) on an ESP32 is pretty niche, in a space where usage of SNMP is also relatively limited.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants