diff options
18 files changed, 381 insertions, 104 deletions
diff --git a/plugins/barometer/plugin.desc b/plugins/barometer/plugin.desc index 896d6f27..3f775cb7 100644 --- a/plugins/barometer/plugin.desc +++ b/plugins/barometer/plugin.desc @@ -49,4 +49,3 @@ plugin: phrase: post_openstack inventory: - compute - diff --git a/plugins/barometer/roles/collectd/files/install_docker.sh b/plugins/barometer/roles/collectd/files/install_docker.sh new file mode 100644 index 00000000..f0c08bae --- /dev/null +++ b/plugins/barometer/roles/collectd/files/install_docker.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# ############################################################################# +# Copyright (c) 2018 Intel Corp. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +# ############################################################################# + +apt-get update +apt-get install -y apt-transport-https ca-certificates curl software-properties-common +sleep 3 + +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - +apt-key fingerprint 0EBFCD88 + +add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" + +apt-get update +sleep 3 + +apt-get install -y docker-ce +sleep 5 diff --git a/plugins/barometer/roles/collectd/tasks/collectd.yml b/plugins/barometer/roles/collectd/tasks/collectd.yml index 48e15989..4167e71b 100644 --- a/plugins/barometer/roles/collectd/tasks/collectd.yml +++ b/plugins/barometer/roles/collectd/tasks/collectd.yml @@ -1,5 +1,5 @@ # ############################################################################# -# Copyright (c) 2017 Intel Corp. +# Copyright (c) 2017-18 Intel Corp. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 @@ -7,120 +7,162 @@ # http://www.apache.org/licenses/LICENSE-2.0 # ############################################################################# --- -- name: install dependencies - apt: - name: "{{ item }}" - state: present - with_items: - - libltdl7 - - init-system-helpers - - mcelog - - rrdtool - - libc6 - - librrd4 - - libvirt-bin - - libvirt-dev - - gcc - - git - - python3-pip - -- name: create workspace directory - file: - path: "{{ workspace }}" - state: directory - mode: 0755 - -- name: download, unarchive and install collectd packages +- name: copy install_docker script + remote_user: root + copy: + src: install_docker.sh + dest: /opt/install_docker.sh + mode: 0777 + +- name: install docker + command: su -s /bin/sh -c "/opt/install_docker.sh" + +- name: create collectd_sample_configs dir + remote_user: root shell: | - cd "{{ workspace }}"; - wget "{{ artifacts_collectd_pkg }}"; - su -s /bin/sh -c \ - "tar xzf collectd_pkg.tar.gz -C {{ workspace }} --strip-components 1"; - apt-get install ./libcollectd*.deb -y; - apt-get install ./collectd*.deb -y - -- name: make stack dir - file: - path: /opt/stack - state: directory - mode: 0755 - -- name: check plugin dir exists - stat: - path: /opt/stack/collectd-ceilometer-plugin - register: stat_result + rm -rf /root/collectd_sample_configs; + mkdir /root/collectd_sample_configs; -- name: fetch collectd plugin source code +- name: docker pull opnfv/barometer-collectd + remote_user: root shell: | - cd /opt/stack; - git clone https://github.com/openstack/collectd-ceilometer-plugin.git; - cd /opt/stack/collectd-ceilometer-plugin; - git checkout stable/pike - when: stat_result.stat.exists == False + docker pull opnfv/barometer-collectd; + sleep 5 - name: configure logfile conf + remote_user: root template: src: logfile.conf.j2 - dest: /etc/collectd/collectd.conf.d/logfile.conf + dest: /root/collectd_sample_configs/logfile.conf + +- name: configure csv conf + remote_user: root + template: + src: csv.conf.j2 + dest: /root/collectd_sample_configs/csv.conf + +- name: check if vswitchd on host + shell: ps -ef | grep vswitchd | grep -v grep > /dev/null + register: vswitchd_result + ignore_errors: "true" + +- name: check if db.sock exists + stat: + path: /var/run/openvswitch/db.sock + register: dbsock_result + ignore_errors: "true" + +- name: configure ovs_stats conf and ovs_events conf + remote_user: root + template: + src: "{{ item }}.conf.j2" + dest: "/root/collectd_sample_configs/{{ item }}.conf" + when: vswitchd_result|succeeded and dbsock_result|succeeded + with_items: + - ovs_stats + - ovs_events + +- name: check if mcelog running on host + shell: ps -ef | grep mcelog | grep -v grep > /dev/null + register: mcelog_running + ignore_errors: "true" + +- name: check if mcelog exists + shell: which mcelog > /dev/null + register: mcelog_exists + ignore_errors: "true" + +- name: check if mcelog-client exists + stat: + path: /var/run/mcelog-client + register: mcelog_client_exists + ignore_errors: "true" + +- name: configure mcelog conf + remote_user: root + template: + src: mcelog.conf.j2 + dest: /root/collectd_sample_configs/mcelog.conf + when: mcelog_running|succeeded and mcelog_exists|succeeded and mcelog_client_exists|succeeded - name: configure collectd-aodh plugin conf + remote_user: root template: src: collectd-aodh.conf.j2 - dest: /etc/collectd/collectd.conf.d/collectd-aodh-plugin.conf + dest: /root/collectd_sample_configs/collectd-aodh-plugin.conf - name: configure collectd-gnocchi plugin conf + remote_user: root template: src: collectd-gnocchi.conf.j2 - dest: /etc/collectd/collectd.conf.d/collectd-gnocchi-plugin.conf + dest: /root/collectd_sample_configs/collectd-gnocchi-plugin.conf + +- name: check if hugepages folders exist on host + stat: + path: "{{ item }}" + register: hugepages_result + ignore_errors: "true" + with_items: + /sys/devices/system/node + /sys/kernel/mm/hugepages - name: configure hugepages conf + remote_user: root template: src: hugepages.conf.j2 - dest: /etc/collectd/collectd.conf.d/hugepages.conf + dest: /root/collectd_sample_configs/hugepages.conf + when: hugepages_result|succeeded -- name: configure mcelog conf +- name: check if rdt on host + shell: | + grep -q cqm* "/proc/cpuinfo" + register: rdt_result + ignore_errors: "true" + +- name: configure rdt conf + remote_user: root template: - src: mcelog.conf.j2 - dest: /etc/collectd/collectd.conf.d/mcelog.conf + src: rdt.conf.j2 + dest: /root/collectd_sample_configs/rdt.conf + when: rdt_result|succeeded -- name: configure ovs_stats conf +- name: load msr kernel module + modprobe: + name: msr + state: present + +- name: check if libvirtd on host + shell: ps -ef | grep libvirtd | grep -v grep > /dev/null + register: libvirt_result + ignore_errors: "true" + +- name: configure virt conf + remote_user: root template: - src: ovs_stats.conf.j2 - dest: /etc/collectd/collectd.conf.d/ovs_stats.conf + src: virt.conf.j2 + dest: /root/collectd_sample_configs/virt.conf + when: libvirt_result|succeeded -- name: configure ovs_events conf +- name: configure intel_pmu conf + remote_user: root template: - src: ovs_events.conf.j2 - dest: /etc/collectd/collectd.conf.d/ovs_events.conf - -- name: configure collectd conf - lineinfile: - dest: /etc/collectd/collectd.conf - regexp: '{{ item.regexp }}' - line: '{{ item.line }}' - with_items: - - regexp: '#LoadPlugin numa' - line: 'LoadPlugin numa' - - regexp: '#LoadPlugin virt' - line: 'LoadPlugin virt' - - regexp: '#LoadPlugin cpufreq' - line: 'LoadPlugin cpufreq' - - regexp: '#LoadPlugin cpusleep' - line: 'LoadPlugin cpusleep' + src: intel_pmu.conf.j2 + dest: /root/collectd_sample_configs/intel_pmu.conf -- name: configure mcelog conf - lineinfile: - dest: /etc/mcelog/mcelog.conf - regexp: '{{ item.regexp }}' - line: '{{ item.line }}' - with_items: - - regexp: '#socket-path = /var/run/mcelog-client' - line: 'socket-path = /var/run/mcelog-client' +- name: configure network conf + remote_user: root + template: + src: network.conf.j2 + dest: /root/collectd_sample_configs/network.conf + +- name: configure default plugins + remote_user: root + template: + src: default_plugins.conf.j2 + dest: /root/collectd_sample_configs/default_plugins.conf -- name: install gnocchiclient, aodhclient, set ovs manager, restart mcelog, collectd +- name: run barometer collectd container + remote_user: root shell: | - pip install gnocchiclient; - pip install aodhclient; - ovs-vsctl set-manager ptcp:6640:127.0.0.1; - systemctl restart mcelog; - systemctl restart collectd + docker run -dti --net=host -v /root/collectd_sample_configs:/opt/collectd/etc/collectd.conf.d \ + -v /var/run:/var/run -v /tmp:/tmp --privileged opnfv/barometer-collectd /run_collectd.sh diff --git a/plugins/barometer/roles/collectd/tasks/main.yml b/plugins/barometer/roles/collectd/tasks/main.yml index d33823ed..88602ea2 100644 --- a/plugins/barometer/roles/collectd/tasks/main.yml +++ b/plugins/barometer/roles/collectd/tasks/main.yml @@ -1,5 +1,5 @@ # ############################################################################# -# Copyright (c) 2017 Intel Corp. +# Copyright (c) 2017-18 Intel Corp. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 diff --git a/plugins/barometer/roles/collectd/templates/collectd-aodh.conf.j2 b/plugins/barometer/roles/collectd/templates/collectd-aodh.conf.j2 index 301ba25a..b7fcfb60 100644 --- a/plugins/barometer/roles/collectd/templates/collectd-aodh.conf.j2 +++ b/plugins/barometer/roles/collectd/templates/collectd-aodh.conf.j2 @@ -3,7 +3,7 @@ </LoadPlugin> <Plugin python> - ModulePath "/opt/stack/collectd-ceilometer-plugin" + ModulePath "/src/barometer/src/collectd-openstack-plugins/collectd-openstack-plugins" LogTraces true Interactive false Import "collectd_ceilometer.aodh.plugin" diff --git a/plugins/barometer/roles/collectd/templates/collectd-gnocchi.conf.j2 b/plugins/barometer/roles/collectd/templates/collectd-gnocchi.conf.j2 index b54e9d5a..79e2872e 100644 --- a/plugins/barometer/roles/collectd/templates/collectd-gnocchi.conf.j2 +++ b/plugins/barometer/roles/collectd/templates/collectd-gnocchi.conf.j2 @@ -3,7 +3,7 @@ </LoadPlugin> <Plugin python> - ModulePath "/opt/stack/collectd-ceilometer-plugin" + ModulePath "/src/barometer/src/collectd-openstack-plugins/collectd-openstack-plugins" LogTraces true Interactive false Import "collectd_ceilometer.gnocchi.plugin" diff --git a/plugins/barometer/roles/collectd/templates/csv.conf.j2 b/plugins/barometer/roles/collectd/templates/csv.conf.j2 new file mode 100644 index 00000000..06abf4ba --- /dev/null +++ b/plugins/barometer/roles/collectd/templates/csv.conf.j2 @@ -0,0 +1,20 @@ +# Copyright 2017-18 OPNFV +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +LoadPlugin csv + +<Plugin csv> + DataDir "/tmp/collectd/csv" + StoreRates false +</Plugin> + diff --git a/plugins/barometer/roles/collectd/templates/default_plugins.conf.j2 b/plugins/barometer/roles/collectd/templates/default_plugins.conf.j2 new file mode 100644 index 00000000..bd1850e6 --- /dev/null +++ b/plugins/barometer/roles/collectd/templates/default_plugins.conf.j2 @@ -0,0 +1,31 @@ +# Copyright 2017-18 OPNFV +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#Hostname "" + +LoadPlugin cpufreq +LoadPlugin disk +#LoadPlugin ethstat +#LoadPlugin ipc +#LoadPlugin ipmi +LoadPlugin load +LoadPlugin memory +LoadPlugin numa +LoadPlugin processes +#LoadPlugin df +#LoadPlugin turbostat +#LoadPlugin uptime +#LoadPlugin contextswitch +LoadPlugin irq +LoadPlugin swap + diff --git a/plugins/barometer/roles/collectd/templates/hugepages.conf.j2 b/plugins/barometer/roles/collectd/templates/hugepages.conf.j2 index cefcc25d..9378c1f2 100644 --- a/plugins/barometer/roles/collectd/templates/hugepages.conf.j2 +++ b/plugins/barometer/roles/collectd/templates/hugepages.conf.j2 @@ -1,3 +1,16 @@ +# Copyright 2017-18 OPNFV +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. LoadPlugin hugepages <Plugin hugepages> diff --git a/plugins/barometer/roles/collectd/templates/intel_pmu.conf.j2 b/plugins/barometer/roles/collectd/templates/intel_pmu.conf.j2 new file mode 100644 index 00000000..caba8825 --- /dev/null +++ b/plugins/barometer/roles/collectd/templates/intel_pmu.conf.j2 @@ -0,0 +1,23 @@ +# Copyright 2017-18 OPNFV +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +LoadPlugin intel_pmu + +<Plugin intel_pmu> + ReportHardwareCacheEvents true + ReportKernelPMUEvents true + ReportSoftwareEvents true +# EventList "/var/cache/pmu/GenuineIntel-6-2D-core.json" +# HardwareEvents "L2_RQSTS.CODE_RD_HIT,L2_RQSTS.CODE_RD_MISS" "L2_RQSTS.ALL_CODE_RD" +</Plugin> + diff --git a/plugins/barometer/roles/collectd/templates/logfile.conf.j2 b/plugins/barometer/roles/collectd/templates/logfile.conf.j2 index 77d86a99..bf53ae8f 100644 --- a/plugins/barometer/roles/collectd/templates/logfile.conf.j2 +++ b/plugins/barometer/roles/collectd/templates/logfile.conf.j2 @@ -1,3 +1,16 @@ +# Copyright 2017-18 OPNFV +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. LoadPlugin "logfile" <Plugin "logfile"> diff --git a/plugins/barometer/roles/collectd/templates/mcelog.conf.j2 b/plugins/barometer/roles/collectd/templates/mcelog.conf.j2 index 3a043ec8..f9ae8aa0 100644 --- a/plugins/barometer/roles/collectd/templates/mcelog.conf.j2 +++ b/plugins/barometer/roles/collectd/templates/mcelog.conf.j2 @@ -1,9 +1,25 @@ -LoadPlugin mcelog +# Copyright 2017-18 OPNFV +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +<LoadPlugin mcelog> + Interval 1 +</LoadPlugin> <Plugin mcelog> <Memory> - McelogClientSocket "/var/run/mcelog-client" - PersistentNotification false + McelogClientSocket "/var/run/mcelog-client" + PersistentNotification false </Memory> +## McelogLogfile "/var/log/mcelog" </Plugin> diff --git a/plugins/barometer/roles/collectd/templates/network.conf.j2 b/plugins/barometer/roles/collectd/templates/network.conf.j2 new file mode 100644 index 00000000..e9343e66 --- /dev/null +++ b/plugins/barometer/roles/collectd/templates/network.conf.j2 @@ -0,0 +1,19 @@ +# Copyright 2017-18 OPNFV, Intel Corp. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +LoadPlugin network + +<Plugin network> + Server "{{ internal_vip.ip }}" "25826" +</Plugin> + diff --git a/plugins/barometer/roles/collectd/templates/ovs_events.conf.j2 b/plugins/barometer/roles/collectd/templates/ovs_events.conf.j2 index d72e2004..2d71fa18 100644 --- a/plugins/barometer/roles/collectd/templates/ovs_events.conf.j2 +++ b/plugins/barometer/roles/collectd/templates/ovs_events.conf.j2 @@ -1,8 +1,23 @@ +# Copyright 2017-18 OPNFV +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. <LoadPlugin ovs_events> Interval 1 </LoadPlugin> + <Plugin "ovs_events"> Port 6640 + Address "127.0.0.1" Socket "/var/run/openvswitch/db.sock" Interfaces "br0" "veth0" SendNotification false diff --git a/plugins/barometer/roles/collectd/templates/ovs_stats.conf.j2 b/plugins/barometer/roles/collectd/templates/ovs_stats.conf.j2 index 945c4e92..b7e4d5c8 100644 --- a/plugins/barometer/roles/collectd/templates/ovs_stats.conf.j2 +++ b/plugins/barometer/roles/collectd/templates/ovs_stats.conf.j2 @@ -1,6 +1,20 @@ +# Copyright 2017-18 OPNFV +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License <LoadPlugin ovs_stats> Interval 1 </LoadPlugin> + <Plugin ovs_stats> Port "6640" Address "127.0.0.1" diff --git a/plugins/barometer/roles/collectd/templates/rdt.conf.j2 b/plugins/barometer/roles/collectd/templates/rdt.conf.j2 new file mode 100644 index 00000000..96d5eb34 --- /dev/null +++ b/plugins/barometer/roles/collectd/templates/rdt.conf.j2 @@ -0,0 +1,21 @@ +# Copyright 2017-18 OPNFV +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +<LoadPlugin intel_rdt> + Interval 1 +</LoadPlugin> + +<Plugin "intel_rdt"> + Cores "" +</Plugin> + diff --git a/plugins/barometer/roles/collectd/templates/virt.conf.j2 b/plugins/barometer/roles/collectd/templates/virt.conf.j2 new file mode 100644 index 00000000..8048bc13 --- /dev/null +++ b/plugins/barometer/roles/collectd/templates/virt.conf.j2 @@ -0,0 +1,32 @@ +# Copyright 2017-18 OPNFV +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +LoadPlugin virt + +<Plugin virt> +# Connection "xen:///" + RefreshInterval 60 +# Domain "name" +# BlockDevice "name:device" +# BlockDeviceFormat target +# BlockDeviceFormatBasename false +# InterfaceDevice "name:device" +# IgnoreSelected false +# HostnameFormat name +# InterfaceFormat name +# PluginInstanceFormat name +# Instances 1 + ExtraStats "cpu_util disk disk_err domain_state fs_info job_stats_background pcpu perf vcpupin" +</Plugin> + diff --git a/plugins/barometer/roles/collectd/vars/main.yml b/plugins/barometer/roles/collectd/vars/main.yml index 9fc0687d..b3a0b3b7 100644 --- a/plugins/barometer/roles/collectd/vars/main.yml +++ b/plugins/barometer/roles/collectd/vars/main.yml @@ -1,5 +1,5 @@ # ############################################################################# -# Copyright (c) 2017 Intel Corp. +# Copyright (c) 2017-18 Intel Corp. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 @@ -8,9 +8,3 @@ # ############################################################################# --- openstack_passwd_file: /etc/openstack_deploy/user_secrets.yml - -workspace: /tmp/plugin - -artifacts_collectd_pkg: http://artifacts.opnfv.org/compass4nfv/package/master/collectd_pkg.tar.gz - -collectd_ver: 5.8.0.23.g576797d-1~xenial_amd64.deb |