From 30ee8b4ae7f5def10cffdc5b2ab4a806f49c30d2 Mon Sep 17 00:00:00 2001 From: Mirko Bez Date: Tue, 12 Nov 2024 14:18:51 +0100 Subject: [PATCH] [Metricbeat][Aerospike] Bump aerospike-client-go version to 7.7.1 and add support for basic auth (#41233) * Update aerospike-client-go dependency to the latest version * Bump aerospike docker image version to latest v7 available * Add basic auth support * Add basic auth configuration tests * Add property InfoPolicy to the Metricset * Run Mage update in x-pack module * Add line in CHANGELOG.next.asciidoc * Update NOTICE.txt to contain updated information on aerospike-client library * Run mage check to fix build * Add support Authentication Mode * Add authmode to tests * Add Auth Mode to config and run mage update * Update metricbeat/module/aerospike/aerospike_test.go Spell username toghether, as suggested. Co-authored-by: Ishleen Kaur <102962586+ishleenk17@users.noreply.github.com> * Fix integration test by reverting AEROSPIKE_VERSION in docker-compose * Bump version to latest 7.x available * Adjust healthcheck to use asinfo instead of tcp ping: Aerospike opens the port **before** Aerospike is actually ready Use the image aerospike/aerospike-server-enterprise instead of aerospike because it contains the aerospike tools * Improve healthcheck to make sure that the namespace statistics can be extracted * Update metricbeat/module/aerospike/aerospike.go Co-authored-by: Anderson Queiroz * Make sure username/password are set together * Improve documentation to report with which version Aerospike is expected to work * Make release notes for the PR more accurate By clarifying that we bumped the aerospike-client-go library * Fix build by compiling aerospike asciidoc --------- Co-authored-by: Ishleen Kaur <102962586+ishleenk17@users.noreply.github.com> Co-authored-by: Anderson Queiroz (cherry picked from commit 71392cf6d9a9c27f6651524b76148950b664da4e) --- CHANGELOG.next.asciidoc | 1 + NOTICE.txt | 12 +-- go.mod | 4 +- go.sum | 8 +- metricbeat/docs/modules/aerospike.asciidoc | 12 ++- metricbeat/metricbeat.reference.yml | 10 ++ metricbeat/module/aerospike/_meta/Dockerfile | 5 +- .../aerospike/_meta/config.reference.yml | 10 ++ metricbeat/module/aerospike/_meta/config.yml | 10 ++ .../module/aerospike/_meta/docs.asciidoc | 2 +- metricbeat/module/aerospike/aerospike.go | 34 ++++++- metricbeat/module/aerospike/aerospike_test.go | 93 ++++++++++++++++++- .../module/aerospike/docker-compose.yml | 4 +- .../module/aerospike/namespace/namespace.go | 8 +- metricbeat/modules.d/aerospike.yml.disabled | 10 ++ x-pack/metricbeat/metricbeat.reference.yml | 10 ++ 16 files changed, 209 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 7558ec26e562..b610fe8daafb 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -387,6 +387,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff] - Added Palo Alto Networks module {pull}40686[40686] - Restore docker.network.in.* and docker.network.out.* fields in docker module {pull}40968[40968] - Add `id` field to all the vSphere metricsets. {pull}41097[41097] +- Bump aerospike-client-go to version v7.7.1 and add support for basic auth in Aerospike module {pull}41233[41233] - Only watch metadata for ReplicaSets in metricbeat k8s module {pull}41289[41289] *Metricbeat* diff --git a/NOTICE.txt b/NOTICE.txt index 41d6062a9bbd..9985d2efb43f 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -2806,12 +2806,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- -Dependency : github.com/aerospike/aerospike-client-go -Version: v1.27.1-0.20170612174108-0f3b54da6bdc +Dependency : github.com/aerospike/aerospike-client-go/v7 +Version: v7.7.1 Licence type (autodetected): Apache-2.0 -------------------------------------------------------------------------------- -Contents of probable licence file $GOMODCACHE/github.com/aerospike/aerospike-client-go@v1.27.1-0.20170612174108-0f3b54da6bdc/LICENSE: +Contents of probable licence file $GOMODCACHE/github.com/aerospike/aerospike-client-go/v7@v7.7.1/LICENSE: Apache License @@ -3002,7 +3002,7 @@ Contents of probable licence file $GOMODCACHE/github.com/aerospike/aerospike-cli same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2014-2016 Aerospike, Inc. + Copyright 2014-2020 Aerospike, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -54625,11 +54625,11 @@ SOFTWARE. -------------------------------------------------------------------------------- Dependency : github.com/yuin/gopher-lua -Version: v0.0.0-20170403160031-b402f3114ec7 +Version: v1.1.1 Licence type (autodetected): MIT -------------------------------------------------------------------------------- -Contents of probable licence file $GOMODCACHE/github.com/yuin/gopher-lua@v0.0.0-20170403160031-b402f3114ec7/LICENSE: +Contents of probable licence file $GOMODCACHE/github.com/yuin/gopher-lua@v1.1.1/LICENSE: The MIT License (MIT) diff --git a/go.mod b/go.mod index bcb9458e51b2..8cc8c4f512da 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,6 @@ require ( github.com/PaesslerAG/jsonpath v0.1.1 github.com/Shopify/sarama v1.27.0 github.com/StackExchange/wmi v1.2.1 - github.com/aerospike/aerospike-client-go v1.27.1-0.20170612174108-0f3b54da6bdc github.com/akavel/rsrc v0.8.0 // indirect github.com/apoydence/eachers v0.0.0-20181020210610-23942921fe77 // indirect github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 @@ -176,6 +175,7 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.4.0 github.com/Azure/azure-storage-blob-go v0.15.0 github.com/Azure/go-autorest/autorest/adal v0.9.24 + github.com/aerospike/aerospike-client-go/v7 v7.7.1 github.com/apache/arrow/go/v14 v14.0.2 github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.12 github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.13 @@ -408,7 +408,7 @@ require ( github.com/dlclark/regexp2 v1.4.0 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/moby/term v0.5.0 // indirect - github.com/yuin/gopher-lua v0.0.0-20170403160031-b402f3114ec7 // indirect + github.com/yuin/gopher-lua v1.1.1 // indirect gopkg.in/jcmturner/rpc.v1 v1.1.0 // indirect ) diff --git a/go.sum b/go.sum index c5bc0bbfd691..835f8916001c 100644 --- a/go.sum +++ b/go.sum @@ -132,8 +132,8 @@ github.com/Shopify/toxiproxy v2.1.4+incompatible h1:TKdv8HiTLgE5wdJuEML90aBgNWso github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= -github.com/aerospike/aerospike-client-go v1.27.1-0.20170612174108-0f3b54da6bdc h1:9iW/Fbn/R/nyUOiqo6AgwBe8uirqUIoTGF3vKG8qjoc= -github.com/aerospike/aerospike-client-go v1.27.1-0.20170612174108-0f3b54da6bdc/go.mod h1:zj8LBEnWBDOVEIJt8LvaRvDG5ARAoa5dBeHaB472NRc= +github.com/aerospike/aerospike-client-go/v7 v7.7.1 h1:lcskBtPZYe6ESObhIEQEp4XO1axYZpaFD3ie4iwr6tg= +github.com/aerospike/aerospike-client-go/v7 v7.7.1/go.mod h1:STlBtOkKT8nmp7iD+sEkr/JGEOu+4e2jGlNN0Jiu2a4= github.com/akavel/rsrc v0.8.0 h1:zjWn7ukO9Kc5Q62DOJCcxGpXC18RawVtYAGdz2aLlfw= github.com/akavel/rsrc v0.8.0/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -914,8 +914,8 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/yuin/gopher-lua v0.0.0-20170403160031-b402f3114ec7 h1:0gYLpmzecnaDCoeWxSfEJ7J1b6B/67+NV++4HKQXx+Y= -github.com/yuin/gopher-lua v0.0.0-20170403160031-b402f3114ec7/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU= +github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M= +github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw= github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= diff --git a/metricbeat/docs/modules/aerospike.asciidoc b/metricbeat/docs/modules/aerospike.asciidoc index a2c873665e11..b4c6a59d12ea 100644 --- a/metricbeat/docs/modules/aerospike.asciidoc +++ b/metricbeat/docs/modules/aerospike.asciidoc @@ -14,7 +14,7 @@ The Aerospike module uses the http://www.aerospike.com/docs/reference/info[Info [float] === Compatibility -The Aerospike metricsets were tested with Aerospike 3.9 and are expected to work with all versions >= 3.9. +The Aerospike metricsets were tested with Aerospike Enterprise Edition 7.2.0.1 and are expected to work with all versions >= 4.9. [float] @@ -45,6 +45,16 @@ metricbeat.modules: # Aerospike Cluster Name #cluster_name: myclustername + # Username of hosts. Empty by default. + #username: root + + # Password of hosts. Empty by default. + #password: secret + + # Authentication modes: https://aerospike.com/docs/server/guide/security/access-control + # Possible values: internal (default), external, pki + #auth_mode: internal + # Optional SSL/TLS (disabled by default) #ssl.enabled: true diff --git a/metricbeat/metricbeat.reference.yml b/metricbeat/metricbeat.reference.yml index b87cdb049fe6..0a05e0c6008b 100644 --- a/metricbeat/metricbeat.reference.yml +++ b/metricbeat/metricbeat.reference.yml @@ -152,6 +152,16 @@ metricbeat.modules: # Aerospike Cluster Name #cluster_name: myclustername + # Username of hosts. Empty by default. + #username: root + + # Password of hosts. Empty by default. + #password: secret + + # Authentication modes: https://aerospike.com/docs/server/guide/security/access-control + # Possible values: internal (default), external, pki + #auth_mode: internal + # Optional SSL/TLS (disabled by default) #ssl.enabled: true diff --git a/metricbeat/module/aerospike/_meta/Dockerfile b/metricbeat/module/aerospike/_meta/Dockerfile index ee1f021f71d7..5aea63a508e9 100644 --- a/metricbeat/module/aerospike/_meta/Dockerfile +++ b/metricbeat/module/aerospike/_meta/Dockerfile @@ -1,5 +1,4 @@ ARG AEROSPIKE_VERSION -FROM aerospike:${AEROSPIKE_VERSION} +FROM aerospike/aerospike-server-enterprise:${AEROSPIKE_VERSION} -RUN apt-get update && apt-get install -y netcat-openbsd -HEALTHCHECK --interval=1s --retries=90 CMD nc -z localhost 3000 +HEALTHCHECK --interval=1s --retries=90 CMD asinfo -v "namespace/test" | grep "ns_cluster_size=1" -q diff --git a/metricbeat/module/aerospike/_meta/config.reference.yml b/metricbeat/module/aerospike/_meta/config.reference.yml index cca162aa3db1..900f56de7da3 100644 --- a/metricbeat/module/aerospike/_meta/config.reference.yml +++ b/metricbeat/module/aerospike/_meta/config.reference.yml @@ -7,6 +7,16 @@ # Aerospike Cluster Name #cluster_name: myclustername + # Username of hosts. Empty by default. + #username: root + + # Password of hosts. Empty by default. + #password: secret + + # Authentication modes: https://aerospike.com/docs/server/guide/security/access-control + # Possible values: internal (default), external, pki + #auth_mode: internal + # Optional SSL/TLS (disabled by default) #ssl.enabled: true diff --git a/metricbeat/module/aerospike/_meta/config.yml b/metricbeat/module/aerospike/_meta/config.yml index 42db4e483321..dd333b05139e 100644 --- a/metricbeat/module/aerospike/_meta/config.yml +++ b/metricbeat/module/aerospike/_meta/config.yml @@ -7,6 +7,16 @@ # Aerospike Cluster Name #cluster_name: myclustername + # Username of hosts. Empty by default. + #username: root + + # Password of hosts. Empty by default. + #password: secret + + # Authentication modes: https://aerospike.com/docs/server/guide/security/access-control + # Possible values: internal (default), external, pki + #auth_mode: internal + # Optional SSL/TLS (disabled by default) #ssl.enabled: true diff --git a/metricbeat/module/aerospike/_meta/docs.asciidoc b/metricbeat/module/aerospike/_meta/docs.asciidoc index dd13a19211c1..2e38f8e4e7b2 100644 --- a/metricbeat/module/aerospike/_meta/docs.asciidoc +++ b/metricbeat/module/aerospike/_meta/docs.asciidoc @@ -3,7 +3,7 @@ The Aerospike module uses the http://www.aerospike.com/docs/reference/info[Info [float] === Compatibility -The Aerospike metricsets were tested with Aerospike 3.9 and are expected to work with all versions >= 3.9. +The Aerospike metricsets were tested with Aerospike Enterprise Edition 7.2.0.1 and are expected to work with all versions >= 4.9. [float] diff --git a/metricbeat/module/aerospike/aerospike.go b/metricbeat/module/aerospike/aerospike.go index 745914c055d0..bf051ca9f4e1 100644 --- a/metricbeat/module/aerospike/aerospike.go +++ b/metricbeat/module/aerospike/aerospike.go @@ -24,14 +24,24 @@ import ( "github.com/elastic/elastic-agent-libs/transport/tlscommon" - as "github.com/aerospike/aerospike-client-go" + as "github.com/aerospike/aerospike-client-go/v7" ) type Config struct { ClusterName string `config:"cluster_name"` TLS *tlscommon.Config `config:"ssl"` + User string `config:"username"` + Password string `config:"password"` + AuthMode string `config:"auth_mode"` } +const ( + AUTH_MODE_UNSET string = "" + AUTH_MODE_INTERNAL string = "internal" + AUTH_MODE_PKI string = "pki" + AUTH_MODE_EXTERNAL string = "external" +) + // DefaultConfig return default config for the aerospike module. func DefaultConfig() Config { return Config{} @@ -47,6 +57,28 @@ func ParseClientPolicy(config Config) (*as.ClientPolicy, error) { clientPolicy.TlsConfig = tlsconfig.ToConfig() } + if config.User != "" && config.Password != "" { + clientPolicy.User = config.User + clientPolicy.Password = config.Password + } else if config.User != "" { + return nil, fmt.Errorf("if username is set, password should be set too") + } else if config.Password != "" { + return nil, fmt.Errorf("if password is set, username should be set too") + } + + switch config.AuthMode { + case AUTH_MODE_UNSET: + // Use default behavior of client + case AUTH_MODE_INTERNAL: + clientPolicy.AuthMode = as.AuthModeInternal + case AUTH_MODE_EXTERNAL: + clientPolicy.AuthMode = as.AuthModeExternal + case AUTH_MODE_PKI: + clientPolicy.AuthMode = as.AuthModePKI + default: + return nil, fmt.Errorf("unknown authentication mode '%s'", config.AuthMode) + } + if config.ClusterName != "" { clientPolicy.ClusterName = config.ClusterName } diff --git a/metricbeat/module/aerospike/aerospike_test.go b/metricbeat/module/aerospike/aerospike_test.go index 9dbcbeec4a5d..23be6536564c 100644 --- a/metricbeat/module/aerospike/aerospike_test.go +++ b/metricbeat/module/aerospike/aerospike_test.go @@ -19,13 +19,14 @@ package aerospike import ( "errors" + "fmt" "testing" "github.com/stretchr/testify/assert" "github.com/elastic/elastic-agent-libs/transport/tlscommon" - as "github.com/aerospike/aerospike-client-go" + as "github.com/aerospike/aerospike-client-go/v7" ) func TestParseHost(t *testing.T) { @@ -105,6 +106,8 @@ func pointer[T any](d T) *T { func TestParseClientPolicy(t *testing.T) { sampleClusterName := "TestCluster" + sampleUser := "TestUser" + samplePassword := "MySecretPassword" TLSPolicy := as.NewClientPolicy() tlsconfig, _ := tlscommon.LoadTLSConfig(&tlscommon.Config{Enabled: pointer(true)}) @@ -113,6 +116,24 @@ func TestParseClientPolicy(t *testing.T) { ClusterNamePolicy := as.NewClientPolicy() ClusterNamePolicy.ClusterName = sampleClusterName + UserPasswordClientPolicy := as.NewClientPolicy() + UserPasswordClientPolicy.User = sampleUser + UserPasswordClientPolicy.Password = samplePassword + + UserPasswordTLSPolicy := as.NewClientPolicy() + UserPasswordTLSPolicy.User = sampleUser + UserPasswordTLSPolicy.Password = samplePassword + UserPasswordTLSPolicy.TlsConfig = tlsconfig.ToConfig() + + ExternalAuthModePolicy := as.NewClientPolicy() + ExternalAuthModePolicy.AuthMode = as.AuthModeExternal + + PKIAuthModePolicy := as.NewClientPolicy() + PKIAuthModePolicy.AuthMode = as.AuthModePKI + + InternalAuthModePolicy := as.NewClientPolicy() + InternalAuthModePolicy.AuthMode = as.AuthModeInternal + tests := []struct { Name string Config Config @@ -143,6 +164,66 @@ func TestParseClientPolicy(t *testing.T) { expectedClientPolicy: ClusterNamePolicy, expectedErr: nil, }, + { + Name: "Username and password are honored", + Config: Config{ + User: sampleUser, + Password: samplePassword, + }, + expectedClientPolicy: UserPasswordClientPolicy, + expectedErr: nil, + }, + { + Name: "Username is set and password is not set", + Config: Config{ + User: sampleUser, + }, + expectedClientPolicy: as.NewClientPolicy(), + expectedErr: fmt.Errorf("if username is set, password should be set too"), + }, + { + Name: "Password is set and user is not set", + Config: Config{ + Password: samplePassword, + }, + expectedClientPolicy: as.NewClientPolicy(), + expectedErr: fmt.Errorf("if password is set, username should be set too"), + }, + { + Name: "TLS and Basic Auth", + Config: Config{ + TLS: &tlscommon.Config{ + Enabled: pointer(true), + }, + User: sampleUser, + Password: samplePassword, + }, + expectedClientPolicy: UserPasswordTLSPolicy, + expectedErr: nil, + }, + { + Name: "Unsupported Authentication Mode", + Config: Config{ + AuthMode: "doesnotexist", + }, + expectedErr: fmt.Errorf("unknown authentication mode 'doesnotexist'"), + }, + { + Name: "External Authentication Mode", + Config: Config{ + AuthMode: AUTH_MODE_EXTERNAL, + }, + expectedClientPolicy: ExternalAuthModePolicy, + expectedErr: fmt.Errorf("unknown authentication mode 'doesnotexist'"), + }, + { + Name: "Internal Authentication Mode", + Config: Config{ + AuthMode: AUTH_MODE_INTERNAL, + }, + expectedClientPolicy: InternalAuthModePolicy, + expectedErr: fmt.Errorf("unknown authentication mode 'doesnotexist'"), + }, } for _, test := range tests { @@ -158,6 +239,16 @@ func TestParseClientPolicy(t *testing.T) { } assert.Equalf(t, test.expectedClientPolicy.ClusterName, result.ClusterName, "Aerospike policy cluster name is wrong. Got '%s' expected '%s'", result.ClusterName, test.expectedClientPolicy.ClusterName) + + assert.Equalf(t, test.expectedClientPolicy.User, result.User, + "Aerospike policy username is wrong. Got '%s' expected '%s'", result.User, test.expectedClientPolicy.User) + + assert.Equalf(t, test.expectedClientPolicy.Password, result.Password, + "Aerospike policy password is wrong. Got '%s' expected '%s'", result.Password, test.expectedClientPolicy.Password) + + assert.Equalf(t, test.expectedClientPolicy.AuthMode, result.AuthMode, + "Aerospike policy authentication mode is wrong. Got '%s' expected '%s'", result.AuthMode, test.expectedClientPolicy.AuthMode) + if test.Config.TLS.IsEnabled() { assert.NotNil(t, result.TlsConfig, "Aerospike policy: TLS is not set even though TLS is specified in the configuration") } diff --git a/metricbeat/module/aerospike/docker-compose.yml b/metricbeat/module/aerospike/docker-compose.yml index 0de97dc783d9..8976360c8670 100644 --- a/metricbeat/module/aerospike/docker-compose.yml +++ b/metricbeat/module/aerospike/docker-compose.yml @@ -2,10 +2,10 @@ version: '2.3' services: aerospike: - image: docker.elastic.co/integrations-ci/beats-aerospike:${AEROSPIKE_VERSION:-3.9.0}-1 + image: docker.elastic.co/integrations-ci/beats-aerospike:${AEROSPIKE_VERSION:-7.2.0.1}-1 build: context: ./_meta args: - AEROSPIKE_VERSION: ${AEROSPIKE_VERSION:-3.9.0} + AEROSPIKE_VERSION: ${AEROSPIKE_VERSION:-7.2.0.1} ports: - 3000 diff --git a/metricbeat/module/aerospike/namespace/namespace.go b/metricbeat/module/aerospike/namespace/namespace.go index 265db9f933bc..3385c9f59f22 100644 --- a/metricbeat/module/aerospike/namespace/namespace.go +++ b/metricbeat/module/aerospike/namespace/namespace.go @@ -21,7 +21,7 @@ import ( "fmt" "strings" - as "github.com/aerospike/aerospike-client-go" + as "github.com/aerospike/aerospike-client-go/v7" "github.com/elastic/beats/v7/metricbeat/mb" "github.com/elastic/beats/v7/metricbeat/module/aerospike" @@ -45,6 +45,7 @@ type MetricSet struct { host *as.Host clientPolicy *as.ClientPolicy client *as.Client + infoPolicy *as.InfoPolicy } // New create a new instance of the MetricSet @@ -70,6 +71,7 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) { BaseMetricSet: base, host: host, clientPolicy: clientPolicy, + infoPolicy: as.NewInfoPolicy(), }, nil } @@ -82,14 +84,14 @@ func (m *MetricSet) Fetch(reporter mb.ReporterV2) error { } for _, node := range m.client.GetNodes() { - info, err := as.RequestNodeInfo(node, "namespaces") + info, err := node.RequestInfo(m.infoPolicy, "namespaces") if err != nil { m.Logger().Error("Failed to retrieve namespaces from node %s", node.GetName()) continue } for _, namespace := range strings.Split(info["namespaces"], ";") { - info, err := as.RequestNodeInfo(node, "namespace/"+namespace) + info, err := node.RequestInfo(m.infoPolicy, "namespace/"+namespace) if err != nil { m.Logger().Error("Failed to retrieve metrics for namespace %s from node %s", namespace, node.GetName()) continue diff --git a/metricbeat/modules.d/aerospike.yml.disabled b/metricbeat/modules.d/aerospike.yml.disabled index 35aad6b8e406..56f7c1cdd5f9 100644 --- a/metricbeat/modules.d/aerospike.yml.disabled +++ b/metricbeat/modules.d/aerospike.yml.disabled @@ -10,6 +10,16 @@ # Aerospike Cluster Name #cluster_name: myclustername + # Username of hosts. Empty by default. + #username: root + + # Password of hosts. Empty by default. + #password: secret + + # Authentication modes: https://aerospike.com/docs/server/guide/security/access-control + # Possible values: internal (default), external, pki + #auth_mode: internal + # Optional SSL/TLS (disabled by default) #ssl.enabled: true diff --git a/x-pack/metricbeat/metricbeat.reference.yml b/x-pack/metricbeat/metricbeat.reference.yml index 240acb2cfd6a..7a32f16c19c8 100644 --- a/x-pack/metricbeat/metricbeat.reference.yml +++ b/x-pack/metricbeat/metricbeat.reference.yml @@ -161,6 +161,16 @@ metricbeat.modules: # Aerospike Cluster Name #cluster_name: myclustername + # Username of hosts. Empty by default. + #username: root + + # Password of hosts. Empty by default. + #password: secret + + # Authentication modes: https://aerospike.com/docs/server/guide/security/access-control + # Possible values: internal (default), external, pki + #auth_mode: internal + # Optional SSL/TLS (disabled by default) #ssl.enabled: true