console/web/mock/dashboard/cluster_monitor.js

531 lines
14 KiB
JavaScript

import { func } from "prop-types";
let data = JSON.parse(`{
"cluster_stats" : {
"indices" : {
"completion" : {
"size_in_bytes" : 0
},
"shards" : {
"replication" : 0,
"primaries" : 11,
"total" : 11,
"index" : {
"replication" : {
"avg" : 0,
"min" : 0,
"max" : 0
},
"shards" : {
"min" : 1,
"avg" : 1,
"max" : 1
},
"primaries" : {
"avg" : 1,
"min" : 1,
"max" : 1
}
}
},
"mappings" : {
"field_types" : [
{
"name" : "alias",
"count" : 3,
"index_count" : 1
},
{
"name" : "binary",
"count" : 9,
"index_count" : 1
},
{
"name" : "boolean",
"count" : 101,
"index_count" : 6
},
{
"name" : "byte",
"count" : 1,
"index_count" : 1
},
{
"name" : "date",
"count" : 136,
"index_count" : 10
},
{
"name" : "double",
"count" : 103,
"index_count" : 1
},
{
"count" : 9,
"name" : "flattened",
"index_count" : 1
},
{
"name" : "float",
"count" : 142,
"index_count" : 2
},
{
"name" : "geo_point",
"count" : 7,
"index_count" : 1
},
{
"name" : "half_float",
"count" : 10,
"index_count" : 2
},
{
"name" : "integer",
"count" : 71,
"index_count" : 4
},
{
"count" : 20,
"name" : "ip",
"index_count" : 1
},
{
"name" : "keyword",
"count" : 1312,
"index_count" : 10
},
{
"name" : "long",
"count" : 2623,
"index_count" : 8
},
{
"name" : "nested",
"count" : 14,
"index_count" : 5
},
{
"name" : "object",
"count" : 2724,
"index_count" : 10
},
{
"count" : 121,
"name" : "scaled_float",
"index_count" : 1
},
{
"name" : "text",
"count" : 201,
"index_count" : 9
}
]
},
"query_cache" : {
"miss_count" : 31874,
"cache_size" : 0,
"memory_size_in_bytes" : 0,
"total_count" : 31874,
"evictions" : 0,
"hit_count" : 0,
"cache_count" : 0
},
"docs" : {
"deleted" : 692,
"count" : 102865
},
"fielddata" : {
"memory_size_in_bytes" : 1760,
"evictions" : 0
},
"count" : 11,
"store" : {
"size_in_bytes" : 5.2982999E7,
"reserved_in_bytes" : 0
},
"analysis" : {
"built_in_filters" : [ ],
"built_in_tokenizers" : [ ],
"tokenizer_types" : [ ],
"analyzer_types" : [ ],
"filter_types" : [ ],
"char_filter_types" : [ ],
"built_in_char_filters" : [ ],
"built_in_analyzers" : [ ]
},
"segments" : {
"version_map_memory_in_bytes" : 0,
"norms_memory_in_bytes" : 2496,
"file_sizes" : { },
"max_unsafe_auto_id_timestamp" : -1,
"count" : 36,
"fixed_bit_set_memory_in_bytes" : 14048,
"term_vectors_memory_in_bytes" : 0,
"points_memory_in_bytes" : 0,
"index_writer_memory_in_bytes" : 0,
"memory_in_bytes" : 332776,
"terms_memory_in_bytes" : 109824,
"doc_values_memory_in_bytes" : 202632,
"stored_fields_memory_in_bytes" : 17824
}
},
"nodes" : {
"jvm" : {
"max_uptime_in_millis" : 3.1722515E7,
"mem" : {
"heap_max_in_bytes" : 1.073741824E9,
"heap_used_in_bytes" : 3.3389824E8
},
"versions" : [
{
"vm_version" : "15.0.1+9",
"using_bundled_jdk" : true,
"bundled_jdk" : true,
"count" : 1,
"vm_vendor" : "AdoptOpenJDK",
"version" : "15.0.1",
"vm_name" : "OpenJDK 64-Bit Server VM"
}
],
"threads" : 86
},
"process" : {
"open_file_descriptors" : {
"avg" : 402,
"min" : 402,
"max" : 402
},
"cpu" : {
"percent" : 0
}
},
"network_types" : {
"http_types" : {
"security4" : 1
},
"transport_types" : {
"security4" : 1
}
},
"os" : {
"available_processors" : 8,
"pretty_names" : [
{
"pretty_name" : "Mac OS X",
"count" : 1
}
],
"names" : [
{
"name" : "Mac OS X",
"count" : 1
}
],
"mem" : {
"used_in_bytes" : 1.6490479616E10,
"free_percent" : 4,
"total_in_bytes" : 1.7179869184E10,
"free_in_bytes" : 6.89389568E8,
"used_percent" : 96
},
"allocated_processors" : 8
},
"versions" : [
"7.10.0"
],
"discovery_types" : {
"zen" : 1
},
"plugins" : [ ],
"count" : {
"data_warm" : 1,
"data" : 1,
"data_content" : 1,
"coordinating_only" : 0,
"ingest" : 1,
"master" : 1,
"transform" : 1,
"total" : 1,
"remote_cluster_client" : 1,
"data_cold" : 1,
"voting_only" : 0,
"ml" : 1,
"data_hot" : 1
},
"packaging_types" : [
{
"flavor" : "default",
"count" : 1,
"type" : "tar"
}
],
"fs" : {
"total_in_bytes" : 1.000240963584E12,
"free_in_bytes" : 9.55349225472E11,
"available_in_bytes" : 9.39232976896E11
},
"ingest" : {
"number_of_pipelines" : 1,
"processor_stats" : {
"gsub" : {
"current" : 0,
"time_in_millis" : 0,
"count" : 0,
"failed" : 0
},
"script" : {
"current" : 0,
"time_in_millis" : 0,
"count" : 0,
"failed" : 0
}
}
}
},
"cluster_uuid" : "JFpIbacZQamv9hkgQEDZ2Q",
"timestamp" : 1.606981605839E12,
"status" : "yellow"
}
}`);
let nodesStats = JSON.parse(`[
{
"key" : "node-1",
"doc_count" : 11,
"metrics" : {
"buckets" : [
{
"key_as_string" : "2020-12-04T09:40:00.000Z",
"key" : 1607074800000,
"doc_count" : 1,
"heap_percent" : {
"value" : 54.0
},
"heap_used" : {
"value" : 5.84281136E8
},
"index_time" : {
"value" : 5935.0
},
"cpu_used" : {
"value" : 0.0
},
"search_query_total" : {
"value" : 39044.0
},
"index_total" : {
"value" : 5130.0
},
"search_query_time" : {
"value" : 7314.0
}
},
{
"key_as_string" : "2020-12-04T09:40:30.000Z",
"key" : 1607074830000,
"doc_count" : 3,
"heap_percent" : {
"value" : 63.0
},
"heap_used" : {
"value" : 6.776044E8
},
"index_time" : {
"value" : 6037.0
},
"cpu_used" : {
"value" : 1.0
},
"search_query_total" : {
"value" : 39121.0
},
"index_total" : {
"value" : 5285.0
},
"search_query_time" : {
"value" : 7328.0
},
"ds" : {
"value" : 77.0
},
"ds1" : {
"value" : 14.0
},
"ds3" : {
"value" : 155.0
},
"ds4" : {
"value" : 102.0
}
},
{
"key_as_string" : "2020-12-04T09:41:00.000Z",
"key" : 1607074860000,
"doc_count" : 3,
"heap_percent" : {
"value" : 64.0
},
"heap_used" : {
"value" : 6.92956392E8
},
"index_time" : {
"value" : 6181.0
},
"cpu_used" : {
"value" : 1.0
},
"search_query_total" : {
"value" : 39231.0
},
"index_total" : {
"value" : 5426.0
},
"search_query_time" : {
"value" : 7343.0
},
"ds" : {
"value" : 110.0
},
"ds1" : {
"value" : 15.0
},
"ds3" : {
"value" : 141.0
},
"ds4" : {
"value" : 144.0
}
},
{
"key_as_string" : "2020-12-04T09:41:30.000Z",
"key" : 1607074890000,
"doc_count" : 3,
"heap_percent" : {
"value" : 64.0
},
"heap_used" : {
"value" : 6.9177856E8
},
"index_time" : {
"value" : 6304.0
},
"cpu_used" : {
"value" : 1.0
},
"search_query_total" : {
"value" : 39339.0
},
"index_total" : {
"value" : 5582.0
},
"search_query_time" : {
"value" : 7358.0
},
"ds" : {
"value" : 108.0
},
"ds1" : {
"value" : 15.0
},
"ds3" : {
"value" : 156.0
},
"ds4" : {
"value" : 123.0
}
},
{
"key_as_string" : "2020-12-04T09:42:00.000Z",
"key" : 1607074920000,
"doc_count" : 1,
"heap_percent" : {
"value" : 16.0
},
"heap_used" : {
"value" : 1.81371952E8
},
"index_time" : {
"value" : 6323.0
},
"cpu_used" : {
"value" : 1.0
},
"search_query_total" : {
"value" : 39375.0
},
"index_total" : {
"value" : 5631.0
},
"search_query_time" : {
"value" : 7361.0
},
"ds" : {
"value" : 36.0
},
"ds1" : {
"value" : 3.0
},
"ds3" : {
"value" : 49.0
},
"ds4" : {
"value" : 19.0
}
}
]
}
}
]`);
export default {
'GET /dashboard/cluster/overview': function(req, res){
let cluster_stats = data.cluster_stats;
let result = {
elasticsearch:{
cluster_stats:{
status: cluster_stats.status,
indices: {
count: cluster_stats.indices.count,
docs: cluster_stats.indices.docs,
shards: cluster_stats.indices.shards,
store: cluster_stats.indices.store,
},
nodes: {
count:{
total: cluster_stats.nodes.count.total,
},
fs: cluster_stats.nodes.fs,
jvm: {
max_uptime_in_millis: cluster_stats.nodes.jvm.max_uptime_in_millis,
mem: cluster_stats.nodes.jvm.mem,
}
}
}
}
};
res.send(result);
},
'GET /dashboard/cluster/nodes_stats': function(req, res) {
// var statsData = [{
// node_name: nodesStats.source_node.name,
// node_id: nodesStats.source_node.uuid,
// timestamp: nodesStats.timestamp,
// node_stats: {
// jvm: nodesStats.node_stats.jvm,
// process: nodesStats.node_stats.process,
// node_master: nodesStats.node_stats.node_master,
// indices: {
// search: nodesStats.node_stats.indices.search,
// indexing: nodesStats.node_stats.indices.indices,
// },
// fs: nodesStats.node_stats.fs,
// os: nodesStats.node_stats.os,
// }
// }];
res.send({
nodes_stats: nodesStats
});
},
};