Skip to content

Commit

Permalink
[Monitoring] Improved "Nodes changed" rule alert message (elastic#195699
Browse files Browse the repository at this point in the history
)

Closes elastic#195533

## Summary

This PR fixes the format of the message of the Stack Monitoring built-in
"Nodes changed" alert to be less confusing.

The message now lists the added/removed/restarted nodes in a clearer
fashion.

Instead of
```
Nodes changed alert is firing for cluster-name-xyz (abc123). The following Elasticsearch nodes have been added: removed: instance-0000000012 restarted.
```
The message now shows like
```
Nodes changed alert is firing for cluster-name-xyz (abc123). The following Elasticsearch nodes have been added: none / removed: instance-0000000012 / restarted: none
```

### Checklist

- [X] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [X] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [X] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [X] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)
  • Loading branch information
consulthys authored Oct 11, 2024
1 parent 5131215 commit 819d80a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
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

0 comments on commit 819d80a

Please sign in to comment.