feat: mock plugins with real configs
so you no longer need to comment out xpack config in the kibana.dev.yml
This commit is contained in:
101
plugins/monitoring/index.js
Normal file
101
plugins/monitoring/index.js
Normal file
@@ -0,0 +1,101 @@
|
||||
import {
|
||||
XPACK_INFO_API_DEFAULT_POLL_FREQUENCY_IN_MILLIS,
|
||||
} from "../constants";
|
||||
|
||||
export function monitoring(kibana) {
|
||||
return new kibana.Plugin({
|
||||
name: "monitoring",
|
||||
id: "monitoring",
|
||||
configPrefix: "xpack.monitoring",
|
||||
config(Joi) {
|
||||
const { array, boolean, number, object, string } = Joi;
|
||||
const DEFAULT_REQUEST_HEADERS = ["authorization"];
|
||||
|
||||
return object({
|
||||
ccs: object({
|
||||
enabled: boolean().default(true)
|
||||
}).default(),
|
||||
enabled: boolean().default(true),
|
||||
ui: object({
|
||||
enabled: boolean().default(true),
|
||||
container: object({
|
||||
elasticsearch: object({
|
||||
enabled: boolean().default(false)
|
||||
}).default(),
|
||||
logstash: object({
|
||||
enabled: boolean().default(false)
|
||||
}).default()
|
||||
}).default()
|
||||
}).default(),
|
||||
index_pattern: string().default(".monitoring-*-2-*,.monitoring-*-6-*"),
|
||||
kibana: object({
|
||||
index_pattern: string().default(
|
||||
".monitoring-kibana-2-*,.monitoring-kibana-6-*"
|
||||
),
|
||||
collection: object({
|
||||
enabled: boolean().default(true),
|
||||
interval: number().default(10000) // op status metrics get buffered at `ops.interval` and flushed to the bulk endpoint at this interval
|
||||
}).default()
|
||||
}).default(),
|
||||
logstash: object({
|
||||
index_pattern: string().default(
|
||||
".monitoring-logstash-2-*,.monitoring-logstash-6-*"
|
||||
)
|
||||
}).default(),
|
||||
beats: object({
|
||||
index_pattern: string().default(".monitoring-beats-6-*")
|
||||
}).default(),
|
||||
cluster_alerts: object({
|
||||
enabled: boolean().default(true),
|
||||
index: string().default(".monitoring-alerts-6"),
|
||||
email_notifications: object({
|
||||
enabled: boolean().default(true)
|
||||
}).default()
|
||||
}).default(),
|
||||
xpack_api_polling_frequency_millis: number().default(
|
||||
XPACK_INFO_API_DEFAULT_POLL_FREQUENCY_IN_MILLIS
|
||||
),
|
||||
max_bucket_size: number().default(10000),
|
||||
min_interval_seconds: number().default(10),
|
||||
show_license_expiration: boolean().default(true),
|
||||
report_stats: boolean().default(true),
|
||||
node_resolver: string()
|
||||
.valid("uuid")
|
||||
.default("uuid"), // deprecated in 5.6; we can make them set it properly before we remove it
|
||||
agent: object({
|
||||
interval: string()
|
||||
.regex(/[\d\.]+[yMwdhms]/)
|
||||
.default("10s")
|
||||
}).default(),
|
||||
elasticsearch: object({
|
||||
customHeaders: object().default({}),
|
||||
index_pattern: string().default(
|
||||
".monitoring-es-2-*,.monitoring-es-6-*"
|
||||
),
|
||||
logQueries: boolean().default(false),
|
||||
requestHeadersWhitelist: array()
|
||||
.items()
|
||||
.single()
|
||||
.default(DEFAULT_REQUEST_HEADERS),
|
||||
url: string().uri({ scheme: ["http", "https"] }), // if empty, use Kibana's connection config
|
||||
username: string(),
|
||||
password: string(),
|
||||
requestTimeout: number().default(30000),
|
||||
pingTimeout: number().default(30000),
|
||||
ssl: object({
|
||||
verificationMode: string()
|
||||
.valid("none", "certificate", "full")
|
||||
.default("full"),
|
||||
certificateAuthorities: array()
|
||||
.single()
|
||||
.items(string()),
|
||||
certificate: string(),
|
||||
key: string(),
|
||||
keyPassphrase: string()
|
||||
}).default(),
|
||||
apiVersion: string().default("master")
|
||||
}).default()
|
||||
}).default();
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user