Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export another metric load / number of cores #1868

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ https://github.com/elastic/beats/compare/v5.0.0-alpha3...master[Check the HEAD d
*Affecting all Beats*

*Metricbeat*
- Export load averages under load.avg instead of load. {issue}1868[1868]

*Packetbeat*

Expand Down Expand Up @@ -51,6 +52,7 @@ https://github.com/elastic/beats/compare/v5.0.0-alpha3...master[Check the HEAD d
*Affecting all Beats*

*Metricbeat*
- Export load / cores under load.norm. {issue}1868[1868]

*Packetbeat*

Expand Down
27 changes: 24 additions & 3 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -1926,27 +1926,48 @@ Load averages.



==== system.cpu.load.1
==== system.cpu.load.avg.1

type: float

Load average for the last minute.


==== system.cpu.load.5
==== system.cpu.load.avg.5

type: float

Load average for the last 5 minutes.


==== system.cpu.load.15
==== system.cpu.load.avg.15

type: float

Load average for the last 15 minutes.


==== system.cpu.load.norm.1

type: float

Load divided by the number of cores for the last minute.


==== system.cpu.load.norm.5

type: float

Load divided by the number of cores for the last 5 minutes.


==== system.cpu.load.norm.15

type: float

Load divided by the number of cores for the last 15 minutes.


[float]
=== diskio Fields

Expand Down
18 changes: 15 additions & 3 deletions metricbeat/etc/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1294,18 +1294,30 @@
description: >
Load averages.
fields:
- name: "1"
- name: "avg.1"
type: float
description: >
Load average for the last minute.
- name: "5"
- name: "avg.5"
type: float
description: >
Load average for the last 5 minutes.
- name: "15"
- name: "avg.15"
type: float
description: >
Load average for the last 15 minutes.
- name: "norm.1"
type: float
description: >
Load divided by the number of cores for the last minute.
- name: "norm.5"
type: float
description: >
Load divided by the number of cores for the last 5 minutes.
- name: "norm.15"
type: float
description: >
Load divided by the number of cores for the last 15 minutes.
- name: diskio
type: group
description: >
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/etc/kibana/index-pattern/metricbeat.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion metricbeat/etc/kibana/visualization/System-load.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"visState": "{\"title\":\"New Visualization\",\"type\":\"line\",\"params\":{\"shareYAxis\":true,\"addTooltip\":true,\"addLegend\":true,\"showCircles\":true,\"smoothLines\":false,\"interpolate\":\"linear\",\"scale\":\"linear\",\"drawLinesBetweenPoints\":true,\"radiusRatio\":9,\"times\":[],\"addTimeMarker\":false,\"defaultYExtents\":false,\"setYExtents\":false,\"yAxis\":{}},\"aggs\":[{\"id\":\"1\",\"type\":\"avg\",\"schema\":\"metric\",\"params\":{\"field\":\"system.cpu.load.1\",\"customLabel\":\"Load\"}},{\"id\":\"2\",\"type\":\"date_histogram\",\"schema\":\"segment\",\"params\":{\"field\":\"@timestamp\",\"interval\":\"auto\",\"customInterval\":\"2h\",\"min_doc_count\":1,\"extended_bounds\":{}}},{\"id\":\"3\",\"type\":\"terms\",\"schema\":\"group\",\"params\":{\"field\":\"beat.name\",\"size\":5,\"order\":\"desc\",\"orderBy\":\"1\"}}],\"listeners\":{}}",
"visState": "{\"title\":\"System load\",\"type\":\"line\",\"params\":{\"shareYAxis\":true,\"addTooltip\":true,\"addLegend\":true,\"showCircles\":true,\"smoothLines\":false,\"interpolate\":\"linear\",\"scale\":\"linear\",\"drawLinesBetweenPoints\":true,\"radiusRatio\":9,\"times\":[],\"addTimeMarker\":false,\"defaultYExtents\":false,\"setYExtents\":false,\"yAxis\":{}},\"aggs\":[{\"id\":\"1\",\"type\":\"avg\",\"schema\":\"metric\",\"params\":{\"field\":\"system.cpu.load.avg.1\",\"customLabel\":\"Load\"}},{\"id\":\"2\",\"type\":\"date_histogram\",\"schema\":\"segment\",\"params\":{\"field\":\"@timestamp\",\"interval\":\"auto\",\"customInterval\":\"2h\",\"min_doc_count\":1,\"extended_bounds\":{}}},{\"id\":\"3\",\"type\":\"terms\",\"schema\":\"group\",\"params\":{\"field\":\"beat.name\",\"size\":5,\"order\":\"desc\",\"orderBy\":\"1\"}}],\"listeners\":{}}",
Copy link
Contributor

@ruflin ruflin Jun 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The kibana files are also in the _meta folder now, so changes should be made there. You can just copy the files over and then run make collect

"description": "",
"title": "System load",
"uiStateJSON": "{}",
Expand Down
31 changes: 24 additions & 7 deletions metricbeat/metricbeat.template-es2x.json
Original file line number Diff line number Diff line change
Expand Up @@ -1090,14 +1090,31 @@
},
"load": {
"properties": {
"1": {
"type": "float"
},
"15": {
"type": "float"
"avg": {
"properties": {
"1": {
"type": "float"
},
"15": {
"type": "float"
},
"5": {
"type": "float"
}
}
},
"5": {
"type": "float"
"norm": {
"properties": {
"1": {
"type": "float"
},
"15": {
"type": "float"
},
"5": {
"type": "float"
}
}
}
}
},
Expand Down
31 changes: 24 additions & 7 deletions metricbeat/metricbeat.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -1061,14 +1061,31 @@
},
"load": {
"properties": {
"1": {
"type": "float"
},
"15": {
"type": "float"
"avg": {
"properties": {
"1": {
"type": "float"
},
"15": {
"type": "float"
},
"5": {
"type": "float"
}
}
},
"5": {
"type": "float"
"norm": {
"properties": {
"1": {
"type": "float"
},
"15": {
"type": "float"
},
"5": {
"type": "float"
}
}
}
}
},
Expand Down
1 change: 1 addition & 0 deletions metricbeat/module/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ List of standardised words and units across all metricsets. On the left are the
* day: days, d
* max: maximumg
* min: minimum
* norm: normalized
* pct: precentage
* request: req
* sec: seconds, second, s
Expand Down
18 changes: 15 additions & 3 deletions metricbeat/module/system/cpu/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,27 @@
description: >
Load averages.
fields:
- name: "1"
- name: "avg.1"
type: float
description: >
Load average for the last minute.
- name: "5"
- name: "avg.5"
type: float
description: >
Load average for the last 5 minutes.
- name: "15"
- name: "avg.15"
type: float
description: >
Load average for the last 15 minutes.
- name: "norm.1"
type: float
description: >
Load divided by the number of cores for the last minute.
- name: "norm.5"
type: float
description: >
Load divided by the number of cores for the last 5 minutes.
- name: "norm.15"
type: float
description: >
Load divided by the number of cores for the last 15 minutes.
13 changes: 10 additions & 3 deletions metricbeat/module/system/cpu/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,16 @@ func (m *MetricSet) Fetch() (common.MapStr, error) {
}

cpuStat["load"] = common.MapStr{
"1": loadStat.Load1,
"5": loadStat.Load5,
"15": loadStat.Load15,
"avg": common.MapStr{
"1": loadStat.Load1,
"5": loadStat.Load5,
"15": loadStat.Load15,
},
"norm": common.MapStr{
"1": loadStat.LoadNorm1,
"5": loadStat.LoadNorm5,
"15": loadStat.LoadNorm15,
},
}

return cpuStat, nil
Expand Down
18 changes: 15 additions & 3 deletions topbeat/system/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ type SystemLoad struct {
Load1 float64 `json:"load1"`
Load5 float64 `json:"load5"`
Load15 float64 `json:"load15"`

/* normalized values load / cores */
LoadNorm1 float64 `json:"load1_norm"`
LoadNorm5 float64 `json:"load5_norm"`
LoadNorm15 float64 `json:"load15_norm"`
}

type MemStat struct {
Expand All @@ -30,10 +35,17 @@ func GetSystemLoad() (*SystemLoad, error) {
return nil, err
}

cpuList := sigar.CpuList{}
cpuList.Get()
numCore := len(cpuList.List)

return &SystemLoad{
Load1: avg.One,
Load5: avg.Five,
Load15: avg.Fifteen,
Load1: avg.One,
Load5: avg.Five,
Load15: avg.Fifteen,
LoadNorm1: avg.One / float64(numCore),
LoadNorm5: avg.Five / float64(numCore),
LoadNorm15: avg.Fifteen / float64(numCore),
}, nil
}

Expand Down