2013-11-15 14:09:20 +01:00
|
|
|
/* global _ */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Node statistics scripted dashboard
|
|
|
|
* This script generates a dashboard object that Kibana can load.
|
|
|
|
*
|
|
|
|
* Parameters (all optional)
|
|
|
|
* nodes :: By default, a comma seperated list of queries to run. Default: *
|
|
|
|
* show :: The names of the rows to expand
|
|
|
|
* from :: Search this amount of time back, eg 15m, 1h, 2d. Default: 1d
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
// Setup some variables
|
|
|
|
var dashboard, queries, _d_timespan;
|
|
|
|
|
|
|
|
// All url parameters are available via the ARGS object
|
|
|
|
var ARGS;
|
|
|
|
|
|
|
|
// Set a default timespan if one isn't specified
|
|
|
|
_d_timespan = '1d';
|
|
|
|
|
|
|
|
// Intialize a skeleton with nothing but a rows array and service object
|
|
|
|
dashboard = {
|
|
|
|
rows: [],
|
|
|
|
services: {}
|
|
|
|
};
|
|
|
|
|
|
|
|
// Set a title
|
|
|
|
dashboard.title = 'Marvel - Index Statistics';
|
|
|
|
|
|
|
|
// And the index options
|
|
|
|
dashboard.failover = false;
|
|
|
|
dashboard.index = {
|
|
|
|
'default': 'ADD_A_TIME_FILTER',
|
2013-11-21 15:04:27 +01:00
|
|
|
'pattern': '[.marvel-]YYYY.MM.DD',
|
2013-12-13 20:32:59 +01:00
|
|
|
'interval': 'day',
|
|
|
|
'warm_fields': false
|
2013-11-15 14:09:20 +01:00
|
|
|
};
|
|
|
|
|
2014-01-08 18:21:33 +01:00
|
|
|
dashboard.refresh="1m";
|
2013-12-02 20:28:07 +01:00
|
|
|
|
|
|
|
|
2013-11-15 14:09:20 +01:00
|
|
|
// In this dashboard we let users pass nodes as comma seperated list to the query parameter.
|
|
|
|
// If nodes are defined, split into a list of query objects, otherwise, show all
|
|
|
|
// NOTE: ids must be integers, hence the parseInt()s
|
|
|
|
if (!_.isUndefined(ARGS.queries)) {
|
|
|
|
queries = _.object(_.map(JSON.parse(ARGS.queries), function (v, k) {
|
|
|
|
return [k, {
|
|
|
|
query: v.q,
|
|
|
|
alias: v.a || v.q,
|
|
|
|
pin: true,
|
|
|
|
id: parseInt(k, 10)
|
|
|
|
}];
|
|
|
|
}));
|
|
|
|
} else {
|
|
|
|
// No queries passed? Initialize a single query to match everything
|
|
|
|
queries = {
|
|
|
|
0: {
|
|
|
|
query: '*',
|
|
|
|
id: 0
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
var show = (ARGS.show || "").split(',');
|
|
|
|
|
|
|
|
// Now populate the query service with our objects
|
|
|
|
dashboard.services.query = {
|
|
|
|
list: queries,
|
|
|
|
ids: _.map(_.keys(queries), function (v) {
|
|
|
|
return parseInt(v, 10);
|
|
|
|
})
|
|
|
|
};
|
|
|
|
|
|
|
|
// Lets also add a default time filter, the value of which can be specified by the user
|
|
|
|
dashboard.services.filter = {
|
|
|
|
list: {
|
|
|
|
0: {
|
|
|
|
from: ARGS.from || "now-" + _d_timespan,
|
|
|
|
to: ARGS.to || "now",
|
|
|
|
field: "@timestamp",
|
|
|
|
type: "time",
|
|
|
|
active: true,
|
|
|
|
id: 0
|
|
|
|
},
|
|
|
|
1: {
|
|
|
|
type: "querystring",
|
|
|
|
mandate: "must",
|
|
|
|
active: true,
|
|
|
|
alias: "index stats",
|
|
|
|
query: "_type:index_stats",
|
|
|
|
id: 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
ids: [0, 1]
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var row_defaults = {
|
|
|
|
height: "150px",
|
|
|
|
collapse: true,
|
|
|
|
collapsable: true
|
|
|
|
};
|
|
|
|
|
|
|
|
var panel_defaults_by_type = {};
|
|
|
|
|
|
|
|
panel_defaults_by_type["histogram"] = {
|
|
|
|
span: 4,
|
|
|
|
time_field: '@timestamp',
|
|
|
|
bars: false,
|
|
|
|
lines: true,
|
|
|
|
stack: false,
|
|
|
|
linewidth: 2,
|
|
|
|
mode: 'max',
|
|
|
|
zoomlinks: false,
|
2013-11-28 21:22:32 +01:00
|
|
|
legend_counts: false,
|
2013-11-15 14:09:20 +01:00
|
|
|
options: false,
|
2014-01-07 00:31:13 +01:00
|
|
|
legend: false,
|
2013-12-13 20:32:59 +01:00
|
|
|
resolution: 20,
|
|
|
|
y_format: "short"
|
2013-11-15 14:09:20 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var rows = [
|
|
|
|
{
|
2014-01-10 21:26:51 +01:00
|
|
|
"title": "Essentials",
|
2013-11-15 14:09:20 +01:00
|
|
|
"panels": [
|
|
|
|
{
|
|
|
|
"value_field": "primaries.docs.count",
|
2014-01-10 21:26:51 +01:00
|
|
|
"title": "Documents"
|
2013-11-15 14:09:20 +01:00
|
|
|
},
|
|
|
|
{
|
2014-01-10 21:26:51 +01:00
|
|
|
"value_field": "total.indexing.index_total",
|
|
|
|
"derivative": true,
|
|
|
|
"mode": "min",
|
|
|
|
"scaleSeconds": true,
|
|
|
|
"title": "Indexing Rate Primaries"
|
2013-11-15 14:09:20 +01:00
|
|
|
},
|
|
|
|
{
|
2014-01-10 21:26:51 +01:00
|
|
|
"value_field": "total.search.query_total",
|
|
|
|
"derivative": true,
|
|
|
|
"mode": "min",
|
|
|
|
"scaleSeconds": true,
|
|
|
|
"title": "Search Shard Query Rate"
|
2013-11-15 14:09:20 +01:00
|
|
|
}
|
2014-01-10 21:26:51 +01:00
|
|
|
]
|
2013-11-15 14:09:20 +01:00
|
|
|
},
|
2013-12-02 22:06:00 +01:00
|
|
|
{
|
2014-01-10 21:26:51 +01:00
|
|
|
"title": "Search Requests Query",
|
2013-12-02 22:06:00 +01:00
|
|
|
"panels": [
|
|
|
|
{
|
2014-01-10 21:26:51 +01:00
|
|
|
"value_field": "total.search.query_total",
|
|
|
|
"derivative": true,
|
|
|
|
"mode": "min",
|
|
|
|
"scaleSeconds": true,
|
|
|
|
"title": "Search Shard Query Rate"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"value_field": "total.search.query_time_in_millis",
|
|
|
|
"derivative": true,
|
|
|
|
"mode": "min",
|
|
|
|
"scaleSeconds": true,
|
|
|
|
"scale": 0.001,
|
|
|
|
"title": "Total Shard Search Query Time"
|
2013-12-02 22:06:00 +01:00
|
|
|
}
|
2014-01-10 21:26:51 +01:00
|
|
|
]
|
2013-12-02 22:06:00 +01:00
|
|
|
},
|
2013-11-15 14:09:20 +01:00
|
|
|
{
|
2014-01-10 21:26:51 +01:00
|
|
|
"title": "Search Requests Fetch",
|
2013-11-15 14:09:20 +01:00
|
|
|
"panels": [
|
|
|
|
{
|
2014-01-10 21:26:51 +01:00
|
|
|
"value_field": "total.search.fetch_total",
|
2013-11-15 14:09:20 +01:00
|
|
|
"derivative": true,
|
|
|
|
"mode": "min",
|
2014-01-10 21:26:51 +01:00
|
|
|
"scaleSeconds": true,
|
|
|
|
"title": "Search Shard Fetch Rate"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"value_field": "total.search.fetch_time_in_millis",
|
|
|
|
"derivative": true,
|
|
|
|
"mode": "min",
|
|
|
|
"scaleSeconds": true,
|
|
|
|
"scale": 0.001,
|
|
|
|
"title": "Total Search Shard Fetch Time"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Indexing Requests",
|
|
|
|
"panels": [
|
|
|
|
{
|
|
|
|
"value_field": "total.indexing.index_total",
|
|
|
|
"derivative": true,
|
|
|
|
"mode": "min",
|
|
|
|
"scaleSeconds": true,
|
|
|
|
"title": "Indexing Rate Total"
|
2013-11-15 14:09:20 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"value_field": "total.indexing.index_time_in_millis",
|
|
|
|
"derivative": true,
|
|
|
|
"mode": "min",
|
2014-01-10 21:26:51 +01:00
|
|
|
"scaleSeconds": true,
|
|
|
|
"scale": 0.001,
|
|
|
|
"title": "Total Indexing Time"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"value_field": "total.indexing.delete_total",
|
|
|
|
"derivative": true,
|
|
|
|
"mode": "min",
|
|
|
|
"scaleSeconds": true,
|
|
|
|
"title": "Delete Rate"
|
2013-11-15 14:09:20 +01:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2014-01-10 21:26:51 +01:00
|
|
|
"title": "Get Requests",
|
2013-11-15 14:09:20 +01:00
|
|
|
"panels": [
|
|
|
|
{
|
2014-01-10 21:26:51 +01:00
|
|
|
"value_field": "total.get.total",
|
2013-11-15 14:09:20 +01:00
|
|
|
"derivative": true,
|
|
|
|
"mode": "min",
|
2014-01-10 21:26:51 +01:00
|
|
|
"scaleSeconds": true,
|
|
|
|
"title": "Get Requests Rate"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"value_field": "total.get.time_in_millis",
|
|
|
|
"derivative": true,
|
|
|
|
"mode": "min",
|
|
|
|
"scaleSeconds": true,
|
|
|
|
"scale": 0.001,
|
|
|
|
"title": "Total Get Time"
|
2013-11-15 14:09:20 +01:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2014-01-10 21:26:51 +01:00
|
|
|
"title": "Percolate Requests",
|
2013-11-15 14:09:20 +01:00
|
|
|
"panels": [
|
|
|
|
{
|
2014-01-10 21:26:51 +01:00
|
|
|
"value_field": "total.percolate.total",
|
2013-11-15 14:09:20 +01:00
|
|
|
"derivative": true,
|
|
|
|
"mode": "min",
|
2014-01-10 21:26:51 +01:00
|
|
|
"scaleSeconds": true,
|
|
|
|
"title": "Percolate Requests Rate"
|
2013-11-15 14:09:20 +01:00
|
|
|
},
|
|
|
|
{
|
2014-01-10 21:26:51 +01:00
|
|
|
"value_field": "total.percolate.time_in_millis",
|
|
|
|
"derivative": true,
|
|
|
|
"mode": "min",
|
|
|
|
"scaleSeconds": true,
|
|
|
|
"scale": 0.001,
|
|
|
|
"title": "Total Percolate Time"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"value_field": "total.percolate.queries",
|
|
|
|
"title": "Percolate Queries"
|
2013-11-15 14:09:20 +01:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2014-01-10 21:26:51 +01:00
|
|
|
"title": "Store",
|
2013-11-15 14:09:20 +01:00
|
|
|
"panels": [
|
|
|
|
{
|
2014-01-10 21:26:51 +01:00
|
|
|
"value_field": "primaries.docs.count",
|
|
|
|
"title": "Documents"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"value_field": "total.store.size_in_bytes",
|
|
|
|
"title": "Size",
|
|
|
|
"y_format": "bytes"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"value_field": "primaries.docs.deleted",
|
|
|
|
"title": "Deleted Documents"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Memory",
|
|
|
|
"panels": [
|
|
|
|
{
|
|
|
|
"value_field": "total.fielddata.memory_size_in_bytes",
|
|
|
|
"title": "Field Data",
|
|
|
|
"y_format": "bytes"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"value_field": "total.filter_cache.memory_size_in_bytes",
|
|
|
|
"title": "Filter cache",
|
|
|
|
"y_format": "bytes"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"value_field": "total.segments.memory_in_bytes",
|
|
|
|
"title": "Lucene Memory",
|
|
|
|
"y_format": "bytes"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Memory Extended",
|
|
|
|
"panels": [
|
|
|
|
{
|
|
|
|
"value_field": "total.id_cache.memory_size_in_bytes",
|
|
|
|
"title": "Id Cache",
|
|
|
|
"y_format": "bytes"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"value_field": "total.percolate.memory_size_in_bytes",
|
|
|
|
"title": "Percolation size",
|
|
|
|
"y_format": "bytes"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"value_field": "total.completion.size_in_bytes",
|
|
|
|
"title": "Completion size",
|
|
|
|
"y_format": "bytes"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Management",
|
|
|
|
"panels": [
|
|
|
|
{
|
|
|
|
"value_field": "total.merges.current_size_in_bytes",
|
|
|
|
"mode": "max",
|
|
|
|
"y_format": "bytes",
|
|
|
|
"title": "Current Merges"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"value_field": "total.refresh.total_time_in_millis",
|
2013-11-15 14:09:20 +01:00
|
|
|
"derivative": true,
|
|
|
|
"mode": "min",
|
2014-01-10 21:26:51 +01:00
|
|
|
"scale": 0.001,
|
|
|
|
"scaleSeconds": true,
|
|
|
|
"title": "Total Refresh Time"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"value_field": "total.flush.total",
|
|
|
|
"derivative": true,
|
|
|
|
"mode": "min",
|
|
|
|
"scaleSeconds": true,
|
|
|
|
"title": "Flush count"
|
2013-11-15 14:09:20 +01:00
|
|
|
}
|
2014-01-10 21:26:51 +01:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Management Extended",
|
|
|
|
"panels": [
|
|
|
|
{
|
|
|
|
"value_field": "total.search.open_contexts",
|
|
|
|
"mode": "max",
|
|
|
|
"title": "Open Search Contexts"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"value_field": "total.warmer.total_time_in_millis",
|
|
|
|
"derivative": true,
|
|
|
|
"mode": "min",
|
|
|
|
"scale": 0.001,
|
|
|
|
"scaleSeconds": true,
|
|
|
|
"title": "Total Warmer Time"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"value_field": "total.segments.count",
|
|
|
|
"title": "Segment Count"
|
|
|
|
}
|
|
|
|
]
|
2013-11-15 14:09:20 +01:00
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
var showedSomething;
|
|
|
|
|
|
|
|
dashboard.rows = _.map(rows, function (r) {
|
|
|
|
_.defaults(r, row_defaults);
|
|
|
|
_.each(r.panels, function (panel) {
|
|
|
|
if (!panel.type) {
|
|
|
|
panel.type = "histogram";
|
|
|
|
}
|
|
|
|
_.defaults(panel, panel_defaults_by_type[panel.type]);
|
|
|
|
if (_.contains(show, panel.value_field)) {
|
|
|
|
showedSomething = true;
|
|
|
|
r.collapse = false;
|
2014-01-10 21:26:51 +01:00
|
|
|
show = _.without(show, panel.value_field);
|
2013-11-15 14:09:20 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
return r;
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!showedSomething && dashboard.rows.length > 0) {
|
|
|
|
dashboard.rows[0].collapse = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dashboard.pulldowns = [
|
|
|
|
{
|
|
|
|
"type": "query",
|
|
|
|
"collapse": false,
|
|
|
|
"notice": false,
|
|
|
|
"enable": true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "filtering",
|
|
|
|
"collapse": true
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
// Now return the object and we're good!
|
|
|
|
return dashboard;
|