Zack Williams | 6f0d88e | 2018-01-13 23:04:02 -0700 | [diff] [blame] | 1 | --- |
Matteo Scandolo | 3896c47 | 2017-08-01 13:31:42 -0700 | [diff] [blame] | 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 16 | # head-diag/tasks/main.yml |
| 17 | |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 18 | - name: Create diag_dir subdirs |
| 19 | file: |
Zack Williams | 6f0d88e | 2018-01-13 23:04:02 -0700 | [diff] [blame] | 20 | dest: "~/{{ diag_dir }}/{{ item }}" |
| 21 | state: directory |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 22 | with_items: |
Zack Williams | f1606b9 | 2018-04-23 22:31:35 -0700 | [diff] [blame] | 23 | - head |
| 24 | - juju |
| 25 | - openstack |
| 26 | - onos-cord |
| 27 | - onos-fabric |
| 28 | - docker |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 29 | |
Zack Williams | dc4878f | 2016-07-26 14:50:30 -0700 | [diff] [blame] | 30 | - name: Head node diag collection |
| 31 | shell: "{{ item }} > ~/{{ diag_dir }}/head/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 32 | ignore_errors: yes |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 33 | args: |
| 34 | creates: "~/{{ diag_dir }}/head/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 35 | with_items: |
Zack Williams | f1606b9 | 2018-04-23 22:31:35 -0700 | [diff] [blame] | 36 | - "arp -n" |
| 37 | - "brctl show" |
| 38 | - "cat /etc/lsb-release" |
| 39 | - "cat /etc/resolv.conf" |
| 40 | - "date -u" |
| 41 | - "df -k" |
| 42 | - "free" |
| 43 | - "ifconfig -a" |
| 44 | - "ip addr list" |
| 45 | - "ip link list" |
| 46 | - "ip neighbor" |
| 47 | - "ip route" |
| 48 | - "ps aux" |
| 49 | - "route -n" |
| 50 | - "sudo docker ps -a" |
| 51 | - "sudo iptables -S" |
| 52 | - "sudo iptables -t nat -S" |
| 53 | - "sudo lxc list" |
| 54 | - "sudo virsh list" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 55 | |
| 56 | - name: Juju diag collection |
Zack Williams | 0410673 | 2016-06-27 20:55:32 -0700 | [diff] [blame] | 57 | shell: "{{ item }} > ~/{{ diag_dir }}/juju/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 58 | ignore_errors: yes |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 59 | args: |
| 60 | creates: "~/{{ diag_dir }}/juju/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 61 | with_items: |
Zack Williams | f1606b9 | 2018-04-23 22:31:35 -0700 | [diff] [blame] | 62 | - "juju status --format=summary" |
| 63 | - "juju status --format=tabular" |
| 64 | - "juju status --format=json" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 65 | |
| 66 | - name: OpenStack diag collection |
Zack Williams | c989f26 | 2017-05-11 13:02:59 -0700 | [diff] [blame] | 67 | shell: "source /opt/cord_profile/admin-openrc.sh && {{ item }} > ~/{{ diag_dir }}/openstack/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 68 | ignore_errors: yes |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 69 | args: |
| 70 | executable: "/bin/bash" |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 71 | creates: "~/{{ diag_dir }}/openstack/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 72 | with_items: |
Zack Williams | f1606b9 | 2018-04-23 22:31:35 -0700 | [diff] [blame] | 73 | - "glance image-list" |
| 74 | - "nova list --all-tenants" |
| 75 | - "nova host-list" |
| 76 | - "nova hypervisor-list" |
| 77 | - "keystone tenant-list" |
| 78 | - "keystone user-list" |
| 79 | - "neutron net-list" |
| 80 | - "neutron subnet-list" |
| 81 | - "neutron port-list" |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 82 | |
You Wang | 4089f8e | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 83 | - name: ONOS-CORD diag collection - REST API |
| 84 | shell: "curl -X GET -u karaf:karaf http://onos-cord:8182/onos/v1/{{ item }} | python -m json.tool > ~/{{ diag_dir }}/onos-cord/rest_{{ item | regex_replace('[^\\w-]', '_') }}" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 85 | ignore_errors: yes |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 86 | args: |
You Wang | 4089f8e | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 87 | creates: "~/{{ diag_dir }}/onos-cord/rest_{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 88 | warn: False # get_url or uri can't easily redirect to a file |
Zack Williams | 2bfbbd6 | 2016-06-13 10:18:19 -0700 | [diff] [blame] | 89 | with_items: |
| 90 | - "hosts" |
| 91 | |
Zack Williams | f1606b9 | 2018-04-23 22:31:35 -0700 | [diff] [blame] | 92 | # see also the onos-diagnostic script: |
| 93 | # https://github.com/opennetworkinglab/onos/blob/master/tools/package/runtime/bin/onos-diagnostics |
You Wang | 4089f8e | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 94 | - name: ONOS-CORD diag collection - ONOS CLI |
| 95 | shell: "sshpass -p 'karaf' ssh -p 8102 karaf@onos-cord {{ item }} > ~/{{ diag_dir }}/onos-cord/{{ item | regex_replace('[^\\w-]', '_') }}" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 96 | ignore_errors: yes |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 97 | args: |
You Wang | 4089f8e | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 98 | creates: "~/{{ diag_dir }}/onos-cord/{{ item | regex_replace('[^\\w-]', '_')}}" |
Zack Williams | 4e5d1d2 | 2016-06-13 11:10:03 -0700 | [diff] [blame] | 99 | with_items: |
Zack Williams | f1606b9 | 2018-04-23 22:31:35 -0700 | [diff] [blame] | 100 | - "apps -s -a" |
| 101 | - "bundle:list" |
| 102 | - "cfg get" |
| 103 | - "cordvtn-networks" |
| 104 | - "cordvtn-node-check compute1" |
| 105 | - "cordvtn-nodes" |
| 106 | - "cordvtn-ports" |
| 107 | - "devices" |
| 108 | - "dhcp-list" |
| 109 | - "dhcp-relay" |
| 110 | - "feature:list" |
| 111 | - "feature:repo-list" |
| 112 | - "flows -s" |
| 113 | - "fpm-connections" |
| 114 | - "groups" |
| 115 | - "hosts" |
| 116 | - "intents" |
| 117 | - "interfaces" |
| 118 | - "links" |
| 119 | - "log:display" |
| 120 | - "masters" |
| 121 | - "mcast-host-routes" |
| 122 | - "mcast-host-show" |
| 123 | - "netcfg" |
| 124 | - "nodes" |
| 125 | - "obj-next-ids" |
| 126 | - "obj-pending-nexts" |
| 127 | - "packet-processors" |
| 128 | - "packet-requests" |
| 129 | - "ports -e" |
| 130 | - "portstats -nz" |
| 131 | - "roles" |
| 132 | - "routes" |
| 133 | - "scr:list" |
| 134 | - "sr-device-subnets" |
| 135 | - "sr-ecmp-spg" |
| 136 | - "sr-link-state" |
| 137 | - "sr-mcast-leader" |
| 138 | - "sr-mcast-next" |
| 139 | - "sr-mcast-tree" |
| 140 | - "sr-next-hops" |
| 141 | - "sr-pw-list" |
| 142 | - "sr-should-program" |
| 143 | - "summary" |
Zack Williams | 4e5d1d2 | 2016-06-13 11:10:03 -0700 | [diff] [blame] | 144 | |
You Wang | 4089f8e | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 145 | - name: ONOS-FABRIC diag collection - REST API |
| 146 | shell: "curl -X GET -u karaf:karaf http://onos-fabric:8182/onos/v1/{{ item }} | python -m json.tool > ~/{{ diag_dir }}/onos-fabric/rest_{{ item | regex_replace('[^\\w-]', '_') }}" |
Suchitra Vemuri | 23f8622 | 2017-11-14 17:12:10 -0800 | [diff] [blame] | 147 | ignore_errors: yes |
| 148 | args: |
You Wang | 4089f8e | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 149 | creates: "~/{{ diag_dir }}/onos-fabric/rest_{{ item | regex_replace('[^\\w-]', '_')}}" |
Suchitra Vemuri | 23f8622 | 2017-11-14 17:12:10 -0800 | [diff] [blame] | 150 | warn: False # get_url or uri can't easily redirect to a file |
| 151 | with_items: |
Zack Williams | f1606b9 | 2018-04-23 22:31:35 -0700 | [diff] [blame] | 152 | - "hosts" |
Suchitra Vemuri | 23f8622 | 2017-11-14 17:12:10 -0800 | [diff] [blame] | 153 | |
You Wang | 4089f8e | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 154 | - name: ONOS-FABRIC diag collection - ONOS CLI |
| 155 | shell: "sshpass -p 'karaf' ssh -p 8101 karaf@onos-fabric {{ item }} > ~/{{ diag_dir }}/onos-fabric/{{ item | regex_replace('[^\\w-]', '_') }}" |
Suchitra Vemuri | 23f8622 | 2017-11-14 17:12:10 -0800 | [diff] [blame] | 156 | ignore_errors: yes |
| 157 | args: |
You Wang | 4089f8e | 2017-11-16 13:31:02 -0800 | [diff] [blame] | 158 | creates: "~/{{ diag_dir }}/onos-fabric/{{ item | regex_replace('[^\\w-]', '_')}}" |
Suchitra Vemuri | 23f8622 | 2017-11-14 17:12:10 -0800 | [diff] [blame] | 159 | with_items: |
Zack Williams | f1606b9 | 2018-04-23 22:31:35 -0700 | [diff] [blame] | 160 | - "apps -s -a" |
| 161 | - "bundle:list" |
| 162 | - "cfg get" |
| 163 | - "devices" |
| 164 | - "dhcp-relay" |
| 165 | - "feature:list" |
| 166 | - "feature:repo-list" |
| 167 | - "flows -s" |
| 168 | - "fpm-connections" |
| 169 | - "groups" |
| 170 | - "hosts" |
| 171 | - "intents" |
| 172 | - "interfaces" |
| 173 | - "links" |
| 174 | - "log:display" |
| 175 | - "masters" |
| 176 | - "mcast-host-routes" |
| 177 | - "mcast-host-show" |
| 178 | - "netcfg" |
| 179 | - "nodes" |
| 180 | - "obj-next-ids" |
| 181 | - "obj-pending-nexts" |
| 182 | - "packet-processors" |
| 183 | - "packet-requests" |
| 184 | - "ports -e" |
| 185 | - "portstats -nz" |
| 186 | - "roles" |
| 187 | - "routes" |
| 188 | - "scr:list" |
| 189 | - "sr-device-subnets" |
| 190 | - "sr-ecmp-spg" |
| 191 | - "sr-link-state" |
| 192 | - "sr-mcast-leader" |
| 193 | - "sr-mcast-next" |
| 194 | - "sr-mcast-tree" |
| 195 | - "sr-next-hops" |
| 196 | - "sr-pw-list" |
| 197 | - "sr-should-program" |
| 198 | - "summary" |
Suchitra Vemuri | 23f8622 | 2017-11-14 17:12:10 -0800 | [diff] [blame] | 199 | |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 200 | - name: Docker diag collection - Find names for all running Docker containers |
Zack Williams | 6f0d88e | 2018-01-13 23:04:02 -0700 | [diff] [blame] | 201 | command: sudo docker ps -a --format '{{'{{'}} .Names {{'}}'}}' |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 202 | ignore_errors: yes |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 203 | register: docker_containers |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 204 | tags: |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 205 | - skip_ansible_lint # collecting docker container names |
| 206 | |
| 207 | - name: Docker diag collection - Collect logs from Docker containers |
Zack Williams | 6f0d88e | 2018-01-13 23:04:02 -0700 | [diff] [blame] | 208 | shell: "sudo docker logs {{ item }} > ~/{{ diag_dir }}/docker/{{ item | regex_replace('[^\\w-]', '_')}}.logs 2>&1" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 209 | ignore_errors: yes |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 210 | args: |
Zack Williams | 6f0d88e | 2018-01-13 23:04:02 -0700 | [diff] [blame] | 211 | creates: "~/{{ diag_dir }}/docker/{{ item | regex_replace('[^\\w-]', '_')}}.logs" |
Zack Williams | 7bf3570 | 2017-02-08 20:40:02 -0700 | [diff] [blame] | 212 | with_items: "{{ docker_containers.stdout_lines }}" |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 213 | tags: |
| 214 | - skip_ansible_lint # ansible-lint interprets the \n incorrectly |
| 215 | |
Zack Williams | 6f0d88e | 2018-01-13 23:04:02 -0700 | [diff] [blame] | 216 | - name: Docker diag collection - inspect Docker containers |
| 217 | shell: "sudo docker inspect {{ item }} > ~/{{ diag_dir }}/docker/{{ item | regex_replace('[^\\w-]', '_')}}.inspect 2>&1" |
| 218 | ignore_errors: yes |
| 219 | args: |
| 220 | creates: "~/{{ diag_dir }}/docker/{{ item | regex_replace('[^\\w-]', '_')}}.inspect" |
| 221 | with_items: "{{ docker_containers.stdout_lines }}" |
| 222 | tags: |
| 223 | - skip_ansible_lint # ansible-lint interprets the \n incorrectly |
| 224 | |
| 225 | # much cleaner to use !unsafe to avoid j2 parsing of golang {{ and }} templates |
| 226 | # but ansible-lint doesn't support it: https://github.com/willthames/ansible-lint/issues/291 |
| 227 | - name: Docker diag collection - Collect memory and CPU stats from docker containers |
| 228 | shell: "sudo docker stats --no-stream --format \"table {{'{{'}}.Name{{'}}'}}\t{{'{{'}}.Container{{'}}'}}\t{{'{{'}}.CPUPerc{{'}}'}}\t{{'{{'}}.MemUsage{{'}}'}}\t{{'{{'}}.MemPerc{{'}}'}}\" > ~/{{ diag_dir }}/docker/stats 2>&1" |
| 229 | ignore_errors: yes |
| 230 | args: |
| 231 | creates: "~/{{ diag_dir }}/docker/stats" |
| 232 | |