-
Notifications
You must be signed in to change notification settings - Fork 8.2k
/
config.js
92 lines (89 loc) · 3.75 KB
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { XPACK_INFO_API_DEFAULT_POLL_FREQUENCY_IN_MILLIS } from '../../server/lib/constants';
/**
* User-configurable settings for xpack.monitoring via configuration schema
* @param {Object} Joi - HapiJS Joi module that allows for schema validation
* @return {Object} config schema
*/
export const config = (Joi) => {
const DEFAULT_REQUEST_HEADERS = [ 'authorization' ];
return Joi.object({
ccs: Joi.object({
enabled: Joi.boolean().default(true)
}).default(),
enabled: Joi.boolean().default(true),
ui: Joi.object({
enabled: Joi.boolean().default(true),
container: Joi.object({
elasticsearch: Joi.object({
enabled: Joi.boolean().default(false)
}).default(),
logstash: Joi.object({
enabled: Joi.boolean().default(false)
}).default()
}).default()
}).default(),
index_pattern: Joi.string().default('.monitoring-*-6-*'),
kibana: Joi.object({
index_pattern: Joi.string().default('.monitoring-kibana-6-*'),
collection: Joi.object({
enabled: Joi.boolean().default(true),
interval: Joi.number().default(10000) // op status metrics get buffered at `ops.interval` and flushed to the bulk endpoint at this interval
}).default()
}).default(),
logstash: Joi.object({
index_pattern: Joi.string().default('.monitoring-logstash-6-*')
}).default(),
beats: Joi.object({
index_pattern: Joi.string().default('.monitoring-beats-6-*')
}).default(),
cluster_alerts: Joi.object({
enabled: Joi.boolean().default(true),
index: Joi.string().default('.monitoring-alerts-6'),
email_notifications: Joi.object({
enabled: Joi.boolean().default(true),
email_address: Joi.string().email(),
}).default()
}).default(),
xpack_api_polling_frequency_millis: Joi.number().default(XPACK_INFO_API_DEFAULT_POLL_FREQUENCY_IN_MILLIS),
max_bucket_size: Joi.number().default(10000),
min_interval_seconds: Joi.number().default(10),
show_license_expiration: Joi.boolean().default(true),
report_stats: Joi.boolean().default(true),
agent: Joi.object({
interval: Joi.string().regex(/[\d\.]+[yMwdhms]/).default('10s')
}).default(),
elasticsearch: Joi.object({
customHeaders: Joi.object().default({}),
index_pattern: Joi.string().default('.monitoring-es-6-*'),
logQueries: Joi.boolean().default(false),
requestHeadersWhitelist: Joi.array().items().single().default(DEFAULT_REQUEST_HEADERS),
sniffOnStart: Joi.boolean().default(false),
sniffInterval: Joi.number().allow(false).default(false),
sniffOnConnectionFault: Joi.boolean().default(false),
hosts: Joi.array().items(Joi.string().uri({ scheme: ['http', 'https'] })).single(), // if empty, use Kibana's connection config
username: Joi.string(),
password: Joi.string(),
requestTimeout: Joi.number().default(30000),
pingTimeout: Joi.number().default(30000),
ssl: Joi.object({
verificationMode: Joi.string().valid('none', 'certificate', 'full').default('full'),
certificateAuthorities: Joi.array().single().items(Joi.string()),
certificate: Joi.string(),
key: Joi.string(),
keyPassphrase: Joi.string(),
alwaysPresentCertificate: Joi.boolean().default(false),
}).default(),
apiVersion: Joi.string().default('master')
}).default(),
tests: Joi.object({
cloud_detector: Joi.object({
enabled: Joi.boolean().default(true)
}).default()
}).default(),
}).default();
};