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

Template variables are only replaced once for each trap #4

Open
dave-hassett-rft opened this issue Nov 10, 2016 · 3 comments
Open

Template variables are only replaced once for each trap #4

dave-hassett-rft opened this issue Nov 10, 2016 · 3 comments

Comments

@dave-hassett-rft
Copy link
Contributor

It seems that when a trap is received once, then again with different arguments, the template variable replacements from the first trap are retained. This appears to be related to the "trapdef" argument to the process_v2c_trap(trap, trapdef) method, which is only being passed by reference. The variable replacements are processed on the first trap call, but have already been replaced on the second call (and subsequent calls), so does nothing.

I'll send a merge request for a possible fix for this issue shortly.

dave-hassett-rft added a commit to dave-hassett-rft/sensu-extension-snmptrap that referenced this issue Nov 10, 2016
@warmfusion
Copy link
Owner

It took a little while to work out what you mean; but i think I understand the situation;

  1. Trap definitions are loaded into a hash
  2. The first SNMP Trap that gets handled mutates the hash template values directly
  3. A second SNMP trap gets handled uses the now modified trapdef which no longer has template values to replace

@warmfusion
Copy link
Owner

Hi @dhassett-tr - I've released a new version of the plugin that includes your changes in #5 - Can you check it's working as you'd expect for me?

@dave-hassett-rft
Copy link
Contributor Author

Thanks - I'll check when I get a moment. Much appreciated.

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

No branches or pull requests

2 participants