Skip to content

Commit

Permalink
[test_sensubility] Check whether sensubility metrics are available
Browse files Browse the repository at this point in the history
  • Loading branch information
elfiesmelfie committed Jan 30, 2025
1 parent 565eef9 commit 214c79c
Showing 1 changed file with 49 additions and 44 deletions.
93 changes: 49 additions & 44 deletions roles/test_sensubility/tasks/test_health_status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
changed_when: false
failed_when: container_nodes.stdout_lines|length != 0

- name: Check what metrics are available to prometheus that relate to sensubility
ansible.builtin.shell:
cmd: |
curl -k {{ prom_auth_string }} -g https://${prom_url}/api/v1/label/__name__/values | jq | grep sensubility
changed_when: false

# issue might be that the value is aggregated over 10m, and we only check for 2
- name: RHELOSP-176036 Check that health status of container changed to 0
Expand All @@ -43,50 +48,50 @@
delay: 10
until: "output.stdout_lines | length == 1"

- name: NEW RHELOSP-176036 but check over a smaller time
ansible.builtin.shell:
cmd: /usr/bin/curl -k {{ prom_auth_string }} -g https://{{ prom_url }}/api/v1/query? --data-urlencode 'query=last_over_time(sensubility_container_health_status{process="logrotate_crond",host="ceph-0.redhat.local"}[2m])' | grep -oP '(?<="value":).*' | awk -F, '{ print $2 }' | grep -o '[0-9]\+' | grep 0
register: output
changed_when: false
retries: 12
delay: 10
until: "output.stdout_lines | length == 1"

- name: NEW RHELOSP-176036 but check over a smaller time
ansible.builtin.shell:
cmd: /usr/bin/curl -k {{ prom_auth_string }} -g https://{{ prom_url }}/api/v1/query? --data-urlencode 'query=last_over_time(sensubility_container_health_status{process="logrotate_crond",host="ceph-0.redhat.local"}[2m])' | grep -oP '(?<="value":).*' | awk -F, '{ print $2 }' | grep -o '[0-9]\+' | grep 0
register: output
changed_when: false
retries: 12
delay: 10
until: "output.stdout_lines | length == 1"

- name: NEW RHELOSP-176036 but wait for up to 10 minutes
ansible.builtin.shell:
cmd: /usr/bin/curl -k {{ prom_auth_string }} -g https://{{ prom_url }}/api/v1/query? --data-urlencode 'query=last_over_time(sensubility_container_health_status{process="logrotate_crond",host="ceph-0.redhat.local"}[10m])' | grep -oP '(?<="value":).*' | awk -F, '{ print $2 }' | grep -o '[0-9]\+' | grep 0
register: output
changed_when: false
retries: 60
delay: 10
until: "output.stdout_lines | length == 1"

- name: NEW RHELOSP-176036 but don't "grep 0"
ansible.builtin.shell:
cmd: /usr/bin/curl -k {{ prom_auth_string }} -g https://{{ prom_url }}/api/v1/query? --data-urlencode 'query=last_over_time(sensubility_container_health_status{process="logrotate_crond",host="ceph-0.redhat.local"}[10m])' | grep -oP '(?<="value":).*' | awk -F, '{ print $2 }' | grep -o '[0-9]\+'
register: output
changed_when: false

- name: NEW RHELOSP-176036 but skip the awk
ansible.builtin.shell:
cmd: /usr/bin/curl -k {{ prom_auth_string }} -g https://{{ prom_url }}/api/v1/query? --data-urlencode 'query=last_over_time(sensubility_container_health_status{process="logrotate_crond",host="ceph-0.redhat.local"}[10m])' | grep -oP '(?<="value":).*'
register: output
changed_when: false

- name: NEW RHELOSP-176036 but check the whole output
ansible.builtin.shell:
cmd: /usr/bin/curl -k {{ prom_auth_string }} -g https://{{ prom_url }}/api/v1/query? --data-urlencode 'query=last_over_time(sensubility_container_health_status{process="logrotate_crond",host="ceph-0.redhat.local"}[10m])'
register: output
changed_when: false
#- name: NEW RHELOSP-176036 but check over a smaller time
# ansible.builtin.shell:
# cmd: /usr/bin/curl -k {{ prom_auth_string }} -g https://{{ prom_url }}/api/v1/query? --data-urlencode 'query=last_over_time(sensubility_container_health_status{process="logrotate_crond",host="ceph-0.redhat.local"}[2m])' | grep -oP '(?<="value":).*' | awk -F, '{ print $2 }' | grep -o '[0-9]\+' | grep 0
# register: output
# changed_when: false
# retries: 12
# delay: 10
# until: "output.stdout_lines | length == 1"
#
#- name: NEW RHELOSP-176036 but check over a smaller time
# ansible.builtin.shell:
# cmd: /usr/bin/curl -k {{ prom_auth_string }} -g https://{{ prom_url }}/api/v1/query? --data-urlencode 'query=last_over_time(sensubility_container_health_status{process="logrotate_crond",host="ceph-0.redhat.local"}[2m])' | grep -oP '(?<="value":).*' | awk -F, '{ print $2 }' | grep -o '[0-9]\+' | grep 0
# register: output
# changed_when: false
# retries: 12
# delay: 10
# until: "output.stdout_lines | length == 1"
#
#- name: NEW RHELOSP-176036 but wait for up to 10 minutes
# ansible.builtin.shell:
# cmd: /usr/bin/curl -k {{ prom_auth_string }} -g https://{{ prom_url }}/api/v1/query? --data-urlencode 'query=last_over_time(sensubility_container_health_status{process="logrotate_crond",host="ceph-0.redhat.local"}[10m])' | grep -oP '(?<="value":).*' | awk -F, '{ print $2 }' | grep -o '[0-9]\+' | grep 0
# register: output
# changed_when: false
# retries: 60
# delay: 10
# until: "output.stdout_lines | length == 1"
#
#- name: NEW RHELOSP-176036 but don't "grep 0"
# ansible.builtin.shell:
# cmd: /usr/bin/curl -k {{ prom_auth_string }} -g https://{{ prom_url }}/api/v1/query? --data-urlencode 'query=last_over_time(sensubility_container_health_status{process="logrotate_crond",host="ceph-0.redhat.local"}[10m])' | grep -oP '(?<="value":).*' | awk -F, '{ print $2 }' | grep -o '[0-9]\+'
# register: output
# changed_when: false
#
#- name: NEW RHELOSP-176036 but skip the awk
# ansible.builtin.shell:
# cmd: /usr/bin/curl -k {{ prom_auth_string }} -g https://{{ prom_url }}/api/v1/query? --data-urlencode 'query=last_over_time(sensubility_container_health_status{process="logrotate_crond",host="ceph-0.redhat.local"}[10m])' | grep -oP '(?<="value":).*'
# register: output
# changed_when: false
#
#- name: NEW RHELOSP-176036 but check the whole output
# ansible.builtin.shell:
# cmd: /usr/bin/curl -k {{ prom_auth_string }} -g https://{{ prom_url }}/api/v1/query? --data-urlencode 'query=last_over_time(sensubility_container_health_status{process="logrotate_crond",host="ceph-0.redhat.local"}[10m])'
# register: output
# changed_when: false


- name: RHELOSP-176035 Start logrotate_crond container
Expand Down

0 comments on commit 214c79c

Please sign in to comment.