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

[Monitoring] Improved "Nodes changed" rule alert message #195699

Merged
merged 3 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,11 @@ describe('NodesChangedAlert', () => {
action: '[View nodes](elasticsearch/nodes)',
actionPlain: 'Verify that you added, removed, or restarted nodes.',
internalFullMessage:
'Nodes changed alert is firing for testCluster. The following Elasticsearch nodes have been added: removed: restarted:test. [View nodes](elasticsearch/nodes)',
'Nodes changed alert is firing for testCluster. The following Elasticsearch nodes have been added: none / removed: none / restarted: test. [View nodes](elasticsearch/nodes)',
internalShortMessage:
'Nodes changed alert is firing for testCluster. Verify that you added, removed, or restarted nodes.',
added: '',
removed: '',
added: 'none',
removed: 'none',
restarted: 'test',
clusterName,
state: 'firing',
Expand Down Expand Up @@ -287,7 +287,7 @@ describe('NodesChangedAlert', () => {
action: '[View nodes](elasticsearch/nodes)',
actionPlain: 'Verify that you added, removed, or restarted nodes.',
internalFullMessage:
'Nodes changed alert is firing for testCluster. The following Elasticsearch nodes have been added:newNodeName removed:removedNodeName restarted:test. [View nodes](elasticsearch/nodes)',
'Nodes changed alert is firing for testCluster. The following Elasticsearch nodes have been added: newNodeName / removed: removedNodeName / restarted: test. [View nodes](elasticsearch/nodes)',
internalShortMessage:
'Nodes changed alert is firing for testCluster. Verify that you added, removed, or restarted nodes.',
added: 'newNodeName',
Expand Down
8 changes: 4 additions & 4 deletions x-pack/plugins/monitoring/server/rules/nodes_changed_rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ export class NodesChangedRule extends BaseRule {
});
const action = `[${fullActionText}](elasticsearch/nodes)`;
const states = getNodeStates(nodes);
const added = states.added.map((node) => node.nodeName).join(',');
const removed = states.removed.map((node) => node.nodeName).join(',');
const restarted = states.restarted.map((node) => node.nodeName).join(',');
const added = states.added.map((node) => node.nodeName).join(',') || 'none';
const removed = states.removed.map((node) => node.nodeName).join(',') || 'none';
const restarted = states.restarted.map((node) => node.nodeName).join(',') || 'none';
const internalShortMessage = i18n.translate(
'xpack.monitoring.alerts.nodesChanged.firing.internalShortMessage',
{
Expand All @@ -223,7 +223,7 @@ export class NodesChangedRule extends BaseRule {
internalFullMessage: i18n.translate(
'xpack.monitoring.alerts.nodesChanged.firing.internalFullMessage',
{
defaultMessage: `Nodes changed alert is firing for {clusterName}. The following Elasticsearch nodes have been added:{added} removed:{removed} restarted:{restarted}. {action}`,
defaultMessage: `Nodes changed alert is firing for {clusterName}. The following Elasticsearch nodes have been added: {added} / removed: {removed} / restarted: {restarted}. {action}`,
values: {
clusterName: cluster.clusterName,
added,
Expand Down