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

[Metricbeat][Aerospike] Add support for basic auth #41233

Merged
merged 33 commits into from
Nov 12, 2024

Conversation

herrBez
Copy link
Contributor

@herrBez herrBez commented Oct 14, 2024

Proposed commit message

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

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • 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

Use cases

Monitor an Aerospike Cluster protected by Basic Auth

Screenshots

N/A

Logs

Not relevant

@herrBez herrBez added enhancement backport-8.x Automated backport to the 8.x branch with mergify labels Oct 14, 2024
@herrBez herrBez requested review from a team as code owners October 14, 2024 19:58
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Oct 14, 2024
@pierrehilbert pierrehilbert added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Oct 15, 2024
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Oct 15, 2024
@pierrehilbert pierrehilbert added needs_team Indicates that the issue/PR needs a Team:* label Team:Obs-InfraObs Label for the Observability Infrastructure Monitoring team labels Oct 15, 2024
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Oct 15, 2024
Copy link
Contributor

mergify bot commented Oct 18, 2024

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b aerospike-basic-auth upstream/aerospike-basic-auth
git merge upstream/main
git push upstream aerospike-basic-auth

@herrBez herrBez requested a review from AndersonQ November 6, 2024 08:03
@AndersonQ
Copy link
Member

Should I adjust the release note as well / the documentation to reflect this fact?

Yes, please, better safe than sorry

Should I remove the backport to version 8.16.x? (I am only afraid the change will come "too late" to be of any use for my users).

I don't think so

@herrBez
Copy link
Contributor Author

herrBez commented Nov 7, 2024

Hi there,

I adjusted the documentation and the release notes. Let me know if I can merge after a successful build.

Thanks,
Mirko

@herrBez herrBez enabled auto-merge (squash) November 10, 2024 17:33
@herrBez
Copy link
Contributor Author

herrBez commented Nov 11, 2024

Hi team,

I'm really sorry—I hadn’t activated auto-merging 🤦. It’s on now. Could someone please approve the PR (for the last time, I hope 😇)?

Thanks so much!

Best regards,
Mirko

Copy link
Contributor

mergify bot commented Nov 12, 2024

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b aerospike-basic-auth upstream/aerospike-basic-auth
git merge upstream/main
git push upstream aerospike-basic-auth

Copy link
Collaborator

@pierrehilbert pierrehilbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering my team's approval, I'm approving for the Beats Leads side.

@herrBez
Copy link
Contributor Author

herrBez commented Nov 12, 2024

I am afraid we need the approval of a member of the elastic/obs-infraobs-integrations team. @ishleenk17 do you mind approving the PR?

Regards,
Mirko

@herrBez herrBez merged commit 71392cf into elastic:main Nov 12, 2024
142 checks passed
@ishleenk17
Copy link
Contributor

I am afraid we need the approval of a member of the elastic/obs-infraobs-integrations team. @ishleenk17 do you mind approving the PR?

Regards, Mirko

Its done!

mergify bot pushed a commit that referenced this pull request Nov 12, 2024
… 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 <me@andersonq.me>

* 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 <me@andersonq.me>
(cherry picked from commit 71392cf)

# Conflicts:
#	go.sum
mergify bot pushed a commit that referenced this pull request Nov 12, 2024
… 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 <me@andersonq.me>

* 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 <me@andersonq.me>
(cherry picked from commit 71392cf)
@herrBez herrBez deleted the aerospike-basic-auth branch November 12, 2024 13:24
herrBez added a commit that referenced this pull request Nov 18, 2024
… add support for basic auth (#41233) (#41609)

* 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 <me@andersonq.me>

* 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 <me@andersonq.me>
(cherry picked from commit 71392cf)

Co-authored-by: Mirko Bez <herrBez@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.x Automated backport to the 8.x branch with mergify backport-8.16 Automated backport with mergify enhancement Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team Team:Obs-InfraObs Label for the Observability Infrastructure Monitoring team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants