Updated scripted node_stats.js with all needed charts.

This commit is contained in:
Boaz Leskes 2013-11-06 18:20:20 +01:00
parent b8c7cb8655
commit 4b56416a50
2 changed files with 275 additions and 65 deletions

View file

@ -35,7 +35,7 @@ dashboard.title = 'Node Statistics';
dashboard.failover = false;
dashboard.index = {
default: 'ADD_A_TIME_FILTER',
pattern: '[es_monitor-]YYYY.MM.DD',
pattern: '[marvel-]YYYY.MM.DD',
interval: 'day'
};
@ -56,7 +56,7 @@ if(!_.isUndefined(ARGS.nodes)) {
queries = {
0: {
query: '*',
id: 0,
id: 0
}
};
}
@ -73,85 +73,295 @@ dashboard.services.query = {
dashboard.services.filter = {
list: {
0: {
from: "now-"+(ARGS.from||_d_timespan),
from: (ARGS.from||"now-" + _d_timespan),
to: "now",
field: "@timestamp",
type: "time",
active: true,
id: 0,
id: 0
},
1: {
type: "querystring",
mandate: "must",
active: true,
alias: "node stats",
query: "_type:node_stats",
id: 1
}
},
ids: [0]
},
ids: [0,1]
};
// Ok, lets make some rows. Since all of our panels are similar, we can abstract this.
// Obviously this is a partial list, feel free to expand on this.
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,
options: false,
legend: true,
resolution: 20
};
var rows = [
{
name:'OS',
charts: [{
title: 'CPU',
field: 'os.cpu.user',
derivative: false,
},{
title: 'Memory',
field: 'os.mem.used_percent',
derivative: false
},{
title: 'Swap',
field: 'os.swap.used_in_bytes',
derivative: true
}]
"title": "Server",
"panels": [
{
"value_field": "os.cpu.user",
"title": "CPU (user)",
"grid": {
"max": 100,
"min": 0
},
"annotate": {
"enable": false,
"query": "*",
"size": 20,
"field": "_type",
"sort": [
"_score",
"desc"
]
}
},
{
"value_field": "os.mem.used_percent",
"title": "Memory usage (%)",
"grid": {
"max": 100,
"min": 0
}
},
{
"value_field": "os.load_average.1m",
"title": "Load (1m)"
}
]
},
{
name: 'JVM',
charts: [{
title: 'New Generation GC Time',
field: 'jvm.gc.collectors.ParNew.collection_time_in_millis',
derivative: true
},{
title: 'New Generation GC Count',
field: 'jvm.gc.collectors.ParNew.collection_count',
derivative: true
},{
title: 'Old Generation GC Time',
field: 'jvm.gc.collectors.ConcurrentMarkSweep.collection_time_in_millis',
derivative: true
}]
"title": "Server 2",
"panels": [
{
"time_field": "@timestamp",
"value_field": "os.swap.used_in_bytes",
"title": "Used Swap"
}
],
"notice": false
},
{
"title": "JVM Memory",
"panels": [
{
"time_field": "@timestamp",
"value_field": "jvm.mem.heap_used_in_bytes",
"title": "Heap"
},
{
"value_field": "jvm.gc.collectors.ParNew.collection_time_in_millis",
"title": "GC Young Gen duration",
"derivative": true
},
{
"value_field": "jvm.gc.collectors.ParNew.collection_count",
"title": "GC counts",
"derivative": true
}
]
},
{
"title": "JVM Memory 2",
"panels": [
{
"value_field": "jvm.gc.collectors.ConcurrentMarkSweep.collection_time_in_millis",
"derivative": true,
"title": "GC Old Gen duration"
},
{
"value_field": "jvm.gc.collectors.ConcurrentMarkSweep.collection_count",
"derivative": true,
"title": "GC Old Gen count"
}
]
},
{
"title": "Caches",
"panels": [
{
"value_field": "indices.fielddata.memory_size_in_bytes",
"title": "Field Data"
},
{
"value_field": "indices.filter_cache.memory_size_in_bytes",
"title": "Filter cache"
},
{
"value_field": "indices.id_cache.memory_size_in_bytes",
"title": "Id cache"
}
]
},
{
"title": "Caches 2",
"panels": [
{
"value_field": "indices.completion.size_in_bytes",
"title": "Completion size"
}
]
},
{
"title": "Disk IO",
"panels": [
{
"value_field": "fs.data.disk_read_size_in_bytes",
"title": "Disk reads (bytes)",
"derivative": true
},
{
"value_field": "fs.data.disk_write_size_in_bytes",
"title": "Disk writes (bytes)",
"derivative": true
}
],
"notice": false
},
{
"title": "Network",
"panels": [
{
"value_field": "http.current_open",
"title": "HTTP currently open"
},
{
"value_field": "http.total_opened",
"title": "HTTP opened",
"derivative": true
}
]
},
{
"title": "Data",
"panels": [
{
"value_field": "indices.docs.count",
"title": "Documents"
},
{
"value_field": "indices.store.size_in_bytes",
"title": "Size"
}
]
},
{
"title": "Indexing",
"panels": [
{
"value_field": "indices.indexing.index_total",
"derivative": true,
"title": "Indexing requests"
},
{
"value_field": "indices.merges.current_size_in_bytes",
"title": "Merges (bytes)"
},
{
"value_field": "indices.refresh.total_time_in_millis",
"derivative": true,
"title": "Avg refresh time"
}
]
},
{
"title": "Indexing 2",
"panels": [
{
"value_field": "indices.flush.total",
"derivative": true,
"title": "Flush count"
}
]
},
{
"title": "Search & Get",
"panels": [
{
"value_field": "indices.search.query_total",
"derivative": true,
"title": "Search requests"
},
{
"value_field": "indices.get.total",
"derivative": true,
"title": "Get requests"
}
]
},
{
"title": "Process",
"panels": [
{
"value_field": "process.cpu.percent",
"title": "Process CPU"
},
{
"value_field": "jvm.threads.count",
"title": "Threads"
},
{
"value_field": "process.open_file_descriptors",
"title": "File descriptiors"
}
]
}
];
var showedSomething;
dashboard.rows = _.map(rows, function(r) {
return {
title: r.name,
height: '150px',
collapse: !_.contains(show,r.name),
panels: _.map(r.charts,function(c) {
// A bunch of histogram panels, with similar defaults
return {
title: c.title,
type: 'histogram',
span: 4,
time_field: '@timestamp',
value_field: c.field,
derivative: c.derivative,
bars: false,
lines: true,
stack: false,
fill: 0,
linewidth: 2,
mode: 'max', // Pretty sure we want max for all of these? No? Average for some?
zoomlinks: false,
options: false,
legend: false, // Might want to enable this, cleaner without it though
interactive: false // Because the filter pulldown is hidden
};
})
};
_.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;
}
});
return r;
});
// No pulldowns shown, and they can't be enabled.
dashboard.pulldowns = [{type:'query'}];
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;

View file

@ -167,7 +167,7 @@ function (angular, app, kbn, _, $) {
$scope.compareLink = function() {
var nodes = _.pluck(_.where($scope.nodes,{selected:true}),'name');
return "#/dashboard/script/node_stats.js?show=OS&nodes="+nodes.join(',');
return "#/dashboard/script/marvel.node_stats.js?show=OS&nodes="+nodes.join(',');
};
$scope.compareTip = function() {