Skip to content

Commit 250e8cc

Browse files
authored
[Monitoring] Only look at ES for the missing data alert for now (#83839) (#84331)
* Only look at ES for the missing data alert for now * PR feedback * Fix tests # Conflicts: # x-pack/plugins/monitoring/server/lib/alerts/fetch_missing_monitoring_data.ts
1 parent 114e2a1 commit 250e8cc

File tree

3 files changed

+35
-299
lines changed

3 files changed

+35
-299
lines changed

x-pack/plugins/monitoring/server/alerts/missing_monitoring_data_alert.test.ts

Lines changed: 8 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,6 @@ describe('MissingMonitoringDataAlert', () => {
6565
clusterUuid,
6666
gapDuration,
6767
},
68-
{
69-
stackProduct: 'kibana',
70-
stackProductUuid: 'kibanaUuid1',
71-
stackProductName: 'kibanaInstance1',
72-
clusterUuid,
73-
gapDuration: gapDuration + 10,
74-
},
7568
];
7669
const getUiSettingsService = () => ({
7770
asScopedToClient: jest.fn(),
@@ -140,7 +133,7 @@ describe('MissingMonitoringDataAlert', () => {
140133
// @ts-ignore
141134
params: alert.defaultParams,
142135
} as any);
143-
const count = 2;
136+
const count = 1;
144137
expect(replaceState).toHaveBeenCalledWith({
145138
alertStates: [
146139
{
@@ -187,61 +180,17 @@ describe('MissingMonitoringDataAlert', () => {
187180
lastCheckedMS: 0,
188181
},
189182
},
190-
{
191-
ccs: undefined,
192-
cluster: { clusterUuid, clusterName },
193-
gapDuration: gapDuration + 10,
194-
stackProduct: 'kibana',
195-
stackProductName: 'kibanaInstance1',
196-
stackProductUuid: 'kibanaUuid1',
197-
ui: {
198-
isFiring: true,
199-
message: {
200-
text:
201-
'For the past an hour, we have not detected any monitoring data from the Kibana instance: kibanaInstance1, starting at #absolute',
202-
nextSteps: [
203-
{
204-
text: '#start_linkView all Kibana instances#end_link',
205-
tokens: [
206-
{
207-
startToken: '#start_link',
208-
endToken: '#end_link',
209-
type: 'link',
210-
url: 'kibana/instances',
211-
},
212-
],
213-
},
214-
{
215-
text: 'Verify monitoring settings on the instance',
216-
},
217-
],
218-
tokens: [
219-
{
220-
startToken: '#absolute',
221-
type: 'time',
222-
isAbsolute: true,
223-
isRelative: false,
224-
timestamp: 1,
225-
},
226-
],
227-
},
228-
severity: 'danger',
229-
resolvedMS: 0,
230-
triggeredMS: 1,
231-
lastCheckedMS: 0,
232-
},
233-
},
234183
],
235184
});
236185
expect(scheduleActions).toHaveBeenCalledWith('default', {
237-
internalFullMessage: `We have not detected any monitoring data for 2 stack product(s) in cluster: testCluster. [View what monitoring data we do have for these stack products.](http://localhost:5601/app/monitoring#/overview?_g=(cluster_uuid:abc123))`,
238-
internalShortMessage: `We have not detected any monitoring data for 2 stack product(s) in cluster: testCluster. Verify these stack products are up and running, then double check the monitoring settings.`,
186+
internalFullMessage: `We have not detected any monitoring data for 1 stack product(s) in cluster: testCluster. [View what monitoring data we do have for these stack products.](http://localhost:5601/app/monitoring#/overview?_g=(cluster_uuid:abc123))`,
187+
internalShortMessage: `We have not detected any monitoring data for 1 stack product(s) in cluster: testCluster. Verify these stack products are up and running, then double check the monitoring settings.`,
239188
action: `[View what monitoring data we do have for these stack products.](http://localhost:5601/app/monitoring#/overview?_g=(cluster_uuid:abc123))`,
240189
actionPlain:
241190
'Verify these stack products are up and running, then double check the monitoring settings.',
242191
clusterName,
243192
count,
244-
stackProducts: 'Elasticsearch node: esName1, Kibana instance: kibanaInstance1',
193+
stackProducts: 'Elasticsearch node: esName1',
245194
state: 'firing',
246195
});
247196
});
@@ -442,16 +391,16 @@ describe('MissingMonitoringDataAlert', () => {
442391
// @ts-ignore
443392
params: alert.defaultParams,
444393
} as any);
445-
const count = 2;
394+
const count = 1;
446395
expect(scheduleActions).toHaveBeenCalledWith('default', {
447-
internalFullMessage: `We have not detected any monitoring data for 2 stack product(s) in cluster: testCluster. Verify these stack products are up and running, then double check the monitoring settings.`,
448-
internalShortMessage: `We have not detected any monitoring data for 2 stack product(s) in cluster: testCluster. Verify these stack products are up and running, then double check the monitoring settings.`,
396+
internalFullMessage: `We have not detected any monitoring data for 1 stack product(s) in cluster: testCluster. Verify these stack products are up and running, then double check the monitoring settings.`,
397+
internalShortMessage: `We have not detected any monitoring data for 1 stack product(s) in cluster: testCluster. Verify these stack products are up and running, then double check the monitoring settings.`,
449398
action: `[View what monitoring data we do have for these stack products.](http://localhost:5601/app/monitoring#/overview?_g=(cluster_uuid:abc123))`,
450399
actionPlain:
451400
'Verify these stack products are up and running, then double check the monitoring settings.',
452401
clusterName,
453402
count,
454-
stackProducts: 'Elasticsearch node: esName1, Kibana instance: kibanaInstance1',
403+
stackProducts: 'Elasticsearch node: esName1',
455404
state: 'firing',
456405
});
457406
});

x-pack/plugins/monitoring/server/lib/alerts/fetch_missing_monitoring_data.test.ts

Lines changed: 0 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -75,63 +75,6 @@ describe('fetchMissingMonitoringData', () => {
7575
timestamp: 2,
7676
},
7777
]),
78-
kibana_uuids: getResponse('.monitoring-kibana-*', [
79-
{
80-
uuid: 'kibanaUuid1',
81-
nameSource: {
82-
kibana_stats: {
83-
kibana: {
84-
name: 'kibanaName1',
85-
},
86-
},
87-
},
88-
timestamp: 4,
89-
},
90-
]),
91-
logstash_uuids: getResponse('.monitoring-logstash-*', [
92-
{
93-
uuid: 'logstashUuid1',
94-
nameSource: {
95-
logstash_stats: {
96-
logstash: {
97-
host: 'logstashName1',
98-
},
99-
},
100-
},
101-
timestamp: 2,
102-
},
103-
]),
104-
beats: {
105-
beats_uuids: getResponse('.monitoring-beats-*', [
106-
{
107-
uuid: 'beatUuid1',
108-
nameSource: {
109-
beats_stats: {
110-
beat: {
111-
name: 'beatName1',
112-
},
113-
},
114-
},
115-
timestamp: 0,
116-
},
117-
]),
118-
},
119-
apms: {
120-
apm_uuids: getResponse('.monitoring-beats-*', [
121-
{
122-
uuid: 'apmUuid1',
123-
nameSource: {
124-
beats_stats: {
125-
beat: {
126-
name: 'apmName1',
127-
type: 'apm-server',
128-
},
129-
},
130-
},
131-
timestamp: 1,
132-
},
133-
]),
134-
},
13578
})),
13679
},
13780
},
@@ -162,38 +105,6 @@ describe('fetchMissingMonitoringData', () => {
162105
gapDuration: 8,
163106
ccs: null,
164107
},
165-
{
166-
stackProduct: 'kibana',
167-
stackProductUuid: 'kibanaUuid1',
168-
stackProductName: 'kibanaName1',
169-
clusterUuid: 'clusterUuid1',
170-
gapDuration: 6,
171-
ccs: null,
172-
},
173-
{
174-
stackProduct: 'logstash',
175-
stackProductUuid: 'logstashUuid1',
176-
stackProductName: 'logstashName1',
177-
clusterUuid: 'clusterUuid1',
178-
gapDuration: 8,
179-
ccs: null,
180-
},
181-
{
182-
stackProduct: 'beats',
183-
stackProductUuid: 'beatUuid1',
184-
stackProductName: 'beatName1',
185-
clusterUuid: 'clusterUuid1',
186-
gapDuration: 10,
187-
ccs: null,
188-
},
189-
{
190-
stackProduct: 'apm',
191-
stackProductUuid: 'apmUuid1',
192-
stackProductName: 'apmName1',
193-
clusterUuid: 'clusterUuid1',
194-
gapDuration: 9,
195-
ccs: null,
196-
},
197108
]);
198109
});
199110

0 commit comments

Comments
 (0)