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

Move vsphere module to GA #17119

Merged
merged 8 commits into from
Mar 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Add support for CouchDB v2 {issue}16352[16352] {pull}16455[16455]
- Replace vpc metricset into vpn, transitgateway and natgateway metricsets. {pull}16892[16892]
- Release Oracle module as GA. {issue}14279[14279] {pull}16833[16833]
- Release vsphere module as GA. {issue}15798[15798] {pull}17119[17119]

*Packetbeat*

Expand Down
2 changes: 0 additions & 2 deletions metricbeat/docs/modules/vsphere.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ This file is generated! See scripts/mage/docs_collector.go
[[metricbeat-module-vsphere]]
== vSphere module

beta[]

The vSphere module uses the https://github.com/vmware/govmomi[Govmomi] library to collect metrics from any Vmware SDK URL (ESXi/VCenter). This library is built for and tested against ESXi and vCenter 5.5, 6.0 and 6.5.

By default it enables the metricsets `datastore`, `host` and `virtualmachine`.
Expand Down
2 changes: 0 additions & 2 deletions metricbeat/docs/modules/vsphere/datastore.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ This file is generated! See scripts/mage/docs_collector.go
[[metricbeat-metricset-vsphere-datastore]]
=== vSphere datastore metricset

beta[]

include::../../../module/vsphere/datastore/_meta/docs.asciidoc[]

This is a default metricset. If the host module is unconfigured, this metricset is enabled by default.
Expand Down
2 changes: 0 additions & 2 deletions metricbeat/docs/modules/vsphere/host.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ This file is generated! See scripts/mage/docs_collector.go
[[metricbeat-metricset-vsphere-host]]
=== vSphere host metricset

beta[]

include::../../../module/vsphere/host/_meta/docs.asciidoc[]

This is a default metricset. If the host module is unconfigured, this metricset is enabled by default.
Expand Down
2 changes: 0 additions & 2 deletions metricbeat/docs/modules/vsphere/virtualmachine.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ This file is generated! See scripts/mage/docs_collector.go
[[metricbeat-metricset-vsphere-virtualmachine]]
=== vSphere virtualmachine metricset

beta[]

include::../../../module/vsphere/virtualmachine/_meta/docs.asciidoc[]

This is a default metricset. If the host module is unconfigured, this metricset is enabled by default.
Expand Down
8 changes: 4 additions & 4 deletions metricbeat/docs/modules_list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,10 @@ This file is generated! See scripts/mage/docs_collector.go
.1+| .1+| |<<metricbeat-metricset-traefik-health,health>>
|<<metricbeat-module-uwsgi,uwsgi>> |image:./images/icon-yes.png[Prebuilt dashboards are available] |
.1+| .1+| |<<metricbeat-metricset-uwsgi-status,status>>
|<<metricbeat-module-vsphere,vSphere>> beta[] |image:./images/icon-yes.png[Prebuilt dashboards are available] |
.3+| .3+| |<<metricbeat-metricset-vsphere-datastore,datastore>> beta[]
|<<metricbeat-metricset-vsphere-host,host>> beta[]
|<<metricbeat-metricset-vsphere-virtualmachine,virtualmachine>> beta[]
|<<metricbeat-module-vsphere,vSphere>> |image:./images/icon-yes.png[Prebuilt dashboards are available] |
.3+| .3+| |<<metricbeat-metricset-vsphere-datastore,datastore>>
|<<metricbeat-metricset-vsphere-host,host>>
|<<metricbeat-metricset-vsphere-virtualmachine,virtualmachine>>
|<<metricbeat-module-windows,Windows>> |image:./images/icon-yes.png[Prebuilt dashboards are available] |
.2+| .2+| |<<metricbeat-metricset-windows-perfmon,perfmon>> beta[]
|<<metricbeat-metricset-windows-service,service>>
Expand Down
8 changes: 8 additions & 0 deletions metricbeat/module/vsphere/_meta/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ARG VSPHERE_GOLANG_VERSION
FROM golang:${VSPHERE_GOLANG_VERSION}-alpine

RUN apk add --no-cache curl git
RUN go get -u github.com/vmware/govmomi/vcsim

HEALTHCHECK --interval=1s --retries=60 --timeout=10s CMD curl http://localhost:8989/
CMD vcsim -l :8989
2 changes: 1 addition & 1 deletion metricbeat/module/vsphere/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "vSphere"
description: >
vSphere module
release: beta
release: ga
fields:
- name: vsphere
type: group
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/vsphere/datastore/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
type: group
description: >
datastore
release: beta
release: ga
fields:
- name: name
type: keyword
Expand Down
3 changes: 0 additions & 3 deletions metricbeat/module/vsphere/datastore/datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"github.com/pkg/errors"

"github.com/elastic/beats/v7/libbeat/common"
"github.com/elastic/beats/v7/libbeat/common/cfgwarn"
"github.com/elastic/beats/v7/metricbeat/mb"

"github.com/vmware/govmomi"
Expand All @@ -47,8 +46,6 @@ type MetricSet struct {

// New create a new instance of the MetricSet
func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
cfgwarn.Beta("The vsphere datastore metricset is beta")

config := struct {
Username string `config:"username"`
Password string `config:"password"`
Expand Down
11 changes: 11 additions & 0 deletions metricbeat/module/vsphere/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: '2.3'

services:
vsphere:
image: docker.elastic.co/integrations-ci/beats-vsphere:${VSPHERE_GOLANG_VERSION:-1.14}-1
build:
context: ./_meta
args:
VSPHERE_GOLANG_VERSION: ${VSPHERE_GOLANG_VERSION:-1.14}
ports:
- 8989
2 changes: 1 addition & 1 deletion metricbeat/module/vsphere/fields.go

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

2 changes: 1 addition & 1 deletion metricbeat/module/vsphere/host/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
type: group
description: >
host
release: beta
release: ga
fields:
- name: name
type: keyword
Expand Down
3 changes: 0 additions & 3 deletions metricbeat/module/vsphere/host/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/pkg/errors"

"github.com/elastic/beats/v7/libbeat/common"
"github.com/elastic/beats/v7/libbeat/common/cfgwarn"
"github.com/elastic/beats/v7/metricbeat/mb"

"github.com/vmware/govmomi"
Expand All @@ -52,8 +51,6 @@ type MetricSet struct {

// New create a new instance of the MetricSet
func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
cfgwarn.Beta("The vsphere host metricset is beta")

config := struct {
Username string `config:"username"`
Password string `config:"password"`
Expand Down
105 changes: 105 additions & 0 deletions metricbeat/module/vsphere/test_vsphere.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import os
import sys
import unittest

sys.path.append(os.path.join(os.path.dirname(__file__), '../../tests/system'))
import metricbeat


VSPHERE_FIELDS = metricbeat.COMMON_FIELDS + ["vsphere"]


@metricbeat.parameterized_with_supported_versions
class TestVsphere(metricbeat.BaseTest):
COMPOSE_SERVICES = ['vsphere']

@classmethod
def get_hosts(cls):
return ['https://{}/sdk'.format(cls.compose_host())]

@unittest.skipUnless(metricbeat.INTEGRATION_TESTS, "integration test")
def test_datastore(self):
"""
vsphere datastore test
"""
self.render_config_template(modules=[{
"name": "vsphere",
"metricsets": ["datastore"],
"hosts": self.get_hosts(),
"period": "5s",
"username": "user",
"password": "pass",
"extras": {
"insecure": True,
},
}])
proc = self.start_beat()
self.wait_until(lambda: self.output_lines() > 0)
proc.check_kill_and_wait()
self.assert_no_logged_warnings()

output = self.read_output_json()
self.assertEqual(len(output), 1)
evt = output[0]

self.assertCountEqual(self.de_dot(VSPHERE_FIELDS), evt.keys(), evt)

self.assert_fields_are_documented(evt)

@unittest.skipUnless(metricbeat.INTEGRATION_TESTS, "integration test")
def test_host(self):
"""
vsphere host test
"""
self.render_config_template(modules=[{
"name": "vsphere",
"metricsets": ["host"],
"hosts": self.get_hosts(),
"period": "5s",
"username": "user",
"password": "pass",
"extras": {
"insecure": True,
},
}])
proc = self.start_beat()
self.wait_until(lambda: self.output_lines() > 0)
proc.check_kill_and_wait()
self.assert_no_logged_warnings()

output = self.read_output_json()
self.assertEqual(len(output), 4)
evt = output[0]

self.assertCountEqual(self.de_dot(VSPHERE_FIELDS), evt.keys(), evt)

self.assert_fields_are_documented(evt)

@unittest.skipUnless(metricbeat.INTEGRATION_TESTS, "integration test")
def test_virtualmachine(self):
"""
vsphere virtualmachine test
"""
self.render_config_template(modules=[{
"name": "vsphere",
"metricsets": ["virtualmachine"],
"hosts": self.get_hosts(),
"period": "5s",
"username": "user",
"password": "pass",
"extras": {
"insecure": True,
},
}])
proc = self.start_beat()
self.wait_until(lambda: self.output_lines() > 0)
proc.check_kill_and_wait()
self.assert_no_logged_warnings()

output = self.read_output_json()
self.assertEqual(len(output), 4)
evt = output[0]

self.assertCountEqual(self.de_dot(VSPHERE_FIELDS), evt.keys(), evt)

self.assert_fields_are_documented(evt)
2 changes: 1 addition & 1 deletion metricbeat/module/vsphere/virtualmachine/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
type: group
description: >
virtualmachine
release: beta
release: ga
fields:
- name: host.id
type: keyword
Expand Down
3 changes: 0 additions & 3 deletions metricbeat/module/vsphere/virtualmachine/virtualmachine.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"strings"

"github.com/elastic/beats/v7/libbeat/common"
"github.com/elastic/beats/v7/libbeat/common/cfgwarn"
"github.com/elastic/beats/v7/metricbeat/mb"

"github.com/pkg/errors"
Expand Down Expand Up @@ -53,8 +52,6 @@ type MetricSet struct {

// New create a new instance of the MetricSet
func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
cfgwarn.Beta("The vsphere virtualmachine metricset is beta")

config := struct {
Username string `config:"username"`
Password string `config:"password"`
Expand Down