-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kapacitor Rule Alert Config for HTTP, TCP, Exec, SMTP, and Alerta (parsed pasted Tick script) #864
Conversation
# Conflicts: # ui/src/kapacitor/components/RuleMessage.js
… rule alert config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks awesome. There's some cleanup, a couple of suggestions, and one issue that should be addressed before merging.
|
||
const alerts = enabledAlerts.map((text) => { | ||
return {text, ruleID: rule.id}; | ||
}).concat(defaultAlertEndpoints); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an issue here with SMTP. SMTP can be both preconfigured and default. So, we run the risk of it showing up twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be good now, it's been fixed in the constants.
ui/src/kapacitor/reducers/rules.js
Outdated
@@ -1,6 +1,26 @@ | |||
import {defaultRuleConfigs, DEFAULT_RULE_ID} from 'src/kapacitor/constants'; | |||
import _ from 'lodash'; | |||
|
|||
const alertaRegex = /(services)\('(.+?)'\)|(resource)\('(.+?)'\)|(event)\('(.+?)'\)|(environment)\('(.+?)'\)|(group)\('(.+?)'\)|(origin)\('(.+?)'\)|(token)\('(.+?)'\)/gi; | |||
|
|||
function parseAlerta(string, regex) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be pulled out of the reducer and put into the shared/parsing
dir and have it's own spec.
return (<input | ||
className="form-control col-xs-6" | ||
type="text" | ||
placeholder={DEFAULT_ALERT_PLACEHOLDERS[alert]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could also probably use a label
based one the alert also.
return strs; | ||
}, ['alerta()']).join('.'), | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are awesome and should probably be pulled out into the constants folder.
</div> | ||
</div> | ||
</div> | ||
); | ||
}, | ||
|
||
renderInput(updateAlertNodes, alert, rule) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this be better as its own component?
…rately. Refactor parseAlerta out of rules reducer into its own file in shared/prasing. Update appearance of AlertaConfig. Update appearance of RuleMessage input field. Remove smtp and alerta from default alerts.
…to the ALERTS constant.
# Conflicts: # CHANGELOG.md
# Conflicts: # CHANGELOG.md
Connect #625
Connect #713
Connect #782
Connect #793
Connect #801
Connect #834
The problem
TCP and HTTP kapacitor rule alert config support was implemented on the backend, but needed UI to support it. Exec, SMTP, and Alerta support has also been requested.
The Solution
Implement support in UI.
For Alerta we decided to allow users to paste their Tick script in order to properly configure all available options.