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

Deploy RADOS gateway usage exporter from SKC #1081

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions etc/kayobe/ansible/deploy-radosgw-usage-exporter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
- name: Deploy RADOS gateway usage exporter
hosts: monitoring
gather_facts: false
vars:
venv: "{{ virtualenv_path }}/openstack"
tasks:
- name: Check ec2 credential for admin
command: >
{{ venv }}/bin/openstack
ec2 credentials list --user admin
--format json
environment: "{{ openstack_auth_env }}"
delegate_to: localhost
register: credential_check
run_once: true
when: stackhpc_enable_radosgw_usage_exporter

- name: Create ec2 credential if there's none
command: >
{{ venv }}/bin/openstack
ec2 credentials create --user admin
--format json
environment: "{{ openstack_auth_env }}"
delegate_to: localhost
run_once: true
when:
- "{{ credential_check.stdout == [] }}"
- stackhpc_enable_radosgw_usage_exporter

- name: Query ec2 credential for admin
command: >
{{ venv }}/bin/openstack
ec2 credentials list --user admin
--format json
environment: "{{ openstack_auth_env }}"
delegate_to: localhost
register: credential
run_once: true
when: stackhpc_enable_radosgw_usage_exporter

- name: Get object storage endpoint
command: >
{{ venv }}/bin/openstack
endpoint list --service object-store --interface internal
--format json
environment: "{{ openstack_auth_env }}"
delegate_to: localhost
register: endpoint
run_once: true
when: stackhpc_enable_radosgw_usage_exporter

- name: Ensure radosgw_usage_exporter container is running
community.docker.docker_container:
name: radosgw_usage_exporter
image: ghcr.io/stackhpc/radosgw_usage_exporter:0.1.0
network_mode: host
env:
RADOSGW_SERVER: "{{ radosgw_server }}"
ADMIN_ENTRY: admin
ACCESS_KEY: "{{ ec2.Access }}"
SECRET_KEY: "{{ ec2.Secret }}"
vars:
ec2: "{{ credential.stdout | from_json | first }}"
host: "{{ endpoint.stdout | from_json | first }}"
radosgw_server: "{{ host.URL | regex_replace('(https?://)([^:/]+):([0-9]+)/.*', '\\1\\2:\\3') }}" # Drop Swift api address
become: true
when: stackhpc_enable_radosgw_usage_exporter
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# yamllint disable-file
---
{% if stackhpc_enable_radosgw_usage_exporter | bool %}
{% raw %}
scrape_configs:
- job_name: ceph_radosgw_usage_exporter
honor_labels: true
scrape_interval: 15s
metric_relabel_configs:
- replacement: ${1}
source_labels: [owner,user]
target_label: tenant_id
separator: ""
regex: (.+)
static_configs:
- targets:
{% for host in groups['monitoring'] %}
- "{{ 'api' | kolla_address(host) | put_address_in_context('url') }}:{% endraw %}{{ stackhpc_radosgw_usage_exporter_port }}{% raw %}"
{% endfor %}
{% endraw %}
{% endif %}
6 changes: 6 additions & 0 deletions etc/kayobe/stackhpc-monitoring.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ alertmanager_warn_network_bond_single_link: true
# targets being templated during deployment.
stackhpc_enable_os_capacity: true

# Whether the RADOS gateway usage exporter is enabled.
# Enabling this will result in templating radosge_usage_exporter endpoint as
# Prometheus scrape targets during deployment.
stackhpc_enable_radosgw_usage_exporter: false
stackhpc_radosgw_usage_exporter_port: 9242

# Whether TLS certificate verification is enabled for the OpenStack Capacity
# exporter during Keystone authentication.
stackhpc_os_capacity_openstack_verify: true
Loading