diff options
Diffstat (limited to 'plugins/barometer/roles')
10 files changed, 285 insertions, 0 deletions
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 @@ +<LoadPlugin python> + Globals true +</LoadPlugin> + +<Plugin python> + ModulePath "/opt/stack/collectd-ceilometer-plugin" + LogTraces true + Interactive false + Import "collectd_ceilometer.aodh.plugin" + + <Module "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 + + <ALARM_SEVERITIES> + </ALARM_SEVERITIES> + </Module> +</Plugin> + 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 @@ +<LoadPlugin python> + Globals true +</LoadPlugin> + +<Plugin python> + ModulePath "/opt/stack/collectd-ceilometer-plugin" + LogTraces true + Interactive false + Import "collectd_ceilometer.gnocchi.plugin" + + <Module "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 + + <UNITS> + </UNITS> + </Module> +</Plugin> + 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 + +<Plugin hugepages> + ReportPerNodeHP true + ReportRootHP true + ValuesPages true + ValuesBytes false + ValuesPercentage false +</Plugin> + 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" + +<Plugin "logfile"> + LogLevel "info" + File "/var/log/collectd.log" + Timestamp true +</Plugin> + +# Decrease syslog verbosity, to avoid duplicate logging +<Plugin "syslog"> + LogLevel "err" +</Plugin> + 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 + +<Plugin mcelog> + <Memory> + McelogClientSocket "/var/run/mcelog-client" + PersistentNotification false + </Memory> +</Plugin> + 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 @@ +<LoadPlugin ovs_events> + Interval 1 +</LoadPlugin> +<Plugin "ovs_events"> + Port 6640 + Socket "/var/run/openvswitch/db.sock" + Interfaces "br0" "veth0" + SendNotification false + DispatchValues true +</Plugin> + 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 @@ +<LoadPlugin ovs_stats> + Interval 1 +</LoadPlugin> +<Plugin ovs_stats> + Port "6640" + Address "127.0.0.1" + Socket "/var/run/openvswitch/db.sock" + Bridges "br0" "br_ext" +</Plugin> + 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 |