Skip to content

Commit

Permalink
[Monitoring] Only look at ES for the missing data alert for now (#83839
Browse files Browse the repository at this point in the history
…) (#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
  • Loading branch information
chrisronline committed Nov 25, 2020
1 parent 114e2a1 commit 250e8cc
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 299 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,6 @@ describe('MissingMonitoringDataAlert', () => {
clusterUuid,
gapDuration,
},
{
stackProduct: 'kibana',
stackProductUuid: 'kibanaUuid1',
stackProductName: 'kibanaInstance1',
clusterUuid,
gapDuration: gapDuration + 10,
},
];
const getUiSettingsService = () => ({
asScopedToClient: jest.fn(),
Expand Down Expand Up @@ -140,7 +133,7 @@ describe('MissingMonitoringDataAlert', () => {
// @ts-ignore
params: alert.defaultParams,
} as any);
const count = 2;
const count = 1;
expect(replaceState).toHaveBeenCalledWith({
alertStates: [
{
Expand Down Expand Up @@ -187,61 +180,17 @@ describe('MissingMonitoringDataAlert', () => {
lastCheckedMS: 0,
},
},
{
ccs: undefined,
cluster: { clusterUuid, clusterName },
gapDuration: gapDuration + 10,
stackProduct: 'kibana',
stackProductName: 'kibanaInstance1',
stackProductUuid: 'kibanaUuid1',
ui: {
isFiring: true,
message: {
text:
'For the past an hour, we have not detected any monitoring data from the Kibana instance: kibanaInstance1, starting at #absolute',
nextSteps: [
{
text: '#start_linkView all Kibana instances#end_link',
tokens: [
{
startToken: '#start_link',
endToken: '#end_link',
type: 'link',
url: 'kibana/instances',
},
],
},
{
text: 'Verify monitoring settings on the instance',
},
],
tokens: [
{
startToken: '#absolute',
type: 'time',
isAbsolute: true,
isRelative: false,
timestamp: 1,
},
],
},
severity: 'danger',
resolvedMS: 0,
triggeredMS: 1,
lastCheckedMS: 0,
},
},
],
});
expect(scheduleActions).toHaveBeenCalledWith('default', {
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))`,
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.`,
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))`,
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.`,
action: `[View what monitoring data we do have for these stack products.](http://localhost:5601/app/monitoring#/overview?_g=(cluster_uuid:abc123))`,
actionPlain:
'Verify these stack products are up and running, then double check the monitoring settings.',
clusterName,
count,
stackProducts: 'Elasticsearch node: esName1, Kibana instance: kibanaInstance1',
stackProducts: 'Elasticsearch node: esName1',
state: 'firing',
});
});
Expand Down Expand Up @@ -442,16 +391,16 @@ describe('MissingMonitoringDataAlert', () => {
// @ts-ignore
params: alert.defaultParams,
} as any);
const count = 2;
const count = 1;
expect(scheduleActions).toHaveBeenCalledWith('default', {
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.`,
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.`,
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.`,
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.`,
action: `[View what monitoring data we do have for these stack products.](http://localhost:5601/app/monitoring#/overview?_g=(cluster_uuid:abc123))`,
actionPlain:
'Verify these stack products are up and running, then double check the monitoring settings.',
clusterName,
count,
stackProducts: 'Elasticsearch node: esName1, Kibana instance: kibanaInstance1',
stackProducts: 'Elasticsearch node: esName1',
state: 'firing',
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,63 +75,6 @@ describe('fetchMissingMonitoringData', () => {
timestamp: 2,
},
]),
kibana_uuids: getResponse('.monitoring-kibana-*', [
{
uuid: 'kibanaUuid1',
nameSource: {
kibana_stats: {
kibana: {
name: 'kibanaName1',
},
},
},
timestamp: 4,
},
]),
logstash_uuids: getResponse('.monitoring-logstash-*', [
{
uuid: 'logstashUuid1',
nameSource: {
logstash_stats: {
logstash: {
host: 'logstashName1',
},
},
},
timestamp: 2,
},
]),
beats: {
beats_uuids: getResponse('.monitoring-beats-*', [
{
uuid: 'beatUuid1',
nameSource: {
beats_stats: {
beat: {
name: 'beatName1',
},
},
},
timestamp: 0,
},
]),
},
apms: {
apm_uuids: getResponse('.monitoring-beats-*', [
{
uuid: 'apmUuid1',
nameSource: {
beats_stats: {
beat: {
name: 'apmName1',
type: 'apm-server',
},
},
},
timestamp: 1,
},
]),
},
})),
},
},
Expand Down Expand Up @@ -162,38 +105,6 @@ describe('fetchMissingMonitoringData', () => {
gapDuration: 8,
ccs: null,
},
{
stackProduct: 'kibana',
stackProductUuid: 'kibanaUuid1',
stackProductName: 'kibanaName1',
clusterUuid: 'clusterUuid1',
gapDuration: 6,
ccs: null,
},
{
stackProduct: 'logstash',
stackProductUuid: 'logstashUuid1',
stackProductName: 'logstashName1',
clusterUuid: 'clusterUuid1',
gapDuration: 8,
ccs: null,
},
{
stackProduct: 'beats',
stackProductUuid: 'beatUuid1',
stackProductName: 'beatName1',
clusterUuid: 'clusterUuid1',
gapDuration: 10,
ccs: null,
},
{
stackProduct: 'apm',
stackProductUuid: 'apmUuid1',
stackProductName: 'apmName1',
clusterUuid: 'clusterUuid1',
gapDuration: 9,
ccs: null,
},
]);
});

Expand Down
Loading

0 comments on commit 250e8cc

Please sign in to comment.