Comments (6)
The context passed to your scripts (both trigger script and action script) has details of the error in the ctx.error
field. You can send a different alert text if there is an error by writing your mustache template as follows:
{{^ctx.error}}
The action ran successfully!
{{/ctx.error}}
{{#ctx.error}}
Action failed. Here is the error message: {{ctx.error}}
{{/ctx.error}}
When evaluating a trigger script (painless) the ctx.error
variable will contain the error capturing data if there was one. When evaluating an action script (mustache) ctx.error
will contain either the error capturing data or the error evaluating the script (in that order).
from alerting.
OK, I get it that I can write a conditional in my script. However, I have to know that I can do that. And it's ugly to have to conditionalize every alert.
More than that, I would like separate notifications for errors in my monitoring system. The team that responds to those issues could be different than the team that responds to the monitored condition.
from alerting.
OK, I get it that I can write a conditional in my script. However, I have to know that I can do that. And it's ugly to have to conditionalize every alert.
We went back and forth on having separate actions for errors vs. using the inline conditional in the script. Ultimately, we decided to go with the inline conditional as it provides flexibility to programmatically implement different policies vs. a pre-defined error notification. I agree that this needs to be better documented (perhaps in a blog or wiki post?)
/cc @aetter and @elfisher to explore how we can better surface this technique in documentation and UI.
More than that, I would like separate notifications for errors in my monitoring system. The team that responds to those issues could be different than the team that responds to the monitored condition.
I agree that this should be possible, but currently isn't. One way to allow for this is suppress notificatinos for actions if they produce no output (right now it throws an error, if there isn't any output). You can then achieve what you describe by splitting the conditional in the script into separate actions with different destinations for errors vs. normal monitoring. Place the normal action in a {{^ctx.error}}
block and the error action template in a {{#ctx.error}}
block. /cc'ing @elfisher for his thoughts.
from alerting.
I'd way rather maintain 2 different systems for alerting than maintain 2 different actions per trigger.
That gets really messy if I have even a moderate amount of triggers.
from alerting.
ctx.error
is mainly useful to deal with errors that are query and trigger specific (for e.g. not enough data, script error etc.). I'm not sure I understand what you mean by "2 different systems for alerting".
For errors related to the "monitoring system" itself (I assume you're thinking of something like being unable to send notifications or unable to save alerts to the alerting indices, multiple monitors being delayed), I agree that these would normally be handled by a different team than the monitor creator. That's why we logs those as errors/warnings to the ES log with the expectation that cluster administrators will be monitoring the logs. We also have a detailed system status API that can be used by administrators to monitor the overall status of the alerting plugin: https://opendistro.github.io/for-elasticsearch-docs/docs/alerting/api/#monitor-stats . This is intended to be integrated into whatever external cluster health monitoring is being used (similar to /_cluster/health
). So it's not expected that ctx.error
would be used to handle this.
Going back to your original issue: Would having a per-action flag to suppress running the action if the monitor is in an ERROR state solve your issue? Under the hood this could just check ctx.error
similar to the conditional above...
from alerting.
Closing in favor of opensearch-project/alerting#29
from alerting.
Related Issues (20)
- [BUG] Cannot send message to Azure service bus topic with shared sas key HOT 1
- [BUG]"Propagate exception from publishing Email notifications to Action run result" HOT 1
- Slack ACK url HOT 1
- Create Monitors using PPL, similar to use of query DSL HOT 2
- [BUG] Can not see monitors, destinations, email groups etc in GUI after installing through API HOT 1
- Support K8s service name as a valid web-hook destination URL HOT 1
- ctx.alert.isAcknowledged not accessible with trigger HOT 1
- UI notification for failed test of alert and destinations HOT 1
- Alerting with email as a destination not working in version 13.1.0.1. HOT 1
- Joining two queries
- [BUG] Alerting Webhooks incorrectly rejecting URL's HOT 2
- [BUG] Can not create monitor in the coordinating cluster when it involves remote indices HOT 1
- [BUG] No setting available for Monitor max triggers HOT 1
- Point people to OpenSearch
- [BUG] {{period_start}} and {{period_end}} seems not respected HOT 1
- Configuring cross-cluster domain across 2 OpenSearch 1.0 cluster throws TCP connection error HOT 2
- contents of fields of query resulting dataset from monitor
- Facing an issue in elasticsearch container logs for alerting is Could not convert socket to TLS, statuscode: 1 HOT 1
- Custom Alert Configure
- [BUG] Kibana alerting not working properly HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alerting.