[Monitoring] Use Cgroup Data from _nodes/stats (elastic/elasticsearch#4484)

* [Monitoring] Use Cgroup Data from _nodes/stats

This adds Cgroup data from _nodes/stats.

- This also adds 5m and 15m from system load, which are sent from ES, but
  were not recorded. Kibana does record/report those values though.

Original commit: elastic/x-pack-elasticsearch@8e04452c60
This commit is contained in:
Chris Earle 2016-12-30 18:55:51 -05:00 committed by GitHub
parent 2bce702f62
commit d210213fc9
3 changed files with 70 additions and 2 deletions

View File

@ -66,6 +66,8 @@ public class NodeStatsResolver extends MonitoringIndexNameResolver.Timestamped<N
"node_stats.fs.total.free_in_bytes",
"node_stats.fs.total.available_in_bytes",
"node_stats.os.cpu.load_average.1m",
"node_stats.os.cpu.load_average.5m",
"node_stats.os.cpu.load_average.15m",
"node_stats.process.cpu.percent",
"node_stats.process.max_file_descriptors",
"node_stats.process.open_file_descriptors",
@ -99,6 +101,15 @@ public class NodeStatsResolver extends MonitoringIndexNameResolver.Timestamped<N
"node_stats.thread_pool.watcher.threads",
"node_stats.thread_pool.watcher.queue",
"node_stats.thread_pool.watcher.rejected",
// Cgroup data (generally Linux only and only sometimes on those systems)
"node_stats.os.cgroup.cpuacct.control_group",
"node_stats.os.cgroup.cpuacct.usage_nanos",
"node_stats.os.cgroup.cpu.control_group",
"node_stats.os.cgroup.cpu.cfs_period_micros",
"node_stats.os.cgroup.cpu.cfs_quota_micros",
"node_stats.os.cgroup.cpu.stat.number_of_elapsed_periods",
"node_stats.os.cgroup.cpu.stat.number_of_times_throttled",
"node_stats.os.cgroup.cpu.stat.time_throttled_nanos",
// Linux Only (at least for now)
// Disk Info
"node_stats.fs.data.spins",

View File

@ -581,7 +581,59 @@
}
},
"os": {
"type": "object"
"properties": {
"cgroup": {
"properties": {
"cpuacct": {
"properties": {
"control_group": {
"type": "keyword"
},
"usage_nanos": {
"type": "long"
}
}
},
"cpu": {
"properties": {
"control_group": {
"type": "keyword"
},
"stat": {
"properties": {
"number_of_elapsed_periods": {
"type": "long"
},
"number_of_times_throttled": {
"type": "long"
},
"time_throttled_nanos": {
"type": "long"
}
}
}
}
}
}
},
"cpu": {
"properties": {
"load_average": {
"properties": {
"1m": {
"type": "half_float"
},
"5m": {
"type": "half_float"
},
"15m": {
"type": "half_float"
}
}
}
}
}
}
},
"process": {
"type": "object"

View File

@ -82,7 +82,7 @@ public class NodeStatsResolverTests extends MonitoringIndexNameResolverTestCase<
return;
}
// we only report IoStats and spins on Linux
// we only report IoStats on Linux
if (Constants.LINUX == false) {
if (field.startsWith("node_stats.fs.io_stats")) {
return;
@ -94,6 +94,11 @@ public class NodeStatsResolverTests extends MonitoringIndexNameResolverTestCase<
return;
}
// cgroups can be null, and it's only reported on Linux
if (field.startsWith("node_stats.os.cgroup")) {
return;
}
super.assertSourceField(field, sourceFields);
}