ml-app-deployer icon indicating copy to clipboard operation
ml-app-deployer copied to clipboard

Allow simple way to create alert triggers

Open grtjn opened this issue 5 years ago • 4 comments

It seems that you can create alert configs with rules and actions, but not make it install the associated triggers automatically, like described here: https://docs.marklogic.com/REST/POST/manage/v2/databases/[id-or-name]/alert/configs

Would it be difficult to enable this? Maybe a small flag inside the alert config, or a separate file that indicates they should be created.

And for the time being, what would be the easiest workaround?

grtjn avatar Mar 18 '19 16:03 grtjn

Interesting, I wasn't aware of this endpoint - and I'm not sure how the "operation" part works. Do you have an example of what a "triggers" block/array looks like? I just checked the alerting config in a project that uses ml-gradle, but "triggers" is empty in it, and I don't know what would go in there (the docs just say a "trigger"- is that the name of a trigger?).

rjrudin avatar Mar 19 '19 00:03 rjrudin

The page is a bit misguiding. You use this endpoint to create new alerting configs, but also to add or remove alert-triggers:

You can use the uri parameter and the add-alert-triggers operation to add the triggers specified in the alert configuration to an existing alert configuration. You can use the uri parameter and the remove-alert-triggers operation to remove the triggers from an existing alert configuration.

And I guess this would be the full payload of the request, no alert config:

 {"operation": "add-alert-triggers"}

grtjn avatar Mar 19 '19 06:03 grtjn

What would the value of the "triggers" element even be? I verified that the manage-alert-config-properties.xsd defines "trigger" as just a string, but what does that string refer to?

rjrudin avatar Apr 04 '19 18:04 rjrudin

I want to bump this as I'm running into the same issue as @grtjn . As I understand it, you essentially need to replicate the workflow of alert:set-trigger-ids() registers it with the alert config. As such, my best guess is that the element is the ID of the trigger you want to register with the alert config.

cschlegelmilch avatar Oct 14 '19 04:10 cschlegelmilch