[8.16] [Monitoring] Improved "Nodes changed" rule alert message (#195699) (#196630)

# Backport

This will backport the following commits from `main` to `8.16`:
- [[Monitoring] Improved "Nodes changed" rule alert message
(#195699)](https://github.com/elastic/kibana/pull/195699)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Valentin
Crettaz","email":"valentin.crettaz@elastic.co"},"sourceCommit":{"committedDate":"2024-10-11T14:06:45Z","message":"[Monitoring]
Improved \"Nodes changed\" rule alert message (#195699)\n\nCloses
https://github.com/elastic/kibana/issues/195533\r\n\r\n##
Summary\r\n\r\nThis PR fixes the format of the message of the Stack
Monitoring built-in\r\n\"Nodes changed\" alert to be less
confusing.\r\n\r\nThe message now lists the added/removed/restarted
nodes in a clearer\r\nfashion.\r\n\r\nInstead of\r\n```\r\nNodes changed
alert is firing for cluster-name-xyz (abc123). The following
Elasticsearch nodes have been added: removed: instance-0000000012
restarted.\r\n```\r\nThe message now shows like\r\n```\r\nNodes changed
alert is firing for cluster-name-xyz (abc123). The following
Elasticsearch nodes have been added: none / removed: instance-0000000012
/ restarted: none\r\n```\r\n\r\n### Checklist\r\n\r\n- [X] Any text
added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[X] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [X] This
renders correctly on smaller devices using a responsive\r\nlayout. (You
can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[X] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)","sha":"819d80a649dbcc6d7faf88f92b1f58039002ebe1","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["backport","Team:Monitoring","release_note:skip","Feature:Stack
Monitoring","v9.0.0","v8.16.0","backport:version"],"title":"[Monitoring]
Improved \"Nodes changed\" rule alert
message","number":195699,"url":"https://github.com/elastic/kibana/pull/195699","mergeCommit":{"message":"[Monitoring]
Improved \"Nodes changed\" rule alert message (#195699)\n\nCloses
https://github.com/elastic/kibana/issues/195533\r\n\r\n##
Summary\r\n\r\nThis PR fixes the format of the message of the Stack
Monitoring built-in\r\n\"Nodes changed\" alert to be less
confusing.\r\n\r\nThe message now lists the added/removed/restarted
nodes in a clearer\r\nfashion.\r\n\r\nInstead of\r\n```\r\nNodes changed
alert is firing for cluster-name-xyz (abc123). The following
Elasticsearch nodes have been added: removed: instance-0000000012
restarted.\r\n```\r\nThe message now shows like\r\n```\r\nNodes changed
alert is firing for cluster-name-xyz (abc123). The following
Elasticsearch nodes have been added: none / removed: instance-0000000012
/ restarted: none\r\n```\r\n\r\n### Checklist\r\n\r\n- [X] Any text
added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[X] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [X] This
renders correctly on smaller devices using a responsive\r\nlayout. (You
can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[X] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)","sha":"819d80a649dbcc6d7faf88f92b1f58039002ebe1"}},"sourceBranch":"main","suggestedTargetBranches":["8.16"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/195699","number":195699,"mergeCommit":{"message":"[Monitoring]
Improved \"Nodes changed\" rule alert message (#195699)\n\nCloses
https://github.com/elastic/kibana/issues/195533\r\n\r\n##
Summary\r\n\r\nThis PR fixes the format of the message of the Stack
Monitoring built-in\r\n\"Nodes changed\" alert to be less
confusing.\r\n\r\nThe message now lists the added/removed/restarted
nodes in a clearer\r\nfashion.\r\n\r\nInstead of\r\n```\r\nNodes changed
alert is firing for cluster-name-xyz (abc123). The following
Elasticsearch nodes have been added: removed: instance-0000000012
restarted.\r\n```\r\nThe message now shows like\r\n```\r\nNodes changed
alert is firing for cluster-name-xyz (abc123). The following
Elasticsearch nodes have been added: none / removed: instance-0000000012
/ restarted: none\r\n```\r\n\r\n### Checklist\r\n\r\n- [X] Any text
added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[X] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [X] This
renders correctly on smaller devices using a responsive\r\nlayout. (You
can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[X] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)","sha":"819d80a649dbcc6d7faf88f92b1f58039002ebe1"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Valentin Crettaz <valentin.crettaz@elastic.co>
This commit is contained in:
Kibana Machine 2024-10-22 03:43:44 +11:00 committed by GitHub
parent af90873ccb
commit 27792b2bc4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 8 deletions

View file

@ -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',
@ -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',

View file

@ -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',
{
@ -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,