Skip to content

Commit

Permalink
[Metricbeat] Add Linux pressure metricset (#27355)
Browse files Browse the repository at this point in the history
* Adds new linux pressure metricset

* Tidy up code

* Be consistent in default config

* Run integration tests

* Make update

* make update v3

* Address comments

* Format tests

* Remove unused imports from tests

* Mage format

* Update changelog

* simplify loop

* Fix fields/mapping

(cherry picked from commit e49f257)

# Conflicts:
#	metricbeat/docs/fields.asciidoc
#	metricbeat/docs/modules/linux.asciidoc
#	metricbeat/docs/modules/linux/pressure.asciidoc
#	metricbeat/docs/modules_list.asciidoc
#	metricbeat/include/list_common.go
#	metricbeat/metricbeat.reference.yml
#	metricbeat/module/linux/_meta/config.yml
#	metricbeat/module/linux/fields.go
#	metricbeat/module/linux/pressure/pressure.go
#	metricbeat/module/linux/pressure/pressure_test.go
#	metricbeat/modules.d/linux.yml.disabled
#	x-pack/metricbeat/metricbeat.reference.yml
  • Loading branch information
b-deam authored and mergify-bot committed Nov 18, 2021
1 parent 74d48aa commit ab108fe
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Remove deprecated fields in Redis module. {issue}11835[11835] {pull}28246[28246]
- Align fields to Beats naming conventions in GCP module. {issue}27231[27231] {pull}27974[27974]
- system/process metricset: Replace usage of deprecated `process.ppid` field with `process.parent.pid`. {pull}28620[28620]
- Make use of secure port when accessing Kubelet API {pull}16063[16063]
- Add Tomcat overview dashboard {pull}14026[14026]
- Move service config under metrics and simplify metric types. {pull}18691[18691]
- Fix ECS compliance of user.id field in system/users metricset {pull}19019[19019]
- Remove "invalid zero" metrics on Windows and Darwin, don't report linux-only memory and diskio metrics when running under agent. {pull}21457[21457]
- Added `statsd.mappings` configuration for Statsd module {pull}26220[26220]
- Added Airflow lightweight module {pull}26220[26220]
- Add state_job metricset to Kubernetes module{pull}26479[26479]
- Bump AWS SDK version to v0.24.0 for WebIdentity authentication flow {issue}19393[19393] {pull}27126[27126]
- Add Linux pressure metricset {pull}27355[27355]

*Packetbeat*

Expand Down
3 changes: 3 additions & 0 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -45972,6 +45972,7 @@ type: long

--

<<<<<<< HEAD
[float]
=== rapl

Expand Down Expand Up @@ -46069,6 +46070,8 @@ type: float

--

=======
>>>>>>> e49f2579c ([Metricbeat] Add Linux pressure metricset (#27355))
[[exported-fields-logstash]]
== Logstash fields

Expand Down
9 changes: 9 additions & 0 deletions metricbeat/docs/modules/linux.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ metricbeat.modules:
# - conntrack
# - iostat
# - pressure
<<<<<<< HEAD
# - rapl
=======
>>>>>>> e49f2579c ([Metricbeat] Add Linux pressure metricset (#27355))
enabled: true
#hostfs: /hostfs
#rapl.use_msr_safe: false
Expand All @@ -57,8 +60,11 @@ The following metricsets are available:

* <<metricbeat-metricset-linux-pressure,pressure>>

<<<<<<< HEAD
* <<metricbeat-metricset-linux-rapl,rapl>>

=======
>>>>>>> e49f2579c ([Metricbeat] Add Linux pressure metricset (#27355))
include::linux/conntrack.asciidoc[]
include::linux/iostat.asciidoc[]
Expand All @@ -71,5 +77,8 @@ include::linux/pageinfo.asciidoc[]
include::linux/pressure.asciidoc[]
<<<<<<< HEAD
include::linux/rapl.asciidoc[]
=======
>>>>>>> e49f2579c ([Metricbeat] Add Linux pressure metricset (#27355))
4 changes: 4 additions & 0 deletions metricbeat/docs/modules/linux/pressure.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ This file is generated! See scripts/mage/docs_collector.go
////

[[metricbeat-metricset-linux-pressure]]
<<<<<<< HEAD
=== Linux pressure metricset
=======
=== linux pressure metricset
>>>>>>> e49f2579c ([Metricbeat] Add Linux pressure metricset (#27355))

beta[]

Expand Down
8 changes: 8 additions & 0 deletions metricbeat/docs/modules_list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,22 @@ This file is generated! See scripts/mage/docs_collector.go
|<<metricbeat-module-kvm,KVM>> beta[] |image:./images/icon-no.png[No prebuilt dashboards] |
.2+| .2+| |<<metricbeat-metricset-kvm-dommemstat,dommemstat>> beta[]
|<<metricbeat-metricset-kvm-status,status>> beta[]
<<<<<<< HEAD
|<<metricbeat-module-linux,Linux>> beta[] |image:./images/icon-no.png[No prebuilt dashboards] |
.7+| .7+| |<<metricbeat-metricset-linux-conntrack,conntrack>> beta[]
=======
|<<metricbeat-module-linux,linux>> beta[] |image:./images/icon-no.png[No prebuilt dashboards] |
.6+| .6+| |<<metricbeat-metricset-linux-conntrack,conntrack>> beta[]
>>>>>>> e49f2579c ([Metricbeat] Add Linux pressure metricset (#27355))
|<<metricbeat-metricset-linux-iostat,iostat>> beta[]
|<<metricbeat-metricset-linux-ksm,ksm>> beta[]
|<<metricbeat-metricset-linux-memory,memory>> beta[]
|<<metricbeat-metricset-linux-pageinfo,pageinfo>> beta[]
|<<metricbeat-metricset-linux-pressure,pressure>> beta[]
<<<<<<< HEAD
|<<metricbeat-metricset-linux-rapl,rapl>> beta[]
=======
>>>>>>> e49f2579c ([Metricbeat] Add Linux pressure metricset (#27355))
|<<metricbeat-module-logstash,Logstash>> |image:./images/icon-no.png[No prebuilt dashboards] |
.2+| .2+| |<<metricbeat-metricset-logstash-node,node>>
|<<metricbeat-metricset-logstash-node_stats,node_stats>>
Expand Down
3 changes: 3 additions & 0 deletions metricbeat/include/list_common.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,10 @@ metricbeat.modules:
# - conntrack
# - iostat
# - pressure
<<<<<<< HEAD
# - rapl
=======
>>>>>>> e49f2579c ([Metricbeat] Add Linux pressure metricset (#27355))
enabled: true
#hostfs: /hostfs
#rapl.use_msr_safe: false
Expand Down
3 changes: 3 additions & 0 deletions metricbeat/module/linux/_meta/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
# - conntrack
# - iostat
# - pressure
<<<<<<< HEAD
# - rapl
=======
>>>>>>> e49f2579c ([Metricbeat] Add Linux pressure metricset (#27355))
enabled: true
#hostfs: /hostfs
#rapl.use_msr_safe: false
Expand Down
4 changes: 4 additions & 0 deletions metricbeat/module/linux/fields.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions metricbeat/module/linux/pressure/pressure.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,31 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
return nil, fmt.Errorf("the %v/%v metricset is only supported on Linux", moduleName, metricsetName)
}

<<<<<<< HEAD
sys := base.Module().(linux.LinuxModule)
hostfs := sys.GetHostFS()

path := filepath.Join(hostfs, "proc")
=======
linuxModule, ok := base.Module().(*linux.Module)
if !ok {
return nil, errors.New("unexpected module type")
}

path := filepath.Join(linuxModule.HostFS, "proc")
>>>>>>> e49f2579c ([Metricbeat] Add Linux pressure metricset (#27355))
procfs, err := procfs.NewFS(path)
if err != nil {
return nil, errors.Wrapf(err, "error creating new Host FS at %s", path)
}

return &MetricSet{
BaseMetricSet: base,
<<<<<<< HEAD
fs: hostfs,
=======
fs: linuxModule.HostFS,
>>>>>>> e49f2579c ([Metricbeat] Add Linux pressure metricset (#27355))
procfs: procfs,
}, nil
}
Expand Down
3 changes: 3 additions & 0 deletions metricbeat/module/linux/pressure/pressure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
// specific language governing permissions and limitations
// under the License.

<<<<<<< HEAD
//go:build linux
=======
>>>>>>> e49f2579c ([Metricbeat] Add Linux pressure metricset (#27355))
// +build linux

package pressure
Expand Down
3 changes: 3 additions & 0 deletions metricbeat/modules.d/linux.yml.disabled
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
# - conntrack
# - iostat
# - pressure
<<<<<<< HEAD
# - rapl
=======
>>>>>>> e49f2579c ([Metricbeat] Add Linux pressure metricset (#27355))
enabled: true
#hostfs: /hostfs
#rapl.use_msr_safe: false
Expand Down
3 changes: 3 additions & 0 deletions x-pack/metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,10 @@ metricbeat.modules:
# - conntrack
# - iostat
# - pressure
<<<<<<< HEAD
# - rapl
=======
>>>>>>> e49f2579c ([Metricbeat] Add Linux pressure metricset (#27355))
enabled: true
#hostfs: /hostfs
#rapl.use_msr_safe: false
Expand Down

0 comments on commit ab108fe

Please sign in to comment.