diff --git a/roles/_common/tasks/install.yml b/roles/_common/tasks/install.yml index c2c4c19fb..729f0b0a2 100644 --- a/roles/_common/tasks/install.yml +++ b/roles/_common/tasks/install.yml @@ -120,7 +120,7 @@ extra_opts: "{{ _common_binary_unarchive_opts | default(omit, true) }}" check_mode: false throttle: 1 # see prometheus-community/ansible#457 - when: __common_binary_basename is search('\.zip$|\.tar\.gz$') + when: __common_binary_basename is search('\.zip$|\.tar\.gz$|\.tgz$') - name: "Check existence of binary install dir" ansible.builtin.stat: diff --git a/roles/aerospike_exporter/README.md b/roles/aerospike_exporter/README.md new file mode 100644 index 000000000..570389f52 --- /dev/null +++ b/roles/aerospike_exporter/README.md @@ -0,0 +1,52 @@ +

graph logo

+ +# Ansible Role: aerospike exporter + + +Deploy prometheus [aerospike exporter](https://github.com/prometheus/aerospike_exporter) using ansible. + +## Requirements + +- gnu-tar on Mac deployer host (`brew install gnu-tar`) +- Passlib is required when using the basic authentication feature (`python -m pip install passlib bcrypt==4.0.1`) + +## Role Variables +All variables which can be overridden are stored in [defaults/main.yml](defaults/main.yml) file as well as in [meta/argument_specs.yml](meta/argument_specs.yml). +Please refer to the [collection docs](https://prometheus-community.github.io/ansible/branch/main/aerospike_exporter_role.html) for description and default values of the variables. + +## Example + +### Playbook + +Use it in a playbook as follows: +```yaml +- hosts: all + collections: + - prometheus.prometheus + roles: + - prometheus.prometheus.aerospike_exporter +``` + +### Demo site + +We provide an example site that demonstrates a full monitoring solution based on prometheus and grafana. The repository with code and links to running instances is [available on github](https://github.com/prometheus/demo-site) and the site is hosted on [DigitalOcean](https://digitalocean.com). + +## Local Testing + +The preferred way of locally testing the role is to use Docker and [molecule](https://github.com/ansible-community/molecule) (v3.x). You will have to install Docker on your system. See "Get started" for a Docker package suitable for your system. Running your tests is as simple as executing `molecule test`. + +## Continuous Integration + +Combining molecule and circle CI allows us to test how new PRs will behave when used with multiple ansible versions and multiple operating systems. This also allows use to create test scenarios for different role configurations. As a result we have quite a large test matrix which can take more time than local testing, so please be patient. + +## Contributing + +See [contributor guideline](CONTRIBUTING.md). + +## Troubleshooting + +See [troubleshooting](TROUBLESHOOTING.md). + +## License + +This project is licensed under MIT License. See [LICENSE](/LICENSE) for more details. diff --git a/roles/aerospike_exporter/TROUBLESHOOTING.md b/roles/aerospike_exporter/TROUBLESHOOTING.md new file mode 100644 index 000000000..0bece12af --- /dev/null +++ b/roles/aerospike_exporter/TROUBLESHOOTING.md @@ -0,0 +1,20 @@ +# Troubleshooting + +## Bad requests (HTTP 400) + +This role downloads checksums from the Github project to verify the integrity of artifacts installed on your servers. When downloading the checksums, a "bad request" error might occur. + +This happens in environments which (knowningly or unknowling) use the [netrc mechanism](https://www.gnu.org/software/inetutils/manual/html_node/The-_002enetrc-file.html) to auto-login into servers. + +Unless netrc is needed by your playbook and ansible roles, please unset the var like so: + +``` +$ NETRC= ansible-playbook ... +``` + +Or: + +``` +$ export NETRC= +$ ansible-playbook ... +``` diff --git a/roles/aerospike_exporter/defaults/main.yml b/roles/aerospike_exporter/defaults/main.yml new file mode 100644 index 000000000..294e8a6c5 --- /dev/null +++ b/roles/aerospike_exporter/defaults/main.yml @@ -0,0 +1,25 @@ +--- +aerospike_exporter_version: 1.34.0 +aerospike_exporter_binary_url: "https://github.com/{{ _aerospike_exporter_repo }}/releases/download/v{{ aerospike_exporter_version }}/\ + aerospike-prometheus-exporter_{{ aerospike_exporter_version }}_{{ ansible_architecture }}.tgz" +aerospike_exporter_checksums_url: "{{ aerospike_exporter_binary_url }}.sha256" + +aerospike_exporter_web_listen_address: "0.0.0.0:9145" + +aerospike_exporter_username: "" +aerospike_exporter_password: "" + +aerospike_exporter_config_file: "ape.toml" +aerospike_exporter_host: localhost +aerospike_exporter_port: 3000 + +aerospike_exporter_tls_server_config: {} + +# Internal variables. +aerospike_exporter_binary_install_dir: "/usr/local/bin" +aerospike_exporter_config_dir: "/etc/aerospike_exporter" +aerospike_exporter_system_group: "aerospike-exp" +aerospike_exporter_system_user: "{{ aerospike_exporter_system_group }}" + +# Local path to stash the archive and its extraction +aerospike_exporter_local_cache_path: "/tmp/aerospike_exporter-{{ ansible_facts['system'] | lower }}-{{ _aerospike_exporter_go_ansible_arch }}/{{ aerospike_exporter_version }}" diff --git a/roles/aerospike_exporter/handlers/main.yml b/roles/aerospike_exporter/handlers/main.yml new file mode 100644 index 000000000..e990b0930 --- /dev/null +++ b/roles/aerospike_exporter/handlers/main.yml @@ -0,0 +1,10 @@ +--- +- name: Restart aerospike_exporter + listen: "restart aerospike_exporter" + become: true + ansible.builtin.systemd: + daemon_reload: true + name: aerospike_exporter + state: restarted + when: + - not ansible_check_mode diff --git a/roles/aerospike_exporter/meta/argument_specs.yml b/roles/aerospike_exporter/meta/argument_specs.yml new file mode 100644 index 000000000..4bb3ea7a4 --- /dev/null +++ b/roles/aerospike_exporter/meta/argument_specs.yml @@ -0,0 +1,63 @@ +--- +# yamllint disable rule:line-length +argument_specs: + main: + short_description: "Prometheus Aerospike Exporter" + description: + - "Deploy prometheus L(aerospike_exporter,https://github.com/aerospike/aerospike-prometheus-exporter) using ansible" + author: + - "Prometheus Community" + options: + aerospike_exporter_version: + description: "Aerospike exporter package version. Also accepts latest as parameter." + default: "1.34.0" + aerospike_exporter_binary_url: + description: "URL of the aerospike_exporter binaries .tar.gz file" + default: "https://github.com/{{ _aerospike_exporter_repo }}/releases/download/v{{ aerospike_exporter_version }}/aerospike_exporter-{{ aerospike_exporter_version }}.{{ ansible_facts['system'] | lower }}-{{ _aerospike_exporter_go_ansible_arch }}.tar.gz" + aerospike_exporter_checksums_url: + description: "URL of the aerospike_exporter checksums file" + default: "https://github.com/{{ _aerospike_exporter_repo }}/releases/download/v{{ aerospike_exporter_version }}/sha256sums.txt" + aerospike_exporter_web_listen_address: + description: "Address on which aerospike_exporter will listen" + default: "0.0.0.0:9145" + aerospike_exporter_config_dir: + description: "Path to directory with aerospike_exporter configuration" + default: "/etc/aerospike_exporter" + aerospike_exporter_config_file: + description: "The filename of the exporter aerospike config file" + default: "ape.toml" + aerospike_exporter_host: + description: "The target Aerospike host" + default: "localhost" + aerospike_exporter_port: + description: "The target Aerospike port" + default: 3000 + aerospike_exporter_username: + description: "The username for Aerospike login" + default: "" + aerospike_exporter_password: + description: "The password for Aerospike login" + default: "" + aerospike_exporter_tls_server_config: + description: + - "Configuration for TLS authentication." + - "Keys and values are the same as in L(aerospike_exporter docs,https://github.com/aerospike/aerospike-prometheus-exporter/blob/master/https/README.md#sample-config)." + type: "dict" + aerospike_exporter_binary_install_dir: + description: + - "I(Advanced)" + - "Directory to install aerospike_exporter binary" + default: "/usr/local/bin" + aerospike_exporter_system_group: + description: + - "I(Advanced)" + - "System group for Aerospike Exporter" + default: "aerospike-exp" + aerospike_exporter_system_user: + description: + - "I(Advanced)" + - "Aerospike Exporter user" + default: "aerospike-exp" + aerospike_exporter_local_cache_path: + description: "Local path to stash the archive and its extraction" + default: "/tmp/aerospike_exporter-{{ ansible_facts['system'] | lower }}-{{ _aerospike_exporter_go_ansible_arch }}/{{ aerospike_exporter_version }}" diff --git a/roles/aerospike_exporter/meta/main.yml b/roles/aerospike_exporter/meta/main.yml new file mode 100644 index 000000000..86fd5b3a4 --- /dev/null +++ b/roles/aerospike_exporter/meta/main.yml @@ -0,0 +1,26 @@ +--- +galaxy_info: + author: "Prometheus Community" + description: "Prometheus Aerospike Exporter" + license: "Apache" + min_ansible_version: "2.14" + platforms: + - name: "Ubuntu" + versions: + - "jammy" + - "noble" + - name: "Debian" + versions: + - "bullseye" + - "bookworm" + - name: "EL" + versions: + - "9" + - "10" + galaxy_tags: + - "monitoring" + - "prometheus" + - "exporter" + - "metrics" + - "system" + - "aerospike" diff --git a/roles/aerospike_exporter/molecule/alternative/molecule.yml b/roles/aerospike_exporter/molecule/alternative/molecule.yml new file mode 100644 index 000000000..d598e2bf4 --- /dev/null +++ b/roles/aerospike_exporter/molecule/alternative/molecule.yml @@ -0,0 +1,16 @@ +--- +provisioner: + playbooks: + prepare: "${MOLECULE_PROJECT_DIRECTORY}/../../.config/molecule/alternative/prepare.yml" + inventory: + group_vars: + all: + aerospike_exporter_local_cache_path: "/tmp/aerospike_exporter-linux-amd64" + aerospike_exporter_web_listen_address: '127.0.0.1:8080' + aerospike_exporter_tls_server_config: + cert_file: /etc/aerospike_exporter/tls.cert + key_file: /etc/aerospike_exporter/tls.key + aerospike_exporter_version: 1.34.0 + aerospike_exporter_binary_url: "https://github.com/prometheus/aerospike_exporter/releases/download/v{{\ + \ aerospike_exporter_version }}/aerospike_exporter-{{ aerospike_exporter_version\ + \ }}.linux-amd64.tar.gz" diff --git a/roles/aerospike_exporter/molecule/alternative/tests/test_alternative.py b/roles/aerospike_exporter/molecule/alternative/tests/test_alternative.py new file mode 100644 index 000000000..bc288d542 --- /dev/null +++ b/roles/aerospike_exporter/molecule/alternative/tests/test_alternative.py @@ -0,0 +1,27 @@ +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + +from testinfra_helpers import get_target_hosts +import pytest + +testinfra_hosts = get_target_hosts() + + +def test_service(host): + s = host.service("aerospike_exporter") + try: + assert s.is_running + except AssertionError: + # Capture service logs + journal_output = host.run('journalctl -u aerospike_exporter --since "1 hour ago"') + print("\n==== journalctl -u aerospike_exporter Output ====\n") + print(journal_output) + print("\n============================================\n") + raise # Re-raise the original assertion error + + +@pytest.mark.parametrize("sockets", [ + "tcp://127.0.0.1:8080" +]) +def test_socket(host, sockets): + assert host.socket(sockets).is_listening diff --git a/roles/aerospike_exporter/molecule/default/molecule.yml b/roles/aerospike_exporter/molecule/default/molecule.yml new file mode 100644 index 000000000..2bb1a9f01 --- /dev/null +++ b/roles/aerospike_exporter/molecule/default/molecule.yml @@ -0,0 +1,6 @@ +--- +provisioner: + inventory: + group_vars: + all: + aerospike_exporter_web_listen_address: "127.0.0.1:9145" diff --git a/roles/aerospike_exporter/molecule/default/tests/test_default.py b/roles/aerospike_exporter/molecule/default/tests/test_default.py new file mode 100644 index 000000000..d00e75f58 --- /dev/null +++ b/roles/aerospike_exporter/molecule/default/tests/test_default.py @@ -0,0 +1,70 @@ +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + +from testinfra_helpers import get_target_hosts + +testinfra_hosts = get_target_hosts() + + +def test_directories(host): + dirs = [ + "/etc/aerospike_exporter" + ] + for dir in dirs: + d = host.file(dir) + assert d.is_directory + assert d.exists + + +def test_files(host): + files = [ + "/etc/systemd/system/aerospike_exporter.service", + "/usr/local/bin/aerospike_exporter" + ] + for file in files: + f = host.file(file) + assert f.exists + assert f.is_file + + +def test_permissions_didnt_change(host): + dirs = [ + "/etc", + "/root", + "/usr", + "/var" + ] + for file in dirs: + f = host.file(file) + assert f.exists + assert f.is_directory + assert f.user == "root" + assert f.group == "root" + + +def test_user(host): + assert host.group("aerospike-exp").exists + assert "aerospike-exp" in host.user("aerospike-exp").groups + assert host.user("aerospike-exp").shell == "/usr/sbin/nologin" + + +def test_service(host): + s = host.service("aerospike_exporter") + try: + assert s.is_running + except AssertionError: + # Capture service logs + journal_output = host.run('journalctl -u aerospike_exporter --since "1 hour ago"') + print("\n==== journalctl -u aerospike_exporter Output ====\n") + print(journal_output) + print("\n============================================\n") + raise # Re-raise the original assertion error + + +def test_socket(host): + sockets = [ + "tcp://127.0.0.1:9104" + ] + for socket in sockets: + s = host.socket(socket) + assert s.is_listening diff --git a/roles/aerospike_exporter/molecule/latest/molecule.yml b/roles/aerospike_exporter/molecule/latest/molecule.yml new file mode 100644 index 000000000..a0413b721 --- /dev/null +++ b/roles/aerospike_exporter/molecule/latest/molecule.yml @@ -0,0 +1,6 @@ +--- +provisioner: + inventory: + group_vars: + all: + aerospike_exporter_version: latest diff --git a/roles/aerospike_exporter/molecule/latest/tests/test_latest.py b/roles/aerospike_exporter/molecule/latest/tests/test_latest.py new file mode 100644 index 000000000..91791c7b1 --- /dev/null +++ b/roles/aerospike_exporter/molecule/latest/tests/test_latest.py @@ -0,0 +1,35 @@ +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + +from testinfra_helpers import get_target_hosts +import pytest + +testinfra_hosts = get_target_hosts() + + +@pytest.mark.parametrize("files", [ + "/etc/systemd/system/aerospike_exporter.service", + "/usr/local/bin/aerospike_exporter" +]) +def test_files(host, files): + f = host.file(files) + assert f.exists + assert f.is_file + + +def test_service(host): + s = host.service("aerospike_exporter") + try: + assert s.is_running + except AssertionError: + # Capture service logs + journal_output = host.run('journalctl -u aerospike_exporter --since "1 hour ago"') + print("\n==== journalctl -u aerospike_exporter Output ====\n") + print(journal_output) + print("\n============================================\n") + raise # Re-raise the original assertion error + + +def test_socket(host): + s = host.socket("tcp://0.0.0.0:9104") + assert s.is_listening diff --git a/roles/aerospike_exporter/tasks/configure.yml b/roles/aerospike_exporter/tasks/configure.yml new file mode 100644 index 000000000..be4a449d6 --- /dev/null +++ b/roles/aerospike_exporter/tasks/configure.yml @@ -0,0 +1,44 @@ +--- +- name: Configure + ansible.builtin.include_role: + name: prometheus.prometheus._common + tasks_from: configure.yml + vars: + _common_system_user: "{{ aerospike_exporter_system_user }}" + _common_system_group: "{{ aerospike_exporter_system_group }}" + _common_config_dir: "{{ aerospike_exporter_config_dir }}" + _common_tls_server_config: "{{ aerospike_exporter_tls_server_config }}" + tags: + - aerospike_exporter + - configure + - aerospike_exporter_configure + +- name: Copy the aerospike_exporter config file + ansible.builtin.template: + src: ape.toml.j2 + dest: "{{ aerospike_exporter_config_dir }}/{{ aerospike_exporter_config_file }}" + owner: root + group: '{{ aerospike_exporter_system_group }}' + mode: '0640' + no_log: "{{ false if (lookup('env', 'CI')) or (lookup('env', 'MOLECULE_PROVISIONER_NAME')) else true }}" + become: true + notify: restart aerospike_exporter + tags: + - aerospike_exporter + - configure + - aerospike_exporter_configure + +- name: Copy Gauge stats File + ansible.builtin.copy: + src: "{{ aerospike_exporter_local_cache_path }}/gauge_stats_list.toml" + dest: "{{ aerospike_exporter_config_dir }}/gauge_stats_list.toml" + owner: root + group: '{{ aerospike_exporter_system_group }}' + mode: '0640' + no_log: "{{ false if (lookup('env', 'CI')) or (lookup('env', 'MOLECULE_PROVISIONER_NAME')) else true }}" + become: true + notify: restart aerospike_exporter + tags: + - aerospike_exporter + - configure + - aerospike_exporter_configure diff --git a/roles/aerospike_exporter/tasks/main.yml b/roles/aerospike_exporter/tasks/main.yml new file mode 100644 index 000000000..03f4de497 --- /dev/null +++ b/roles/aerospike_exporter/tasks/main.yml @@ -0,0 +1,53 @@ +--- +- name: Preflight + ansible.builtin.include_tasks: + file: preflight.yml + tags: + - aerospike_exporter_install + - aerospike_exporter_configure + - aerospike_exporter_run + +- name: Install + ansible.builtin.include_role: + name: prometheus.prometheus._common + tasks_from: install.yml + vars: + _common_local_cache_path: "{{ aerospike_exporter_local_cache_path }}" + _common_binaries: "{{ _aerospike_exporter_binaries }}" + _common_binary_install_dir: "{{ aerospike_exporter_binary_install_dir }}" + _common_binary_url: "{{ aerospike_exporter_binary_url }}" + _common_checksums_url: "{{ aerospike_exporter_checksums_url }}" + _common_system_group: "{{ aerospike_exporter_system_group }}" + _common_system_user: "{{ aerospike_exporter_system_user }}" + _common_config_dir: "{{ aerospike_exporter_config_dir }}" + _common_binary_unarchive_opts: ["--transform=s|.*/||"] + tags: + - aerospike_exporter_install + +- name: SELinux + ansible.builtin.include_role: + name: prometheus.prometheus._common + tasks_from: selinux.yml + vars: + _common_selinux_port: "{{ ('//' ~ aerospike_exporter_web_listen_address) | ansible.builtin.urlsplit('port') }}" + when: ansible_facts['selinux'].status == "enabled" + tags: + - aerospike_exporter_configure + +- name: Configure + ansible.builtin.include_tasks: + file: configure.yml + tags: + - aerospike_exporter_configure + +- name: Ensure Aerospike Exporter is enabled on boot + become: true + ansible.builtin.systemd: + daemon_reload: true + name: aerospike_exporter + enabled: true + state: started + when: + - not ansible_check_mode + tags: + - aerospike_exporter_run diff --git a/roles/aerospike_exporter/tasks/preflight.yml b/roles/aerospike_exporter/tasks/preflight.yml new file mode 100644 index 000000000..22b6b837a --- /dev/null +++ b/roles/aerospike_exporter/tasks/preflight.yml @@ -0,0 +1,60 @@ +--- +- name: Common preflight + ansible.builtin.include_role: + name: prometheus.prometheus._common + tasks_from: preflight.yml + vars: + _common_web_listen_address: "{{ aerospike_exporter_web_listen_address }}" + +- name: Assert that used version supports listen address type + ansible.builtin.assert: + that: + - >- + aerospike_exporter_web_listen_address is string + or + ( + aerospike_exporter_version is version('0.15.0', '>=') and + aerospike_exporter_web_listen_address | type_debug == "list" + ) + +- name: Assert that TLS config is correct + when: aerospike_exporter_tls_server_config | length > 0 + block: + - name: Assert that TLS key and cert path are set + ansible.builtin.assert: + that: + - "aerospike_exporter_tls_server_config.cert_file is defined" + - "aerospike_exporter_tls_server_config.key_file is defined" + + - name: Check existence of TLS cert file + ansible.builtin.stat: + path: "{{ aerospike_exporter_tls_server_config.cert_file }}" + register: __aerospike_exporter_cert_file + + - name: Check existence of TLS key file + ansible.builtin.stat: + path: "{{ aerospike_exporter_tls_server_config.key_file }}" + register: __aerospike_exporter_key_file + + - name: Assert that TLS key and cert are present + ansible.builtin.assert: + that: + - "__aerospike_exporter_cert_file.stat.exists" + - "__aerospike_exporter_key_file.stat.exists" + +- name: Discover latest version + ansible.builtin.set_fact: + aerospike_exporter_version: "{{ (lookup('url', 'https://api.github.com/repos/{{ _aerospike_exporter_repo }}/releases/latest', headers=_github_api_headers, + split_lines=False) | from_json).get('tag_name') | replace('v', '') }}" + run_once: true + until: aerospike_exporter_version is version('0.0.0', '>=') + retries: 10 + delay: 10 + when: + - aerospike_exporter_version == "latest" + tags: + - aerospike_exporter + - install + - aerospike_exporter_install + - download + - aerospike_exporter_download diff --git a/roles/aerospike_exporter/templates/aerospike_exporter.service.j2 b/roles/aerospike_exporter/templates/aerospike_exporter.service.j2 new file mode 100644 index 000000000..ba7c7b5d9 --- /dev/null +++ b/roles/aerospike_exporter/templates/aerospike_exporter.service.j2 @@ -0,0 +1,18 @@ +{{ ansible_managed | comment }} + +[Unit] +Description=Aerospike Prometheus Exporter +Documentation=https://github.com/aerospike/aerospike-prometheus-exporter +Wants=network.target +After=network-online.target + +[Service] +Type=simple +User={{ aerospike_exporter_system_user }} +Group={{ aerospike_exporter_system_group }} +ExecStart={{ aerospike_exporter_binary_install_dir }}/aerospike-prometheus-exporter \ + -config {{ aerospike_exporter_config_dir }}/ape.toml \ + -gauge-list {{ aerospike_exporter_config_dir }}/gauge_stats_list.toml + +[Install] +WantedBy=multi-user.target diff --git a/roles/aerospike_exporter/templates/ape.toml.j2 b/roles/aerospike_exporter/templates/ape.toml.j2 new file mode 100644 index 000000000..2ea0bf2b9 --- /dev/null +++ b/roles/aerospike_exporter/templates/ape.toml.j2 @@ -0,0 +1,219 @@ +{{ ansible_managed | comment }} +[Agent] + # Metrics Serving modes + enable_prometheus = true + enable_open_telemetry = false + + # labels to add to the prometheus metrics for e.g. labels={zone="asia-south1-a", platform="google compute engine"} + # labels = {latitude="0",longitude="0"} + + # mention cloud provider (supported: aws, gcp, azure ) so exporter collects few details like region, zone etc., + cloud_provider = "" + + # metrics server timeout in seconds + timeout = 10 + + # support system statistics also + refresh_system_stats = false + + # Exporter logging configuration + # Log file path (optional, logs to console by default) + # Level can be info|warning,warn|error,err|debug|trace ('info' by default) + log_file = "" + log_level = "" + + # Exporter HTTPS (TLS) configuration + # HTTPS between Prometheus and Exporter + + # TLS certificates. + # Supports below formats, + # 1. Certificate file path - "file:" + # 2. Environment variable containing base64 encoded certificate - "env-b64:" + # 3. Base64 encoded certificate - "b64:" + # Applicable to 'root_ca', 'cert_file' and 'key_file' configurations. + + # Server certificate + cert_file = "{{ aerospike_exporter_tls_server_config.cert_file | default('') }}" + + # Private key associated with server certificate + key_file = "{{ aerospike_exporter_tls_server_config.key_file | default('') }}" + + # Root CA to validate client certificates (for mutual TLS) + root_ca = "{{ aerospike_exporter_tls_server_config.root_ca | default('') }}" + + # a comma separated TLS Cipher suites to use, example: TLS_AES_128_GCM_SHA256,TLS_AES_256_GCM_SHA384 + # Golang - refer documentation https://pkg.go.dev/crypto/tls#pkg-constants of golang CipherSuites for TLS >=1.2 (both supported and Insecure) + # NOTE: Cipher configuration is support only till TLS1.2 verison and not possible in TLS1.3 + tls_cipher_suites = "" + + # Passphrase for encrypted key_file. Supports below formats, + # 1. Passphrase directly - "" + # 2. Passphrase via file - "file:" + # 3. Passphrase via environment variable - "env:" + # 4. Passphrase via environment variable containing base64 encoded passphrase - "env-b64:" + # 5. Passphrase in base64 encoded form - "b64:" + key_file_passphrase = "{{ aerospike_exporter_tls_server_config.key_file_passphrase | default('') }}" + + # prometheus binding port + bind = "{{ aerospike_exporter_web_listen_address }}" + + # Basic HTTP authentication for '/metrics'. + # Supports below formats, + # 1. Credential directly - "" + # 2. Credential via file - "file:" + # 3. Credential via environment variable - "env:" + # 4. Credential via environment variable containing base64 encoded credential - "env-b64:" + # 5. Credential in base64 encoded form - "b64:" + basic_auth_username = "" + basic_auth_password = "" + +[Agent.OpenTelemetry] + # OTel service-name + service_name = "aerospike-server-metrics-service" + + # OTel Endpoint + # DEPRECATED. Use grpc_endpoint + endpoint = "" + + # OTel Endpoint + # NOTE: Only url, does not include protocol http/https + # NOTE: configure either grpc_endpoint or endpoint (DEPRECATED), both cannot be configured + grpc_endpoint = "" + + # OTel Endpoint URL Path + # provide entire url, including http/https protocol + http_endpoint = "" + + # OTel headers, + # NOTE: Each header will be a ""="" pair and each header is comma separated + # Example: "api-key"="","Authorization"="Api-Token " + headers = {} + + # OTel server-stat fetch interval (default 15, not recommended to to reduce this) + server_stat_fetch_interval = 15 + + # OTel metric push interval (default 15, not recommended to to reduce this) + push_interval = 15 + + # Defines the temporality to be applied depending on end point treats + # supported values: delta (default), cumulative + # Why Delta is default, many customer use Datadog and Dynatrace. + # NOTE: Datadog and Dynatrace only support Delta's for monotonic-cumulative counters + # Newrelic accepts Delta and monotonic-sum + counter_temporality = "delta" + + # Defines if all metrics to be treated as Gauges + all_metrics_as_gauges = true + + # metric name prefix, defines the prefix before each metric before dispatching to endpoint + metric_name_prefix = "aerospike.server" + + # metric context seperator, suggests what seperator to use while constructing a metric from stat + # supported values "period" (default) or "underscore" + metric_context_separator = "period" + + # renamed variables + renamed_labels = {cluster_name="aerospike_cluster",service="aerospike_service"} + +[Aerospike] + db_host = "{{ aerospike_exporter_host }}" + db_port = {{ aerospike_exporter_port }} + + # TLS certificates. + # Supports below formats, + # 1. Certificate file path - "file:" + # 2. Environment variable containing base64 encoded certificate - "env-b64:" + # 3. Base64 encoded certificate - "b64:" + # Applicable to 'root_ca', 'cert_file' and 'key_file' configurations. + + # root certificate file + root_ca = "" + + # certificate file + cert_file = "" + + # key file + key_file = "" + + # Passphrase for encrypted key_file. Supports below formats, + # 1. Passphrase directly - "" + # 2. Passphrase via file - "file:" + # 3. Passphrase via environment variable - "env:" + # 4. Passphrase via environment variable containing base64 encoded passphrase - "env-b64:" + # 5. Passphrase in base64 encoded form - "b64:" + key_file_passphrase = "" + + # node TLS name for authentication + node_tls_name = "" + + # Aerospike cluster security credentials. + # Supports below formats, + # 1. Credential directly - "" + # 2. Credential via file - "file:" + # 3. Credential via environment variable - "env:" + # 4. Credential via environment variable containing base64 encoded credential - "env-b64:" + # 5. Credential in base64 encoded form - "b64:" + # Applicable to 'user' and 'password' configurations. + + # database user + user = "{{ aerospike_exporter_username }}" + + # database password + password = "{{ aerospike_exporter_password}}" + + # authentication mode: internal (server authentication) [default], external (e.g., LDAP), pki. + auth_mode = "" + + # timeout for sending commands to the server node in seconds + timeout = 5 + + # Number of histogram buckets to export for latency metrics. Bucket thresholds range from 2^0 to 2^16 (17 buckets). + # e.g. latency_buckets_count=5 will export first five buckets i.e. <=1ms, <=2ms, <=4ms, <=8ms and <=16ms. + # Default: 0 (export all threshold buckets). + latency_buckets_count = 0 + + # Order of context - namespace, set, latencies, node-stats, xdr, user, jobs, sindex + + # Metrics Allowlist - If specified, only these metrics will be scraped. An empty list will exclude all metrics. + # Commenting out the below allowlist configs will disable metrics filtering (i.e. all metrics will be scraped). + + # Metrics Blocklist - If specified, these metrics will be NOT be scraped. An empty list will include all metrics. + # Commenting out the below blocklist configs will disable metrics filtering (i.e. no metrics will be blocked/filtered). + + # globbing pattern (wildcard) are allowed for allowlist and blocklist + # for example "batch_index_*_buffers" + # to block all namespace metrics "*" + + # Namespace metrics allowlist, to control which Namespace metrics should be collected. + # to exclude or stop all namespace metrics, use ["*"] in blocklist + # namespace_metrics_allowlist = [] + # namespace_metrics_blocklist = [] + + # Set metrics allowlist, empty list includes or allows all metrics to scrape + # to exclude or stop all set metrics, use ["*"] in blocklist + # set_metrics_allowlist = [] + # set_metrics_blocklist = [] + + # Latencies histogram allowlist, to control which Histogram-name metrics should be collected. + # Note: globbing patterns (wildcard) are not supported for this latency metric configuration. + # to exclude or stop all latencies metrics, use ["*"] in blocklist + # latencies_metrics_allowlist = [] + # latencies_metrics_blocklist = [] + + # node_metrics_allowlist = [] + # node_metrics_blocklist = [] + + # Support only from Aerospike versions 5.0 and above + # to exclude or stop all xdr metrics, use ["*"] in blocklist + # xdr_metrics_allowlist = [] + # xdr_metrics_blocklist = [] + + # User statistics are available in Aerospike 5.6+ + # Note globbing patterns (wildcard) are not supported for this User configuration. + # to exclude or stop all set metrics, use ["*"] in blocklist + # user_metrics_users_allowlist = [] + # user_metrics_users_blocklist = [] + + # to exclude or stop all sindex metrics, use ["*"] in blocklist + # sindex_metrics_allowlist = [] + # sindex_metrics_blocklist = [] diff --git a/roles/aerospike_exporter/vars/main.yml b/roles/aerospike_exporter/vars/main.yml new file mode 100644 index 000000000..7d2eb048b --- /dev/null +++ b/roles/aerospike_exporter/vars/main.yml @@ -0,0 +1,9 @@ +--- +_aerospike_exporter_go_ansible_arch: "{{ {'i386': '386', + 'x86_64': 'amd64', + 'aarch64': 'arm64', + 'armv7l': 'armv7', + 'armv6l': 'armv6'}.get(ansible_facts['architecture'], ansible_facts['architecture']) }}" +_aerospike_exporter_repo: "aerospike/aerospike-prometheus-exporter" +_github_api_headers: "{{ {'GITHUB_TOKEN': lookup('ansible.builtin.env', 'GITHUB_TOKEN')} if (lookup('ansible.builtin.env', 'GITHUB_TOKEN')) else {} }}" +_aerospike_exporter_binaries: ['aerospike-prometheus-exporter']