forked from leoaaraujo/playbooks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
playbook_ovs_logs.yaml
76 lines (66 loc) · 2.99 KB
/
playbook_ovs_logs.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
########################################################
# Author: Leonardo A. de Araujo #
# Create: 20/04/2019 #
# Email: leo.alvesdearaujo@gmail.com #
# Company: Red Hat #
########################################################
# Como executar:
# Ex.: ansible-playbook ovs.yaml -e "pod=ovs-xxx"
- hosts: localhost
name: Collect Logs OVS
gather_facts: yes
vars:
rh_dir: "ovs-dump"
project: "openshift-sdn"
tasks:
- name: Create directory {{ rh_dir }}
shell: mkdir -p /home/USER/{{ rh_dir }}
- name: Identify Server for pod {{ pod }}
shell: oc get pods -o wide -n {{ project }} | grep {{ pod }} | awk '{ print $7 }'
register: hostserver
- set_fact:
hostserver={{ hostserver.stdout }}
- name: Collect output Ps OVS
shell: ssh {{ hostserver }} ps -Taxfe -o %cpu,%mem,pid,spid,cmd | grep ovs > /home/USER/{{ rh_dir }}/ovs_ps-all.out
- name: Get PIDs OVS Process
shell: ssh {{ hostserver }} ps -Taxe -o %p,%c | grep ovs | cut -d"," -f1
register: pid_ovs
- name: Generate Core Dump OVS Process
shell: ssh {{ hostserver }} sudo gcore {{ item }}
with_items:
- "{{ pid_ovs.stdout_lines }}"
- name: Copy to bastion coredumps
shell: rsync -av --progress {{ hostserver }}:/home/USER/core.{{ item }} /home/USER/{{ rh_dir }}/
with_items:
- "{{ pid_ovs.stdout_lines }}"
- name: Capture Info Bridge Interface for OVS
shell: oc -n {{ project }} rsh {{ pod }} ovs-ofctl {{ item }} br0 > /home/USER/{{ rh_dir }}/ovs_{{ item }}.out
ignore_errors: yes
with_items:
- dump-flows
- dump-ports-desc
- dump-ports
- queue-get-config
- queue-stats
- show
- name: Capture OpenFlow13 for OVS
shell: oc -n {{ project }} rsh {{ pod }} ovs-ofctl -O OpenFlow13 {{ item }} br0 > /home/USER/{{ rh_dir }}/ovs_openflow13_{{ item }}.out
ignore_errors: yes
with_items:
- show
- dump-groups
- dump-group-stats
- dump-flows
- dump-ports-desc
- name: List files /var/run/openvswitch
shell: oc -n {{ project }} rsh {{ pod }} ls -laZ /var/run/openvswitch > /home/USER/{{ rh_dir }}/ovs_ls_run_openvswitch.out
- name: Capture stats OVS
shell: |
oc -n {{ project }} rsh {{ pod }} ovs-dpctl -s show > /home/USER/{{ rh_dir }}/ovs-dpctl-show.out
oc -n {{ project }} rsh {{ pod }} ovsdb-client -f list dump > /home/USER/{{ rh_dir }}/ovsdb-client-list-dump.out
oc -n {{ project }} rsh {{ pod }} ovs-vsctl -t 5 show > /home/USER/{{ rh_dir }}/ovs-vsctl-5-show.out
oc -n {{ project }} rsh {{ pod }} ovs-vsctl list Open_vSwitch > /home/USER/{{ rh_dir }}/ovs-vsctl-list-Open_vSwitch.out
oc -n {{ project }} rsh {{ pod }} ovs-appctl coverage/show > /home/USER/{{ rh_dir }}/ovs-appctl-coverage-show.out
oc -n {{ project }} rsh {{ pod }} ovs-appctl upcall/show > /home/USER/{{ rh_dir }}/ovs-appctl-upcall-show.out
ignore_errors: yes