mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
This commit allows heartbeat telemetry data to be sent through kibana. The change to beats was introduced in https://github.com/elastic/beats/pull/8621
This commit is contained in:
parent
3ae84bbd19
commit
52bb10511b
3 changed files with 118 additions and 0 deletions
|
@ -2,6 +2,58 @@
|
|||
{
|
||||
"hits": {
|
||||
"hits": [
|
||||
{
|
||||
"_source" : {
|
||||
"cluster_uuid": "W7hppdX7R229Oy3KQbZrTw",
|
||||
"type": "beats_state",
|
||||
"beats_state" : {
|
||||
"state" : {
|
||||
"heartbeat" : {
|
||||
"endpoints" : 2,
|
||||
"http" : {
|
||||
"endpoints" : 1,
|
||||
"monitors" : 1
|
||||
},
|
||||
"icmp" : {
|
||||
"monitors" : 0,
|
||||
"endpoints" : 0
|
||||
},
|
||||
"tcp" : {
|
||||
"monitors" : 1,
|
||||
"endpoints" : 1
|
||||
},
|
||||
"monitors" : 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"_source" : {
|
||||
"cluster_uuid": "W7hppdX7R229Oy3KQbZrTw",
|
||||
"type": "beats_state",
|
||||
"beats_state" : {
|
||||
"state" : {
|
||||
"heartbeat" : {
|
||||
"endpoints" : 2,
|
||||
"http" : {
|
||||
"endpoints" : 0,
|
||||
"monitors" : 0
|
||||
},
|
||||
"icmp" : {
|
||||
"monitors" : 0,
|
||||
"endpoints" : 0
|
||||
},
|
||||
"tcp" : {
|
||||
"monitors" : 1,
|
||||
"endpoints" : 2
|
||||
},
|
||||
"monitors" : 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"_source": {
|
||||
"type": "beats_state",
|
||||
|
@ -74,6 +126,26 @@
|
|||
"published": 1038
|
||||
}
|
||||
}
|
||||
},
|
||||
"heartbeat" : {
|
||||
"http" : {
|
||||
"endpoint_starts" : 1,
|
||||
"endpoint_stops" : 0,
|
||||
"monitor_starts" : 1,
|
||||
"monitor_stops" : 0
|
||||
},
|
||||
"icmp" : {
|
||||
"endpoint_starts" : 0,
|
||||
"endpoint_stops" : 0,
|
||||
"monitor_starts" : 0,
|
||||
"monitor_stops" : 0
|
||||
},
|
||||
"tcp" : {
|
||||
"endpoint_starts" : 1,
|
||||
"endpoint_stops" : 0,
|
||||
"monitor_starts" : 1,
|
||||
"monitor_stops" : 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11531,5 +11603,6 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
|
||||
{}
|
||||
]
|
||||
|
|
|
@ -154,6 +154,22 @@ describe('Get Beats Stats', () => {
|
|||
name: 'darwin'
|
||||
}
|
||||
]
|
||||
},
|
||||
heartbeat: {
|
||||
endpoints: 4,
|
||||
http: {
|
||||
endpoints: 1,
|
||||
monitors: 1
|
||||
},
|
||||
icmp: {
|
||||
monitors: 0,
|
||||
endpoints: 0
|
||||
},
|
||||
tcp: {
|
||||
monitors: 2,
|
||||
endpoints: 3
|
||||
},
|
||||
monitors: 3
|
||||
}
|
||||
},
|
||||
FlV4ckTxQ0a78hmBkzzc9A: {
|
||||
|
|
|
@ -103,6 +103,34 @@ export function processResults(results = [], { clusters, clusterHostSets, cluste
|
|||
clusters[clusterUuid].module.count += stateModule.count;
|
||||
}
|
||||
|
||||
const heartbeatState = get(hit, '_source.beats_state.state.heartbeat');
|
||||
if (heartbeatState !== undefined) {
|
||||
if (!clusters[clusterUuid].hasOwnProperty('heartbeat')) {
|
||||
clusters[clusterUuid].heartbeat = {
|
||||
monitors: 0,
|
||||
endpoints: 0
|
||||
};
|
||||
}
|
||||
const clusterHb = clusters[clusterUuid].heartbeat;
|
||||
|
||||
clusterHb.monitors += heartbeatState.monitors;
|
||||
clusterHb.endpoints += heartbeatState.endpoints;
|
||||
for (const proto in heartbeatState) {
|
||||
if (!heartbeatState.hasOwnProperty(proto)) continue;
|
||||
const val = heartbeatState[proto];
|
||||
if (typeof val !== "object") continue;
|
||||
|
||||
if (!clusterHb.hasOwnProperty(proto)) {
|
||||
clusterHb[proto] = {
|
||||
monitors: 0,
|
||||
endpoints: 0
|
||||
};
|
||||
}
|
||||
clusterHb[proto].monitors += val.monitors;
|
||||
clusterHb[proto].endpoints += val.endpoints;
|
||||
}
|
||||
}
|
||||
|
||||
const stateHost = get(hit, '_source.beats_state.state.host');
|
||||
if (stateHost !== undefined) {
|
||||
const hostMap = clusterArchitectureMaps[clusterUuid];
|
||||
|
@ -161,6 +189,7 @@ async function fetchBeatsByType(server, callCluster, clusterUuids, start, end, {
|
|||
'hits.hits._source.beats_state.state.input',
|
||||
'hits.hits._source.beats_state.state.module',
|
||||
'hits.hits._source.beats_state.state.host',
|
||||
'hits.hits._source.beats_state.state.heartbeat',
|
||||
],
|
||||
body: {
|
||||
query: createQuery({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue