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

Added custom snmp v2 community parameter. #80

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Costya-Y
Copy link

@Costya-Y Costya-Y commented Jun 4, 2019

Hi,

We have a lot of recordings and want to set the same community name for each of them.
That simplifies the testing process a lot.

Thank you,
Costya

P.S. Unfortunately we cannot share any of those recordings, but if you want I can run a few tests on them for you.

@etingof
Copy link
Owner

etingof commented Jul 30, 2019

Thank you for rising this! And sorry for insanely late response!

One thing I do not quite understand is how do you address the individual simulated agents? My immediate guess would be that you do that by network address (e.g. local or remote endpoint). In that case, snmpsim should work out of the box if you arrange your .snmprec files like this:

community / transport-ID / source-address .snmprec

...if you select your agents by client address or like this:

community / transport-ID .snmprec

...if you select your agent by the address/port it is listening on.

The doc explains that in greater details.

Would that work for you? Or your use-case is different? I am eager to learn than! ;-)

@Costya-Y
Copy link
Author

Costya-Y commented Aug 7, 2019

Hi,

Sorry for the delay with answering.

Previously we used a different app to simulate snmp data, but at some point, it became very unstable, and we decided to move to snmpsimd.

At the moment, we are using filenames to store a different kind of data (bug-id, device_type, etc.), and cannot change them to:
community/transport-ID .snmprec

But if we add a flag to specify snmp-community it allows us to override community from the filename, and use the same community on all the recordings.

To run all these recordings we create a set of subinterfaces on a Linux server and assign ips based on the folder names Recording192.168.1.xx/bug1212-IOSXR.snmprec

I can share commands we use to run snmpsimd.

Thank you,
Costya

@etingof
Copy link
Owner

etingof commented Aug 8, 2019

One thing I am not sure I understand is how do you map subinterfaces to .snmprec files? The only thought that comes to my mind is to do it through through SNMP transport-id OID...

BTW, you can also symlink your .snmprec files to the names that snmpsimd would use for addressing.

@Costya-Y
Copy link
Author

Hi,

Let's say we created eth0:0 subinterface with IP 172.22.10.10, so we are adding --agent-udpv4-endpoint=172.22.10.10 to the command.
A symlink is an option, but it is a bit problematic since it will take some time to map existing recordings and will require an additional step for adding a new recording.

Thank you,
Costya

@etingof
Copy link
Owner

etingof commented Aug 13, 2019

Let's say we created eth0:0 subinterface with IP 172.22.10.10, so we are adding --agent-udpv4-endpoint=172.22.10.10 to the command.

So you have snmpsimd listening at 172.22.10.10 and you have a bunch of .snmprec files laying around under strange names. How do you make snmpsimd picking the right file even if it trusts some known community name? That's what I am missing!

@Costya-Y
Copy link
Author

Oh now I see, the command looks like:
snmpsimd.py --process-user=nobody --process-group=nogroup --data-dir={recording_folder} --agent-udpv4-endpoint={}:161 --v2c-arch --v2c-community=public --daemonize

{recording_folder} = /home/user/recordings/recording1
inside this folder there will be something like 10.2.3.4_83405_Cisco_IOSXR.snmprec

@etingof
Copy link
Owner

etingof commented Aug 13, 2019

Right, I see, thanks!

That perhaps means that with the patch you are using, one snmpsimd process can serve just one .snmprec file under given community name....

BTW, if I got it right, you have one dedicated snmpsimd process per one local interface each serving one .snmprec file. So you might have lots of snmpsimd processes running? If that's the case, the entire foot print seems huge...

The snmpsimd process is asynchronous internally so a single daemon can serve many (thousands) of interfaces if you just list the on the command line. That might be way more efficient. But then you will need to symlink your .snmprec files...

@Costya-Y
Copy link
Author

Wow, and how that could be done from the command side?

@etingof
Copy link
Owner

etingof commented Aug 14, 2019

Just repeat --agent-udpv4-endpoint option as many times as you need to. If you run out of command-line length, you can use --args-from-file option to read the same command-line from a file.

@Costya-Y
Copy link
Author

I see, will give it a test later.
So far I would prefer to have one process per recording since sometimes recording size can be up to 500mb.

@etingof
Copy link
Owner

etingof commented Aug 19, 2019

So far I would prefer to have one process per recording since sometimes recording size can be up to 500mb.

I think snmpsim should be fine serving many large recordings at once. It does not load much into RAM, mostly operating on disk files.

@Costya-Y
Copy link
Author

Cool, I did try to make it work with one process, but symlinks are not useful since they require an extra step to adding each recording.

Also, the minus of running snmpsimd as one process - it requires to restart it every time I add the new recording, which affects everyone who is using the simulator.

So, If we can somehow eliminate the necessity of symlinks by supplying community names to snmpsimd by parameter or folder structure (ip/community/whatever-name-of-recording) or any other way, I would take a look at how to automatically load new recordings on the go.

Thank you,
Costya

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

Successfully merging this pull request may close these issues.

2 participants