|
4 | 4 | * you may not use this file except in compliance with the Elastic License. |
5 | 5 | */ |
6 | 6 |
|
| 7 | +import { schema } from '@kbn/config-schema'; |
7 | 8 | import { RequestHandlerContext } from 'kibana/server'; |
8 | 9 | import { |
9 | 10 | INDEX_PATTERN_ELASTICSEARCH, |
@@ -73,21 +74,31 @@ export function internalMonitoringCheckRoute( |
73 | 74 | ) { |
74 | 75 | npRoute.router.get( |
75 | 76 | { |
76 | | - path: '/api/monitoring/v1/elasticsearch_settings/check/internal_monitoring', |
77 | | - validate: false, |
| 77 | + path: '/api/monitoring/v1/elasticsearch_settings/check/internal_monitoring/{ccs}', |
| 78 | + validate: { |
| 79 | + params: schema.object({ |
| 80 | + ccs: schema.maybe(schema.string()), |
| 81 | + }), |
| 82 | + }, |
78 | 83 | }, |
79 | | - async (context, _request, response) => { |
| 84 | + async (context, request, response) => { |
80 | 85 | try { |
81 | 86 | const typeCount = { |
82 | 87 | legacy_indices: 0, |
83 | 88 | mb_indices: 0, |
84 | 89 | }; |
85 | 90 |
|
86 | 91 | const config = server.config(); |
87 | | - const ccs = '*'; |
88 | | - const esIndexPattern = prefixIndexPattern(config, INDEX_PATTERN_ELASTICSEARCH, ccs, true); |
89 | | - const kbnIndexPattern = prefixIndexPattern(config, INDEX_PATTERN_KIBANA, ccs, true); |
90 | | - const lsIndexPattern = prefixIndexPattern(config, INDEX_PATTERN_LOGSTASH, ccs, true); |
| 92 | + const { ccs } = request.params; |
| 93 | + const ccsPrefix = ccs === 'ccs' ? '*' : null; |
| 94 | + const esIndexPattern = prefixIndexPattern( |
| 95 | + config, |
| 96 | + INDEX_PATTERN_ELASTICSEARCH, |
| 97 | + ccsPrefix, |
| 98 | + true |
| 99 | + ); |
| 100 | + const kbnIndexPattern = prefixIndexPattern(config, INDEX_PATTERN_KIBANA, ccsPrefix, true); |
| 101 | + const lsIndexPattern = prefixIndexPattern(config, INDEX_PATTERN_LOGSTASH, ccsPrefix, true); |
91 | 102 |
|
92 | 103 | const indexCounts = await Promise.all([ |
93 | 104 | checkLatestMonitoringIsLegacy(context, esIndexPattern), |
|
0 commit comments