-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Move vpshere model to GA. * Revert go.mod * Update changelog. * Add integration test. * Add healthcheck. * Fix test. * Fix tests. * Remove beta cfgwarn. (cherry picked from commit b9628bc)
- Loading branch information
1 parent
51fbc24
commit 368e591
Showing
17 changed files
with
134 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
type: group | ||
description: > | ||
datastore | ||
release: beta | ||
release: ga | ||
fields: | ||
- name: name | ||
type: keyword | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
type: group | ||
description: > | ||
host | ||
release: beta | ||
release: ga | ||
fields: | ||
- name: name | ||
type: keyword | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters