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

Include more context in Event Rules #14896

Open
llamafilm opened this issue Jan 23, 2024 · 4 comments
Open

Include more context in Event Rules #14896

llamafilm opened this issue Jan 23, 2024 · 4 comments
Labels
status: blocked Another issue or external requirement is preventing implementation type: feature Introduction of new functionality to the application

Comments

@llamafilm
Copy link
Contributor

NetBox version

v3.7.0

Feature type

Change to existing functionality

Proposed functionality

When triggering a Python script using Event Rule, I'd like to have access to more context, just like Webhooks have. Currently the script only gets the data object. Webhooks also have:

  • event
  • username
  • model
  • snapshots

Use case

I want to log the username to have an audit trail. I also want to log whether the script was run manually or by an event rule.
I want to use the snapshot data to build more complex conditions into the script. For example, the event rule triggers on every device update, and the script updates my monitoring system. But I only want it to run if certain key fields were changed, like the name or status. Because other fields like airflow are irrelevant for monitoring.

Database changes

No response

External dependencies

No response

@llamafilm llamafilm added the type: feature Introduction of new functionality to the application label Jan 23, 2024
@DanSheps DanSheps added the status: under review Further discussion is needed to determine this issue's scope and/or implementation label Jan 23, 2024
@renatoalmeidaoliveira
Copy link
Contributor

I think its related to #14884

@llamafilm
Copy link
Contributor Author

Yep, essentially the same request. Since you beat me to it, do you want to incorporate details from this request into yours and then close this one?

@jeremystretch
Copy link
Member

This needs to remain a separate FR. #14884 specifically addresses passing an event rule's action data to a script, whereas this FR deals more generally with context.

I'm going to mark this as blocked by #14884; once that has been resolved we can look at opening it up to include additional context.

@jeremystretch jeremystretch added status: blocked Another issue or external requirement is preventing implementation and removed status: under review Further discussion is needed to determine this issue's scope and/or implementation labels Feb 14, 2024
@SaschaSchwarzK
Copy link

It would be cool is the pre/post change data would be available in the conditions. Or a diff object that contains the changes. I currently face a problem that I get thousands of jobs as the condition in the event rules cannot look it down to a specific field that changed the value. So every time the item is changed, no matter what changed, the script is run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: blocked Another issue or external requirement is preventing implementation type: feature Introduction of new functionality to the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants