You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great if we could define an Event Rule based on an Event of Webhook Termination (implying a successful 2xx response). This way we can execute a follow-up webhook(s) after the first one succeeds. Similar to executing an Event Rule after a Job terminates.
Or perhaps even better: allow a set of webhooks to execute based on a single Event Rule, with the ability to prioritize them in execution order, where each subsequent webhook will only run if the previous one got a successful response.
I know this introduces a non-atomic sequence of events, but that's just the nature of the beast here.
Context
I've successfully created an Event Rule and Webhook that creates a Nagios host whenever a certain condition happens. However, I also want to add a few services to that Nagios host, but I can't figure out how to reliably do this.
Creating services for a host in Nagios requires using a different api endpoint. I can easily create a second Webhook for this, with a similar Event Rule trigger, but I can't guarantee the "services" webhook will only execute after a successful "host" webhook is finished; which is a problem, since I obviously can't add services to a non-existing host in Nagios.
Alternatives
I suppose we could setup an api server, that exposes a single endpoint for this purpose, and then trigger that with the NetBox Webhook and do all of the Nagios api steps there. That way we could even rollback the host creation if the services creation fails - ensuring an atomic operation (if I'm using that term correctly).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Feature
It would be great if we could define an Event Rule based on an Event of Webhook Termination (implying a successful 2xx response). This way we can execute a follow-up webhook(s) after the first one succeeds. Similar to executing an Event Rule after a Job terminates.
Or perhaps even better: allow a set of webhooks to execute based on a single Event Rule, with the ability to prioritize them in execution order, where each subsequent webhook will only run if the previous one got a successful response.
I know this introduces a non-atomic sequence of events, but that's just the nature of the beast here.
Context
I've successfully created an Event Rule and Webhook that creates a Nagios host whenever a certain condition happens. However, I also want to add a few services to that Nagios host, but I can't figure out how to reliably do this.
Creating services for a host in Nagios requires using a different api endpoint. I can easily create a second Webhook for this, with a similar Event Rule trigger, but I can't guarantee the "services" webhook will only execute after a successful "host" webhook is finished; which is a problem, since I obviously can't add services to a non-existing host in Nagios.
Alternatives
I suppose we could setup an api server, that exposes a single endpoint for this purpose, and then trigger that with the NetBox Webhook and do all of the Nagios api steps there. That way we could even rollback the host creation if the services creation fails - ensuring an atomic operation (if I'm using that term correctly).
Beta Was this translation helpful? Give feedback.
All reactions