-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Description
When processing Beacon data using an "Engine" the "tag" in the call event = event_bus.get_event(tag="salt/beacon/") does not appear to allow wildcards, therefore you cannot specify the actual beacon type you wish to capture and process.
Describe the solution you'd like
Allow the tag parameter to accept wildcards so that the relevant events can be filter before the call exits.
Example:
event = event_bus.get_event(tag="salt/beacon/*/btmp")
event = event_bus.get_event(tag="salt/beacon/*/load/")
Describe alternatives you've considered
A workaround is to just attempt to access the expected fields and skip processing if they are not present.
Additional context
Example Load Beacon processing as currently implemented:
def start():
with event_bus_context(opts) as event_bus:
while True:
event = event_bus.get_event(wait=10,tag="salt/beacon/")
if event:
id = event.get("id", "")
m1 = event.get("1m", "")
if m1 != "":
m5 = event.get("5m","")
m15 = event.get("15m","")
write_load_data(id,m1,m5,m15)
Example diskusage beacon as currently implemented:
def start():
with event_bus_context(opts) as event_bus:
while True:
event = event_bus.get_event(wait=10,tag="salt/beacon/")
if event:
id = event.get("id", "")
diskusage = event.get("diskusage", "")
if diskusage != "":
mount = event.get("mount","")
write_diskusage_data(id,mount,diskusage)
Changes would not break existing code.