... when you google something and find yourself asking the same question a year earlier.
Subject: |
RE: Create multiple events from single event. |
Author: |
Michael Rogers |
Posted: |
2020-10-09 22:06 |
Hey, Morgan!
In your original post, you mentioned doing this in a transform instead of externally? I'm going to recommend going the external route. If your transform is taking the field of components from the parent event, then generating between 1-50 child events, every event in the pipeline behind the parent event has to wait for the transform to complete. If zeneventserver is slow to respond to the API calls creating the children, then everyone in line just gets to wait longer.
Instead, I recommend the following:
1. Build a command notification along the lines of
ssh user@automationhost 'yourEventScript ${evt/evid}'
2. Build yourEventScript to:
a. take an event ID as an argument.
b. make an event router call to look up the parent event by its ID.
c. break out the list of components from the parent ID to form a list.
d. run a loop using the list to create the child events
Now, you can build your error handling / timeouts / retries into your API script without fear of borking the event pipeline. It may not be as elegant as a single transform that does it all automagically, but it's far safer and easier to extend for future use cases.
I hope that helps!
------------------------------
Michael J. Rogers
Senior Instructor - Zenoss
Austin TX
------------------------------