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
NIFI-1537 Added SNMP processors #257
Conversation
Method[] methods = PDU.class.getDeclaredMethods(); | ||
Map<String, String> attributes = new HashMap<String, String>(); | ||
for (Method method : methods) { | ||
if (Modifier.isPublic(method.getModifiers()) && (method.getParameterCount() == 0) && method.getName().startsWith("get")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pierre, I noticed this when I was researching for your OnStopped issue. I believe this method 'getParameterCount' was introduced in Java 8 while we still have to be compliant with Java 7. So consider refactoring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Oleg, I have fixed it.
Pierre, so the ReflectionUtils fix is in #260. So watch the PR and once it is merged, rebase, update (remove that temp fix code) and test and let me know. I've already tested it with your branch but still extra validation would help. |
Oleg, yes sure, will do! |
Pre-requisite: NIFI-1595 has to be merged in before |
|
||
if("SNMPv3".equals(context.getProperty(SNMP_VERSION).getValue())) { | ||
USM usm = new USM(SecurityProtocols.getInstance(), new OctetString(MPv3.createLocalEngineID()), 0); | ||
SecurityModels.getInstance().addSecurityModel(usm); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just initiated a DISCUSS thread on the dev list. Basically while there is not much we can do at the moment, the above code will set the security model that will be applicable across all instances of SNMP processors within a single instance of NiFi.
Pierre You may want to rebase (merge conflicts) and push again since it's out of sink. |
@olegz there is http://snmpsim.sourceforge.net/ project, which can be used for testing purposes. Some simulation files are available with distribution, so basic testing may be done out-of-the-box |
@olegz I just rebased the PR. As @michalklempa mentioned, you can use online SNMP service provided by snmpsim (http://snmpsim.sourceforge.net/public-snmp-simulator.html), otherwise it depends of your OS. Personally, I tried the processor by requesting basic SNMP data (such as uptime for example) on a CentOS machine with net-snmp agent running with various configurations in SNMP v1, v2c and v3 (MD5/DES). As a side note, at this moment, the processor is expecting an OID in numerical format. If I try the following command on my computer:
I can get numerical OID by adding the option -On:
This way I can see that IF-MIB::interfaces is equivalent to .1.3.6.1.2.1.2.2.1 I will try to write something to help setting an environment. On a Linux-like environment, a quick setup can be: It will allow access to basic SNMP information in v1 and v2c with 'public' as community. For SNMP v3 setup, it is possible to add users using the command net-snmp-create-v3-user. Hope it helps, if not, let me know ;) |
@michalklempa @pvillard31 thank you both for the input. Will be reviewing and testing. |
@olegz any luck with this review? Cheers |
@trixpan @olegz @michalklempa |
@pvillard31 could you please rebase and fix merge conflicts one last time. I am now committed to review/test it so we can have it in 0.7. |
@olegz half-time ;) done! |
. . . and you almost scored ;) but. . . anyway, will try to wrap it up tomorrow |
Ok, finally I am in this PR and no distractions ;) |
@pvillard31 Had a merge conflict again, but fixed it myself. Nothing to do, just making comment for traceability. |
Processors for SNMP set/get/walk operations over SNMP v1, v2c & v3 using SNMP4J library.