Skip to content

Commit

Permalink
Enable heartbeat telemetry
Browse files Browse the repository at this point in the history
This commit allows heartbeat telemetry data to be sent through kibana.

The change to beats was introduced in elastic/beats#8621
  • Loading branch information
andrewvc committed Dec 6, 2018
1 parent 23effa5 commit de4c834
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 (!("heartbeat" in clusters[clusterUuid])) {
clusters[clusterUuid].heartbeat = {
monitors: 0,
endpoints: 0
}
}
var clusterHb = clusters[clusterUuid].heartbeat

clusterHb.monitors += heartbeatState.monitors
clusterHb.endpoints += heartbeatState.endpoints
for (var proto in heartbeatState) {
if (!heartbeatState.hasOwnProperty(proto)) continue;
let val = heartbeatState[proto]
if (typeof(val) !== "object") continue;

if (!(proto in clusters[clusterUuid])) {
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];
Expand Down Expand Up @@ -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({
Expand Down

0 comments on commit de4c834

Please sign in to comment.