Merge "Change cpu load averages to be normalized by core count"

This commit is contained in:
Jenkins 2016-09-22 17:29:47 +00:00 committed by Gerrit Code Review
commit 84880ba0ee
2 changed files with 14 additions and 7 deletions

View File

@ -342,9 +342,9 @@ This section documents the system metrics that are sent by the Agent.
### Load
| Metric Name | Dimensions | Semantics |
| ----------- | ---------- | --------- |
| load.avg_1_min | | The average system load over a 1 minute period
| load.avg_5_min | | The average system load over a 5 minute period
| load.avg_15_min | | The average system load over a 15 minute period
| load.avg_1_min | | The normalized (by number of logical cores) average system load over a 1 minute period
| load.avg_5_min | | The normalized (by number of logical cores) average system load over a 5 minute period
| load.avg_15_min | | The normalized (by number of logical cores) average system load over a 15 minute period
### Memory
| Metric Name | Dimensions | Semantics |

View File

@ -50,14 +50,21 @@ class Load(checks.AgentCheck):
dimensions = self._set_dimensions(None)
#
# Normalize the load averages by number of cores
# so the metric is useful for alarming across
# hosts with varying core numbers
#
num_cores = psutil.cpu_count(logical=True)
self.gauge('load.avg_1_min',
float(load[0]),
round((float(load[0]) / num_cores), 3),
dimensions=dimensions)
self.gauge('load.avg_5_min',
float(load[1]),
round((float(load[1]) / num_cores), 3),
dimensions=dimensions)
self.gauge('load.avg_15_min',
float(load[2]),
round((float(load[2]) / num_cores), 3),
dimensions=dimensions)
log.debug('Collected 3 load metrics')
log.debug("Collected 3 load metrics (normalized by {} cores)".format(num_cores))