WIP: playbook to fetch RHOSO controlplane pods metrics
Change-Id: I193a389b881452a6966cf9db1ea08fdc5556c90a
This commit is contained in:
parent
8485df3535
commit
d9d381bb6a
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
- name: Check if oc is installed
|
||||
shell: "which oc"
|
||||
register: oc_location
|
||||
ignore_errors: true
|
||||
- name: Fail if oc is not installed
|
||||
fail:
|
||||
msg: "oc is not installed"
|
||||
when: oc_location.rc != 0
|
||||
|
||||
- name: Check if logged into Kubernetes cluster
|
||||
shell: "oc version"
|
||||
register: oc_version
|
||||
ignore_errors: true
|
||||
|
||||
- name: Fail if not logged in
|
||||
fail:
|
||||
msg: "Not logged in to Kubernetes cluster"
|
||||
when: oc_version.rc != 0
|
|
@ -0,0 +1,48 @@
|
|||
---
|
||||
- name: fetch prometheus data to ES
|
||||
hosts: localhost
|
||||
vars:
|
||||
required_vars:
|
||||
- es_server
|
||||
- es_index
|
||||
- uuid
|
||||
- job_name
|
||||
- metrics
|
||||
- start_time
|
||||
- end_time
|
||||
tasks:
|
||||
- name: check if variables are defind
|
||||
assert:
|
||||
that:
|
||||
- item in vars
|
||||
loop: "{{ required_vars }}"
|
||||
loop_control:
|
||||
label: "{{ item }}"
|
||||
register: var_check_result
|
||||
ignore_errors: true
|
||||
- name: Fail if any variable is not defined
|
||||
fail:
|
||||
msg: "Variable '{{ var_check_result.results | map(attribute='item') | list | first }}' is not defined. Aborting playbook execution."
|
||||
when: var_check_result is failed
|
||||
- include_tasks: check_oc.yaml
|
||||
- name: download kube-burner
|
||||
ansible.builtin.get_url:
|
||||
url: https://github.com/cloud-bulldozer/kube-burner/releases/download/v1.7.12/kube-burner-V1.7.12-linux-x86_64.tar.gz
|
||||
dest: /tmp/kube-burner.tar.gz
|
||||
- name: extract the kube-burner
|
||||
ansible.builtin.unarchive:
|
||||
src: /tmp/kube-burner.tar.gz
|
||||
dest: /tmp
|
||||
mode: '0774'
|
||||
- name: retrieve the prometheus url
|
||||
shell: oc get routes -n openshift-monitoring prometheus-k8s -o=jsonpath='{.spec.host}'
|
||||
register: prometheus_url
|
||||
- name: create token to access prometheus
|
||||
shell: oc create token prometheus-k8s -n openshift-monitoring
|
||||
register: token
|
||||
- name: debug msg
|
||||
debug:
|
||||
msg: "url {{ prometheus_url.stdout }}"
|
||||
- name: copy data from premetheus to elastic
|
||||
shell: |
|
||||
/tmp/kube-burner index --es-server {{ es_server }} --es-index {{ es_index }} --uuid={{ uuid}} --job-name {{ job_name }} --token={{ token.stdout}} -m={{ metrics }} --start={{ start_time }} --end={{ end_time }} --log-level debug -u https://{{ prometheus_url.stdout }}
|
|
@ -0,0 +1,14 @@
|
|||
# Containers & pod metrics
|
||||
#
|
||||
#- query: (sum(irate(container_cpu_usage_seconds_total{name!="",container!~"POD|",namespace=~"openstack"}[2m]) * 100) by (container, pod, namespace, node)) > 0
|
||||
# metricName: containerCPU
|
||||
|
||||
#- query: sum(container_memory_rss{name!="",container!~"POD|",namespace=~"openstack"}) by (container, pod, namespace, node)
|
||||
# metricName: containerMemory
|
||||
|
||||
- query: sum(irate(container_network_receive_packets_total{cluster="",namespace=~"openstack", pod!=""}[2m])) by (pod, namespace, node, interface)
|
||||
metricName: containerRecvPackets
|
||||
|
||||
- query: sum(irate(container_network_transmit_packets_total{cluster="",namespace=~"openstack", pod!=""}[2m])) by (pod, namespace, node, interface)
|
||||
metricName: containerTranPackets
|
||||
|
Loading…
Reference in New Issue