Skip to content
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

Merged
merged 19 commits into from
Feb 10, 2017

Conversation

cryptoquick
Copy link
Contributor

@cryptoquick cryptoquick commented Feb 10, 2017

  • CHANGELOG.md updated
  • Rebased/mergable
  • Tests pass
  • Sign CLA (if not already signed)

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.

@cryptoquick cryptoquick changed the title Http tcp Kapacitor Rule Alert Config for HTTP, TCP, Exec, SMTP, and Alerta (parsed pasted Tick script) Feb 10, 2017
Copy link
Contributor

@121watts 121watts left a 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);
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@@ -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) {
Copy link
Contributor

@121watts 121watts Feb 10, 2017

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]}
Copy link
Contributor

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('.'),
};

Copy link
Contributor

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) {
Copy link
Contributor

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.
# Conflicts:
#	CHANGELOG.md
# Conflicts:
#	CHANGELOG.md
@121watts 121watts merged commit 0e0f0fc into master Feb 10, 2017
@121watts 121watts deleted the http-tcp branch February 10, 2017 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants