beats icon indicating copy to clipboard operation
beats copied to clipboard

[Metricbeat][Aerospike] Add support for basic auth

Open herrBez opened this issue 4 months ago • 3 comments

Proposed commit message

[Metricbeat][Aerospike] Add support for Basic Auth and update aerospike-client-go dependency

Checklist

  • [X] My code follows the style guidelines of this project
  • [X] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [X] I have made corresponding change to the default configuration files
  • [X] I have added tests that prove my fix is effective or that my feature works
  • [X] I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Disruptive User Impact

No user impact the old configuration still works

Author's Checklist

Context

As of October 14, 2024, only Aerospike DB version 6.1 and above is supported by the vendor. More details can be found here: Aerospike Platform Support.

The supported versions of the Aerospike client libraries are listed here: Aerospike Client Library Matrix.

Currently, Beats integrates version 1.27.1 of the aerospike-client-go library, which was released in 2017 and is no longer supported by the vendor.

In this pull request (PR), we upgrade the dependency to version 7 and add support for Basic Authentication for Enterprise Edition (EE) of Aerospike,

Please note that Aerospike version 7 introduced several changes to the metrics (some metrics that the metricset is using have been renamed, and others removed). Details can be found here: Aerospike 7.0 Metrics Changes. To keep the scope of this PR focused, I have opted to implement this change first and will submit a separate PR to address the metrics changes (I have already implemented the code for the change).

Final note, we distinguish between CE (community edition) and EE (enterprise edition) also in the docker images.

How to test this PR locally

  1. Enable the Aerospike Module and add the username: admin and password: admin:
# Module: aerospike
# Docs: https://www.elastic.co/guide/en/beats/metricbeat/main/metricbeat-module-aerospike.html

- module: aerospike
  #metricsets:
  #  - namespace
  period: 10s
  hosts: ["localhost:3000"]

  # Username of hosts. Empty by default.
  username: admin

  # Password of hosts. Empty by default.
  password: admin
  1. Create a file with the following configuration name aerospike-basic-auth.conf:
Aerospike 7 config-file
service {
	feature-key-file /etc/aerospike/features.conf
}
logging {
	# Send log messages to stdout
	console {
		context any info
	}
}
network {
	service {
		address any
		port 3000
	}
	heartbeat {
		mode mesh
		address local
		port 3002
		interval 150
		timeout 10
	}
	fabric {
		address local
		port 3001
	}
}

namespace test {
	default-ttl 30d # use 0 to never expire/evict.
	memory-size 1G
	nsup-period 120
	replication-factor 1
	storage-engine device {
		data-in-memory false # if true, in-memory, persisted to the filesystem
		file /opt/aerospike/data/test.dat
		filesize 4G
		read-page-cache true
	}
}

# This activates security
# Default credentials: `admin:admin`
security {
}
Aerospike 6 config-file
service {
	cluster-name aerospike
	feature-key-file /etc/aerospike/features.conf
}
logging {
	# Send log messages to stdout
	console {
		context any info
	}
}
network {
	service {
		address any
		port 3000
	}
	heartbeat {
		mode mesh
		address local
		port 3002
		interval 150
		timeout 10
	}
	fabric {
		address local
		port 3001
	}
}

namespace test {
	default-ttl 30d # use 0 to never expire/evict.
	memory-size 1G
	nsup-period 120
	replication-factor 1
	storage-engine device {
		data-in-memory false # if true, in-memory, persisted to the filesystem
		file /opt/aerospike/data/test.dat
		filesize 4G
		read-page-cache true
	}
}

security {
}
  1. Export the following variable export AEROSPIKE_VERSION=ee-6.4.0.7_2 to test with version 6 of Aerospike

  2. Use the following docker-compose.yaml

services:
  aerospike:
    # image: docker.elastic.co/integrations-ci/beats-aerospike:${AEROSPIKE_VERSION:-ee-7.2.0.1_1}
    image: aerospike:${AEROSPIKE_VERSION:-ee-7.2.0.1_1}
    build:
      args:
        AEROSPIKE_VERSION: ${AEROSPIKE_VERSION:-ee-7.2.0.1_1}
    volumes:
      - ./aerospike-basic-auth.conf:/opt/aerospike/etc/aerospike.conf:ro
    command:
    - "--config-file"
    - "/opt/aerospike/etc/aerospike.conf"
    ports:
      - 3000:3000

  1. ./metricbeat test modules aerospike

Please note that since some metrics have been renamed with Aerospike 7, the answer with this version will contain some empty metrics.

Related issues

  • https://github.com/elastic/beats/pull/38126

Use cases

Monitor an Aerospike Cluster protected by Basic Auth

Screenshots

N/A

Logs

Not relevant

herrBez avatar Oct 14 '24 19:10 herrBez