From 51ce441ca60cd115d9e8a932203ccc9d3cebcf82 Mon Sep 17 00:00:00 2001 From: ramamani yeleswarapu Date: Wed, 11 Oct 2017 17:41:52 -0700 Subject: Add plugin for Barometer. Change-Id: I5049805eb4e2e2c5e2cc87772afe6650253be36c Signed-off-by: John Hinman Signed-off-by: ramamani yeleswarapu --- plugins/barometer/plugin.desc | 52 +++++++++ .../barometer/roles/collectd/tasks/collectd.yml | 126 +++++++++++++++++++++ plugins/barometer/roles/collectd/tasks/main.yml | 13 +++ .../roles/collectd/templates/collectd-aodh.conf.j2 | 37 ++++++ .../collectd/templates/collectd-gnocchi.conf.j2 | 40 +++++++ .../roles/collectd/templates/hugepages.conf.j2 | 10 ++ .../roles/collectd/templates/logfile.conf.j2 | 13 +++ .../roles/collectd/templates/mcelog.conf.j2 | 9 ++ .../roles/collectd/templates/ovs_events.conf.j2 | 11 ++ .../roles/collectd/templates/ovs_stats.conf.j2 | 10 ++ plugins/barometer/roles/collectd/vars/main.yml | 16 +++ 11 files changed, 337 insertions(+) create mode 100644 plugins/barometer/plugin.desc create mode 100644 plugins/barometer/roles/collectd/tasks/collectd.yml create mode 100644 plugins/barometer/roles/collectd/tasks/main.yml create mode 100644 plugins/barometer/roles/collectd/templates/collectd-aodh.conf.j2 create mode 100644 plugins/barometer/roles/collectd/templates/collectd-gnocchi.conf.j2 create mode 100644 plugins/barometer/roles/collectd/templates/hugepages.conf.j2 create mode 100644 plugins/barometer/roles/collectd/templates/logfile.conf.j2 create mode 100644 plugins/barometer/roles/collectd/templates/mcelog.conf.j2 create mode 100644 plugins/barometer/roles/collectd/templates/ovs_events.conf.j2 create mode 100644 plugins/barometer/roles/collectd/templates/ovs_stats.conf.j2 create mode 100644 plugins/barometer/roles/collectd/vars/main.yml (limited to 'plugins/barometer') diff --git a/plugins/barometer/plugin.desc b/plugins/barometer/plugin.desc new file mode 100644 index 00000000..896d6f27 --- /dev/null +++ b/plugins/barometer/plugin.desc @@ -0,0 +1,52 @@ +# Plugin for Barometer service for Compass4nfv. +# Barometer is a configuration of Collectd for +# collecting metrics useful for NFV, and sending them +# to Openstack gnocchi service, and connecting with aodh +# to set alarms on those metrics. +# More details can be found in the development document. +# ############################################################## +--- +plugin: + # plugin name,it is also as the switch to enable/disable plugin in scenario + # files + name: barometer + + description: collect metrics and set alarms on compute nodes + + maintainers: + - john.hinman@intel.com + + # host os type: ubuntu/centos + os_version: ubuntu + + # true: this plugin is deployed separately on a new node + # false: this plugin is deployed on controller or compute node + independent_hosts: false + + # artifact: package download url for this plugin + artifacts: + url: + + # orchestration + # A plugin can have mutiple components, each component may need to be + # installed on different inventory or have its own configuration. + # due to Compass4nfv currently only supports ansible, so each component + # of the installation and configuration script need to be use ansible. + # cm : congfiguration management tool : only ansible support + # role: each component corresponds to ansible script that locates in the same + # directory as plugin.desc. + # phrase: pre_openstack -- the component is installed after the OS + # provisioning, before the OpenStack deployment. + # phrase: post_openstack -- the component is installed before the OpenStack + # deployment. + # inventory: if the phrase is pre_openstack, inventory can be controller and + # compute. if the phrase is post_openstack, inventory can be get from the file + # openstack-ansible.inventory + orchestration: + cm: ansible + roles: + - role: collectd + phrase: post_openstack + inventory: + - compute + diff --git a/plugins/barometer/roles/collectd/tasks/collectd.yml b/plugins/barometer/roles/collectd/tasks/collectd.yml new file mode 100644 index 00000000..5a2c3710 --- /dev/null +++ b/plugins/barometer/roles/collectd/tasks/collectd.yml @@ -0,0 +1,126 @@ +# ############################################################################# +# Copyright (c) 2017 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 +# ############################################################################# +--- +- 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 + 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 + +- name: fetch collectd plugin source code + shell: | + cd /opt/stack; + git clone https://github.com/openstack/collectd-ceilometer-plugin.git; + cd /opt/stack/collectd-ceilometer-plugin; + git checkout stable/ocata + when: stat_result.stat.exists == False + +- name: configure logfile conf + template: + src: logfile.conf.j2 + dest: /etc/collectd/collectd.conf.d/logfile.conf + +- name: configure collectd-aodh plugin conf + template: + src: collectd-aodh.conf.j2 + dest: /etc/collectd/collectd.conf.d/collectd-aodh-plugin.conf + +- name: configure collectd-gnocchi plugin conf + template: + src: collectd-gnocchi.conf.j2 + dest: /etc/collectd/collectd.conf.d/collectd-gnocchi-plugin.conf + +- name: configure hugepages conf + template: + src: hugepages.conf.j2 + dest: /etc/collectd/collectd.conf.d/hugepages.conf + +- name: configure mcelog conf + template: + src: mcelog.conf.j2 + dest: /etc/collectd/collectd.conf.d/mcelog.conf + +- name: configure ovs_stats conf + template: + src: ovs_stats.conf.j2 + dest: /etc/collectd/collectd.conf.d/ovs_stats.conf + +- name: configure ovs_events conf + 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' + +- 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: install gnocchiclient, aodhclient, set ovs manager, restart mcelog, collectd + shell: | + pip install gnocchiclient; + pip install aodhclient; + ovs-vsctl set-manager ptcp:6640:127.0.0.1; + systemctl restart mcelog; + systemctl restart collectd diff --git a/plugins/barometer/roles/collectd/tasks/main.yml b/plugins/barometer/roles/collectd/tasks/main.yml new file mode 100644 index 00000000..d33823ed --- /dev/null +++ b/plugins/barometer/roles/collectd/tasks/main.yml @@ -0,0 +1,13 @@ +# ############################################################################# +# Copyright (c) 2017 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 +# ############################################################################# +--- +- include_vars: "{{ openstack_passwd_file }}" + +- include: collectd.yml + when: barometer is defined and barometer == "Enable" diff --git a/plugins/barometer/roles/collectd/templates/collectd-aodh.conf.j2 b/plugins/barometer/roles/collectd/templates/collectd-aodh.conf.j2 new file mode 100644 index 00000000..301ba25a --- /dev/null +++ b/plugins/barometer/roles/collectd/templates/collectd-aodh.conf.j2 @@ -0,0 +1,37 @@ + + Globals true + + + + ModulePath "/opt/stack/collectd-ceilometer-plugin" + LogTraces true + Interactive false + Import "collectd_ceilometer.aodh.plugin" + + + + # Verbosity True|False + VERBOSE False + + # Service endpoint addresses + OS_AUTH_URL "http://{{ internal_vip.ip }}:35357/v3/" + + # Plugin address + #CEILOMETER_URL_TYPE "internalURL" + + # Plugin timeout in ms + #CEILOMETER_TIMEOUT "1000" + + # # Plugin user creds + OS_USERNAME "ceilometer" + OS_PASSWORD "{{ ceilometer_service_password }}" + OS_TENANT_NAME "service" + + # Libvirt meter enabled + LIBVIRT_METER_ENABLED False + + + + + + diff --git a/plugins/barometer/roles/collectd/templates/collectd-gnocchi.conf.j2 b/plugins/barometer/roles/collectd/templates/collectd-gnocchi.conf.j2 new file mode 100644 index 00000000..b54e9d5a --- /dev/null +++ b/plugins/barometer/roles/collectd/templates/collectd-gnocchi.conf.j2 @@ -0,0 +1,40 @@ + + Globals true + + + + ModulePath "/opt/stack/collectd-ceilometer-plugin" + LogTraces true + Interactive false + Import "collectd_ceilometer.gnocchi.plugin" + + + + # Verbosity True|False + VERBOSE False + + # Batch size + BATCH_SIZE "1" + + # Service endpoint addresses + OS_AUTH_URL "http://{{ internal_vip.ip }}:35357/v3/" + + # Plugin address + CEILOMETER_URL_TYPE "internalURL" + + # Plugin timeout in ms + CEILOMETER_TIMEOUT "1000" + + # # Plugin user creds + OS_USERNAME "ceilometer" + OS_PASSWORD "{{ ceilometer_service_password }}" + OS_TENANT_NAME "service" + + # Libvirt meter enabled + LIBVIRT_METER_ENABLED False + + + + + + diff --git a/plugins/barometer/roles/collectd/templates/hugepages.conf.j2 b/plugins/barometer/roles/collectd/templates/hugepages.conf.j2 new file mode 100644 index 00000000..cefcc25d --- /dev/null +++ b/plugins/barometer/roles/collectd/templates/hugepages.conf.j2 @@ -0,0 +1,10 @@ +LoadPlugin hugepages + + + ReportPerNodeHP true + ReportRootHP true + ValuesPages true + ValuesBytes false + ValuesPercentage false + + diff --git a/plugins/barometer/roles/collectd/templates/logfile.conf.j2 b/plugins/barometer/roles/collectd/templates/logfile.conf.j2 new file mode 100644 index 00000000..77d86a99 --- /dev/null +++ b/plugins/barometer/roles/collectd/templates/logfile.conf.j2 @@ -0,0 +1,13 @@ +LoadPlugin "logfile" + + + LogLevel "info" + File "/var/log/collectd.log" + Timestamp true + + +# Decrease syslog verbosity, to avoid duplicate logging + + LogLevel "err" + + diff --git a/plugins/barometer/roles/collectd/templates/mcelog.conf.j2 b/plugins/barometer/roles/collectd/templates/mcelog.conf.j2 new file mode 100644 index 00000000..3a043ec8 --- /dev/null +++ b/plugins/barometer/roles/collectd/templates/mcelog.conf.j2 @@ -0,0 +1,9 @@ +LoadPlugin mcelog + + + + McelogClientSocket "/var/run/mcelog-client" + PersistentNotification false + + + diff --git a/plugins/barometer/roles/collectd/templates/ovs_events.conf.j2 b/plugins/barometer/roles/collectd/templates/ovs_events.conf.j2 new file mode 100644 index 00000000..d72e2004 --- /dev/null +++ b/plugins/barometer/roles/collectd/templates/ovs_events.conf.j2 @@ -0,0 +1,11 @@ + + Interval 1 + + + Port 6640 + Socket "/var/run/openvswitch/db.sock" + Interfaces "br0" "veth0" + SendNotification false + DispatchValues true + + diff --git a/plugins/barometer/roles/collectd/templates/ovs_stats.conf.j2 b/plugins/barometer/roles/collectd/templates/ovs_stats.conf.j2 new file mode 100644 index 00000000..945c4e92 --- /dev/null +++ b/plugins/barometer/roles/collectd/templates/ovs_stats.conf.j2 @@ -0,0 +1,10 @@ + + Interval 1 + + + Port "6640" + Address "127.0.0.1" + Socket "/var/run/openvswitch/db.sock" + Bridges "br0" "br_ext" + + diff --git a/plugins/barometer/roles/collectd/vars/main.yml b/plugins/barometer/roles/collectd/vars/main.yml new file mode 100644 index 00000000..9fc0687d --- /dev/null +++ b/plugins/barometer/roles/collectd/vars/main.yml @@ -0,0 +1,16 @@ +# ############################################################################# +# Copyright (c) 2017 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 +# ############################################################################# +--- +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 -- cgit 1.2.3-korg