diff options
Diffstat (limited to 'docker')
69 files changed, 702 insertions, 971 deletions
diff --git a/docker/README_collectd b/docker/README_collectd index baa0ff6e..cf497105 100644 --- a/docker/README_collectd +++ b/docker/README_collectd @@ -9,7 +9,7 @@ Table of content: 1. DESCRIPTION 2. SYSTEM REQUIREMENTS 3. INSTALLATION NOTES - barometer-collectd -4. INSTALLATION NOTES - barometer-collectd-master +4. INSTALLATION NOTES - barometer-collectd-latest 5. ADDITIONAL STEPS ------------------------------------------------------------------------------ @@ -18,7 +18,7 @@ Table of content: This Dockerfile provides instruction for building collect in isolated container. There are currently two variants of collectd container: - barometer-collectd - it is based on stable collect release - - barometer-collectd-master - development container that is based on + - barometer-collectd-latest - development container that is based on latest 'main' branch for collectd project. It contains all available collectd plugins and features that are available on 'main' branch but some issues with configuration or stability may occur @@ -46,22 +46,22 @@ sudo docker run -ti --net=host -v `pwd`/src/collectd/collectd_sample_configs:/op /opt/collectd/sbin/collectd -f ------------------------------------------------------------------------------ -4. INSTALLATION NOTES: barometer-collectd-master (development container) +4. INSTALLATION NOTES: barometer-collectd-latest (development container) -To build docker barometer-collectd-master container run (it is based on main branch from collectd): -sudo docker build -f ./docker/barometer-collectd-master/Dockerfile . +To build docker barometer-collectd-latest container run (it is based on main branch from collectd): +sudo docker build -f ./docker/barometer-collectd-latest/Dockerfile . from root barometer folder. To run builded image run sudo docker images # get docker image id -sudo docker run -ti --net=host -v `pwd`/src/collectd/collectd_sample_configs-master:/opt/collectd/etc/collectd.conf.d \ +sudo docker run -ti --net=host -v `pwd`/src/collectd/collectd_sample_configs-latest:/opt/collectd/etc/collectd.conf.d \ -v /var/run:/var/run -v /tmp:/tmp --privileged <image id> -NOTE: barometer-collectd-master container uses a different sample configurations files -compared to regular barometer-collectd container (src/collectd/collectd_sample_configs-master) +NOTE: barometer-collectd-latest container uses a different sample configurations files +compared to regular barometer-collectd container (src/collectd/collectd_sample_configs-latest) To make some changes run -sudo docker run -ti --net=host -v `pwd`/src/collectd/collectd_sample_configs-master:/opt/collectd/etc/collectd.conf.d \ +sudo docker run -ti --net=host -v `pwd`/src/collectd/collectd_sample_configs-latest:/opt/collectd/etc/collectd.conf.d \ -v /var/run:/var/run -v /tmp:/tmp --privileged --entrypoint=/bin/bash <image id> /opt/collectd/sbin/collectd -f diff --git a/docker/ansible/collectd6_test.yml b/docker/ansible/collectd6_test.yml new file mode 100644 index 00000000..c1a3a8b4 --- /dev/null +++ b/docker/ansible/collectd6_test.yml @@ -0,0 +1,143 @@ +--- +# ansible-playbook -e PR=<PRID> -e new_plugin=<plugin> collectd6_test.yml + +# As well as passing a PRID, a config command should be passable too since +# a lot of the plugins have been explicitly disabled in the build. +- hosts: localhost + become: true + tasks: + - name: Set names for containers to be used for testing + set_fact: + collectd5_container_name: "bar-collectd-latest" + collectd6_container_name: "bar-collectd-6{{ '-' + PR if PR is defined }}" + flask_container_name: "test-collectd-5-v-6" + + - name: Remove existing containers + docker_container: + name: "{{ item }}" + state: absent + force_kill: yes + with_items: + - "{{ collectd5_container_name }}" + - "{{ collectd6_container_name }}" + - "{{ flask_container_name }}" + + - name: Get a list of containers + command: + docker ps -a + register: output + + - name: Confirm that existing test containers were removed + assert: + that: + - 'not "{{ collectd5_container_name }}" in output.stdout' + - 'not "{{ collectd6_container_name }}" in output.stdout' + - 'not "{{ flask_container_name }}" in output.stdout' + + - name: Build collectd containers + include_role: + name: build_collectd + args: + apply: + tags: + - latest + - collectd-6 + - flask_test + vars: + COLLECTD_PULL_REQUESTS: "{{ PR | default() }}" + COLLECTD_CONFIG_CMD_ARGS: "{{ '--enable-' + new_plugin if new_plugin is defined }}" + + - name: "Set up config for write_http plugin" + set_fact: + collectd_plugins: "{{ collectd_plugins | default([]) | union(['write_http']) }}" + collectd_plugin_write_http_nodes: + flask: + url: http://localhost:5000 + format: "Command" + + - name: Generate collectd configs + include_role: + name: config_files + + # Since I can't skip-tags here, I have to remove the plugins later + # TODO(efoley) Add a disable_plugins and enable_plugins list to + # roles/config_files, as an alternative to tags. + # This alternative is kinda needed anyway, so that it's easier to add extra + # plugins instead of using. + # ``{{ collectd_plugins | default([]) | union(['the_plugin_i_want_to_enable'])}}`` + # Tags can stay, since they are convenient, and easier to pass to the + # command line than a list of plugins + - name: "Remove plugin configs" + file: + path: "/opt/collectd/etc/collectd.conf.d/{{ item }}.conf" + state: absent + with_items: + - snmp_agent + - intel_pmu + + # TODO(efoley): The path here should be parameterised, to a degree, I don't + # want it to be repeated. And I shouldn't assume that this is always going + # to be the value (unless it is in vars/main instead of defaults/main) + - name: "Remove plugin configs (collectd 6)" + file: + path: "/opt/collectd/etc/collectd.conf.d/{{ item }}.conf" + state: absent + with_items: + - csv + - network + - rrdtool + - write_kafka + - write_prometheus + - logfile + + - debug: + var: PR + + - name: Run the collectd-6 container + include_role: + name: run_collectd + vars: + collectd_image_name: "opnfv/barometer-collectd-6{{ '-' + PR if PR is defined }}" + collectd_container_name: "{{ collectd6_container_name }}" + + - name: Run the collectd-latest container + include_role: + name: run_collectd + vars: + collectd_image_name: opnfv/barometer-collectd-latest + collectd_container_name: "{{ collectd5_container_name }}" + + - name: Run the flask test container + docker_container: + name: "{{ flask_container_name }}" + image: test-collectd-write_http + detach: yes + state: started + #network_mode: host + published_ports: 5000:5000 + + - name: Check output for flask app + become: true + shell: | + docker logs {{ flask_container_name }} {{ '| grep "' + new_plugin + '"' if new_plugin is defined }} | tail -200 + register: output + + - debug: + var: output.stdout_lines + + - name: Get a list of running containers + become: true + command: + docker ps + register: output + + - name: Make sure that the expected containers are running + assert: + that: + - '"{{ collectd6_container_name }}" in output.stdout' + - '"{{ collectd5_container_name }}" in output.stdout' + - '"{{ flask_container_name }}" in output.stdout' + +# Create a small report at the end for collectd versions... +# Update Apply PRs to check out a branch when it is a single PR +# OR update these playbooks to use the tag way of checking out a PR diff --git a/docker/ansible/roles/config_files/templates/logfile.conf.j2 b/docker/ansible/collectd_build.yml index 8bc96ffe..d5cad076 100644 --- a/docker/ansible/roles/config_files/templates/logfile.conf.j2 +++ b/docker/ansible/collectd_build.yml @@ -1,4 +1,4 @@ -#Copyright 2018 OPNFV and Intel Corporation +# Copyright 2021 Anuket and others # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,12 +11,12 @@ # 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> - LogLevel "{{ logfile_log_level }}" - File "{{ logfile_dir }}/collectd.log" - Timestamp true -</Plugin> - +--- +# ansible-playbook collectd_build.yml +# +- hosts: localhost + become: true + become_user: root + gather_facts: true + roles: + - name: build_collectd diff --git a/docker/ansible/default.inv b/docker/ansible/default.inv index e254c26a..d65e1c0e 100644 --- a/docker/ansible/default.inv +++ b/docker/ansible/default.inv @@ -13,8 +13,8 @@ localhost [collectd_hosts:vars] install_mcelog=true insert_ipmi_modules=true -#to use master or experimental container set the collectd flavor below -#possible values: stable|master|experimental +#to use latest (collectd-main branch) or experimental (main + PRs) container +#set the collectd flavor below. Possible values: stable|latest|experimental flavor=stable [influxdb_hosts] diff --git a/docker/ansible/roles/build_collectd/tasks/main.yml b/docker/ansible/roles/build_collectd/tasks/main.yml new file mode 100644 index 00000000..6faddde5 --- /dev/null +++ b/docker/ansible/roles/build_collectd/tasks/main.yml @@ -0,0 +1,71 @@ +# Copyright 2021 Anuket and others +# +# 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. +--- +- name: Build stable container + docker_image: + name: anuket/barometer-collectd + build: + path: "{{ playbook_dir }}/../barometer-collectd/" + source: build + tags: + - stable + +- name: Build the latest container + docker_image: + name: anuket/barometer-collectd-latest + build: + path: "{{ playbook_dir }}/../../" + dockerfile: "docker/barometer-collectd-latest/Dockerfile" + source: build + tags: + - latest + +- name: Build collectd-experimental + docker_image: + name: anuket/barometer-collectd-experimental + build: + path: "{{ playbook_dir }}/../../" + dockerfile: "docker/barometer-collectd-experimental/Dockerfile" + args: + COLLECTD_FLAVOR: experimental + COLLECTD_TAG: "{{ COLLECTD_TAG | default('main') }}" + COLLECTD_PULL_REQUESTS: "{{ COLLECTD_PULL_REQUESTS | default() }}" + source: build + tags: + - experimental + +- name: Build collectd-6 + docker_image: + name: "anuket/barometer-collectd-6{{ ( '-' + COLLECTD_PULL_REQUESTS ) if COLLECTD_PULL_REQUESTS is defined else '' }}" + build: + path: "{{ playbook_dir }}/../../" + dockerfile: "docker/barometer-collectd-experimental/Dockerfile" + args: + COLLECTD_FLAVOR: collectd-6 + COLLECTD_TAG: "{{ COLLECTD_TAG | default('collectd-6.0') }}" + COLLECTD_CONFIG_CMD_ARGS: "{{ COLLECTD_CONFIG_CMD_ARGS if COLLECTD_CONFIG_CMD_ARGS is defined }}" + source: build + tags: + - collectd-6 + +- name: Build test_app for write_http + docker_image: + name: test-collectd-write_http + build: + path: "{{ playbook_dir }}/../flask_app/" + source: build + tags: + - flask_test + - never + diff --git a/docker/ansible/roles/config_files/defaults/main.yml b/docker/ansible/roles/config_files/defaults/main.yml new file mode 100644 index 00000000..c2004ae1 --- /dev/null +++ b/docker/ansible/roles/config_files/defaults/main.yml @@ -0,0 +1,60 @@ +# Copyright 2018-21 Anuket, Intel Corporation and others +# +# 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. +--- +config_file_dir: "/opt/collectd/etc/collectd.conf.d/" +csv_log_dir: "/var/lib/collectd/csv" +logfile_dir: "/var/log/" + +#global default interval +interval_value: 10 + +#influx network port +influx_network_port: 25826 + +#network plugin vars +network_port: 25826 +network_ip_addr: localhost + +#prometheus plugin vars +prometheus_port: 9103 + +#ovs event and stats plugin vars +ovs_events_interval: 1 +ovs_events_ip_addr: localhost +ovs_events_port: 6640 +ovs_stats_interval: 1 +ovs_stats_ip_addr: localhost +ovs_stats_port: 6640 + +#rdt plugin vars +rdt_interval: 1 + +#kafka plugin vars +kafka_ip_addr: localhost +kafka_port: 9092 +kafka_topic: collectd + +#logfile plugin vars +logfile_log_level: info + +#syslog plugin vars +syslog_log_level: info + +#rrd plugin vars +rrdtool_db_dir: "/var/lib/collectd/rrd" +cache_flush: 120 +write_per_sec: 50 + +#additional configuration files path +additional_configs_path: "" diff --git a/docker/ansible/roles/config_files/tasks/capabilities.yml b/docker/ansible/roles/config_files/tasks/capabilities.yml index 55672e83..cfca03a2 100644 --- a/docker/ansible/roles/config_files/tasks/capabilities.yml +++ b/docker/ansible/roles/config_files/tasks/capabilities.yml @@ -1,4 +1,4 @@ -#Copyright 2019 OPNFV and Intel Corporation +# Copyright 2019-21 Anuket, Intel Corporation and others # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,11 +14,8 @@ --- - name: enable capabilities plugin - template: - src: experimental/capabilities.conf.j2 - dest: "{{ config_file_dir }}/capabilities.conf" - when: flavor|default('stable')|string == 'experimental' + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['capabilities']) | unique }}" tags: - capabilities - diff --git a/docker/ansible/roles/config_files/tasks/csv.yml b/docker/ansible/roles/config_files/tasks/csv.yml index 0be4ec8f..bfd88c0e 100644 --- a/docker/ansible/roles/config_files/tasks/csv.yml +++ b/docker/ansible/roles/config_files/tasks/csv.yml @@ -1,4 +1,4 @@ -#Copyright 2018 OPNFV and Intel Corporation +# Copyright 2018-21 Anuket, Intel Corporation and others # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,9 +14,8 @@ --- - name: enable csv plugin - template: - src: csv.conf.j2 - dest: "{{ config_file_dir }}/csv.conf" + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['csv']) | unique }}" tags: - csv diff --git a/docker/ansible/roles/config_files/tasks/default_read_import.yml b/docker/ansible/roles/config_files/tasks/default_read_import.yml index d70919b3..46b4d516 100644 --- a/docker/ansible/roles/config_files/tasks/default_read_import.yml +++ b/docker/ansible/roles/config_files/tasks/default_read_import.yml @@ -1,4 +1,4 @@ -#Copyright 2018 OPNFV and Intel Corporation +# Copyright 2018-21 OPNFV, Intel Corporation and Red Hat # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,123 +12,107 @@ # See the License for the specific language governing permissions and # limitations under the License. --- - - name: enable contextswitch plugin - replace: - path: "{{ config_file_dir }}/default_read_plugins.conf" - regexp: '(\s+)#LoadPlugin contextswitch(\s+.*)?$' - replace: '\1LoadPlugin contextswitch\2' + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['contextswitch']) | unique }}" tags: + - en_default_all - contextswitch - name: enable cpu plugin - replace: - path: "{{ config_file_dir }}/default_read_plugins.conf" - regexp: '(\s+)#LoadPlugin cpu(\s+.*)?$' - replace: '\1LoadPlugin cpu\2' + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['cpu']) | unique }}" tags: + - en_default_all - cpu - name: enable cpufreq plugin - replace: - path: "{{ config_file_dir }}/default_read_plugins.conf" - regexp: '(\s+)#LoadPlugin cpufreq(\s+.*)?$' - replace: '\1LoadPlugin cpufreq\2' + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['cpufreq']) | unique }}" tags: + - en_default_all - cpufreq - name: enable df plugin - replace: - path: "{{ config_file_dir }}/default_read_plugins.conf" - regexp: '(\s+)#LoadPlugin df(\s+.*)?$' - replace: '\1LoadPlugin df\2' + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['df']) | unique }}" tags: + - en_default_all - df - name: enable disk plugin - replace: - path: "{{ config_file_dir }}/default_read_plugins.conf" - regexp: '(\s+)#LoadPlugin disk(\s+.*)?$' - replace: '\1LoadPlugin disk\2' + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['disk']) | unique }}" tags: + - en_default_all - disk - name: enable ethstat plugin - replace: - path: "{{ config_file_dir }}/default_read_plugins.conf" - regexp: '(\s+)#LoadPlugin ethstat(\s+.*)?$' - replace: '\1LoadPlugin ethstat\2' + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['ethstat']) | unique }}" tags: + - en_default_all - ethstat - name: enable ipc plugin - replace: - path: "{{ config_file_dir }}/default_read_plugins.conf" - regexp: '(\s+)#LoadPlugin ipc(\s+.*)?$' - replace: '\1LoadPlugin ipc\2' + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['ipc']) | unique }}" tags: + - en_default_all - ipc - name: enable irq plugin - replace: - path: "{{ config_file_dir }}/default_read_plugins.conf" - regexp: '(\s+)#LoadPlugin irq(\s+.*)?$' - replace: '\1LoadPlugin irq\2' + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['irq']) | unique }}" tags: + - en_default_all - irq - name: enable load plugin - replace: - path: "{{ config_file_dir }}/default_read_plugins.conf" - regexp: '(\s+)#LoadPlugin load(\s+.*)?$' - replace: '\1LoadPlugin load\2' + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['load']) | unique }}" tags: + - en_default_all - load - name: enable memory plugin - replace: - path: "{{ config_file_dir }}/default_read_plugins.conf" - regexp: '(\s+)#LoadPlugin memory(\s+.*)?$' - replace: '\1LoadPlugin memory\2' + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['memory']) | unique }}" tags: + - en_default_all - memory - name: enable numa plugin - replace: - path: "{{ config_file_dir }}/default_read_plugins.conf" - regexp: '(\s+)#LoadPlugin numa(\s+.*)?$' - replace: '\1LoadPlugin numa\2' + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['numa']) | unique }}" tags: + - en_default_all - numa - name: enable processes plugin - replace: - path: "{{ config_file_dir }}/default_read_plugins.conf" - regexp: '(\s+)#LoadPlugin processes(\s+.*)?$' - replace: '\1LoadPlugin processes\2' + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['processes']) | unique }}" tags: + - en_default_all - processes - name: enable swap plugin - replace: - path: "{{ config_file_dir }}/default_read_plugins.conf" - regexp: '(\s+)#LoadPlugin swap(\s+.*)?$' - replace: '\1LoadPlugin swap\2' + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['swap']) | unique }}" tags: + - en_default_all - swap - name: enable turbostat plugin - replace: - path: "{{ config_file_dir }}/default_read_plugins.conf" - regexp: '(\s+)#LoadPlugin turbostat(\s+.*)?$' - replace: '\1LoadPlugin turbostat\2' + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['turbostat']) | unique }}" tags: + - en_default_all - turbostat - name: enable uptime plugin - replace: - path: "{{ config_file_dir }}/default_read_plugins.conf" - regexp: '(\s+)#LoadPlugin uptime(\s+.*)?$' - replace: '\1LoadPlugin uptime\2' + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['uptime']) | unique }}" tags: + - en_default_all - uptime diff --git a/docker/ansible/roles/config_files/tasks/default_read_plugins.yml b/docker/ansible/roles/config_files/tasks/default_read_plugins.yml deleted file mode 100644 index 95b942c2..00000000 --- a/docker/ansible/roles/config_files/tasks/default_read_plugins.yml +++ /dev/null @@ -1,34 +0,0 @@ -#Copyright 2018 OPNFV and Intel Corporation -# -# 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. ---- - -- name: copy default template to system - template: - src: default_read_plugins.conf.j2 - dest: "{{ config_file_dir }}/default_read_plugins.conf" - tags: - - always - -- name: enable all default plugins - replace: - path: "{{ config_file_dir }}/default_read_plugins.conf" - regexp: '(\s+)#LoadPlugin(\s+.*)?$' - replace: '\1LoadPlugin\2' - register: en_default_all - tags: - - en_default_all - -- name: include per default plugin tasks - include: default_read_import.yml - when: en_default_all is not defined
\ No newline at end of file diff --git a/docker/ansible/roles/config_files/tasks/dpdk.yml b/docker/ansible/roles/config_files/tasks/dpdk.yml index 7809c56a..2be146b0 100644 --- a/docker/ansible/roles/config_files/tasks/dpdk.yml +++ b/docker/ansible/roles/config_files/tasks/dpdk.yml @@ -1,4 +1,4 @@ -#Copyright 2018 OPNFV and Intel Corporation +# Copyright 2018-21 Anuket, Intel Corporation and others # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,17 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. --- - -- name: enable dpdkstat plugin - template: - src: dpdkstat.conf.j2 - dest: "{{ config_file_dir }}/dpdkstat.conf" +- name: enable dpdk_telemetry plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['dpdk_telemetry']) | unique }}" tags: - - dpdkstat - -- name: enable dpdkevents plugin - template: - src: dpdkevents.conf.j2 - dest: "{{ config_file_dir }}/dpdkevents.conf" - tags: - - dpdkevents + - dpdk_telemetry diff --git a/docker/ansible/roles/config_files/tasks/exec.yml b/docker/ansible/roles/config_files/tasks/exec.yml index b7389703..956e3a8f 100644 --- a/docker/ansible/roles/config_files/tasks/exec.yml +++ b/docker/ansible/roles/config_files/tasks/exec.yml @@ -1,4 +1,4 @@ -#Copyright 2018 OPNFV and Intel Corporation +# Copyright 2018-21 Anuket, Intel Corporation and others # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,10 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. --- - - name: enable exec plugin - template: - src: exec.conf.j2 - dest: "{{ config_file_dir }}/exec.conf" + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['exec']) | unique }}" tags: - exec diff --git a/docker/ansible/roles/config_files/tasks/hugepages.yml b/docker/ansible/roles/config_files/tasks/hugepages.yml index bf49035c..5b4ec0ba 100644 --- a/docker/ansible/roles/config_files/tasks/hugepages.yml +++ b/docker/ansible/roles/config_files/tasks/hugepages.yml @@ -1,4 +1,4 @@ -#Copyright 2018 OPNFV and Intel Corporation +# Copyright 2018-21 Anuket, Intel Corporation and others # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -25,9 +25,8 @@ - hugepages - name: enable hugepages plugin - template: - src: hugepages.conf.j2 - dest: "{{ config_file_dir }}//hugepages.conf" - when: hugepages_result|succeeded + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['hugepages']) | unique }}" + when: hugepages_result is succeeded tags: - hugepages diff --git a/docker/ansible/roles/config_files/tasks/ipmi.yml b/docker/ansible/roles/config_files/tasks/ipmi.yml index c7359fbf..12913a85 100644 --- a/docker/ansible/roles/config_files/tasks/ipmi.yml +++ b/docker/ansible/roles/config_files/tasks/ipmi.yml @@ -1,4 +1,4 @@ -#Copyright 2018 OPNFV and Intel Corporation +# Copyright 2018-21 Anuket, Intel Corporation and others # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ command: "modprobe ipmi_devintf" register: ipmi_devintf ignore_errors: true - when: ipmi_devintf|failed and insert_ipmi_modules|default(false)|bool + when: (ipmi_devintf is failed) and (insert_ipmi_modules|default(false)|bool) tags: - ipmi @@ -39,7 +39,7 @@ command: "modprobe ipmi_si" register: ipmi_devsi ignore_errors: true - when: ipmi_devsi|failed and insert_ipmi_modules|default(false)|bool + when: (ipmi_devsi is failed) and (insert_ipmi_modules|default(false)|bool) tags: - ipmi @@ -52,10 +52,9 @@ - ipmi - name: enable ipmi plugin - template: - src: ipmi.conf.j2 - dest: "{{ config_file_dir }}/0_ipmi.conf" - when: ipmi0_exists|succeeded and ipmi_devintf|succeeded and ipmi_devsi|succeeded + set_fact: + collectd_plugins: '{{ collectd_plugins | union(["ipmi"]) | unique }}' + when: (ipmi0_exists is succeeded) and (ipmi_devintf is succeeded) and (ipmi_devsi is succeeded) tags: - ipmi diff --git a/docker/ansible/roles/config_files/tasks/kafka.yml b/docker/ansible/roles/config_files/tasks/kafka.yml index d7639cbf..6fb3f050 100644 --- a/docker/ansible/roles/config_files/tasks/kafka.yml +++ b/docker/ansible/roles/config_files/tasks/kafka.yml @@ -1,4 +1,4 @@ -#Copyright 2018 OPNFV and Intel Corporation +# Copyright 2018-21 Anuket, Intel Corporation and others # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,9 +13,8 @@ # limitations under the License. --- -- name: enable kafka plugin - template: - src: kafka.conf.j2 - dest: "{{ config_file_dir }}/kafka.conf" +- name: enable kafka plugin with collectd_config + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['write_kafka']) | unique }}" tags: - kafka diff --git a/docker/ansible/roles/config_files/tasks/logfile.yml b/docker/ansible/roles/config_files/tasks/logfile.yml index b2700594..cd1c1049 100644 --- a/docker/ansible/roles/config_files/tasks/logfile.yml +++ b/docker/ansible/roles/config_files/tasks/logfile.yml @@ -1,4 +1,4 @@ -#Copyright 2018 OPNFV and Intel Corporation +# Copyright 2018-21 Anuket, Intel Corporation and others # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,12 +14,8 @@ --- - name: enable logfile plugin - template: - src: logfile.conf.j2 - dest: "{{ config_file_dir }}/logfile.conf" + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['logfile']) | unique }}" tags: - logfile - - - diff --git a/docker/ansible/roles/config_files/tasks/logparser.yml b/docker/ansible/roles/config_files/tasks/logparser.yml index 615d2e2b..72adcea2 100644 --- a/docker/ansible/roles/config_files/tasks/logparser.yml +++ b/docker/ansible/roles/config_files/tasks/logparser.yml @@ -1,4 +1,4 @@ -#Copyright 2019 OPNFV and Intel Corporation +# Copyright 2019-21 Anuket, Intel Corporation, and others # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,9 +15,8 @@ - name: enable logparser plugin template: - src: experimental/logparser.conf.j2 + src: logparser.conf.j2 dest: "{{ config_file_dir }}/logparser.conf" - when: flavor|default('stable')|string == 'experimental' tags: - logparser diff --git a/docker/ansible/roles/config_files/tasks/main.yml b/docker/ansible/roles/config_files/tasks/main.yml index 3221242d..9b241890 100644 --- a/docker/ansible/roles/config_files/tasks/main.yml +++ b/docker/ansible/roles/config_files/tasks/main.yml @@ -1,4 +1,5 @@ -# Copyright 2018-2019 Intel Corporation and OPNFV. All rights reserved. +# Copyright 2018-2021 Intel Corporation, Anuket and others. +# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -37,7 +38,7 @@ import_tasks: csv.yml - name: enable default plugins - import_tasks: default_read_plugins.yml + import_tasks: default_read_import.yml - name: enable dpdk plugins import_tasks: dpdk.yml @@ -82,14 +83,59 @@ - name: enable syslog plugin import_tasks: syslog.yml +- name: enable ovs plugins + import_tasks: ovs.yml + - name: enable virt plugin import_tasks: virt.yml - name: enable ipmi plugin include: ipmi.yml +- name: Enable unixsock plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['unixsock']) | unique }}" + tags: + - unixsock + - name: enable uuid plugin include: uuid.yml +- name: configure plugins + include_role: + name: collectd_config + vars: + collectd_conf_output_dir: /tmp/collectd.conf.d + tags: + - always + - en_default_all + +- name: Copy the generated plugin configs + copy: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + with_items: + - { src: "/tmp/collectd.conf.d/", dest: "{{ config_file_dir }}" } + - { src: "/tmp/collectd.conf", dest: "{{ config_file_dir }}/../collectd.conf" } + tags: + - always + - en_default_all + +- name: Update TypesDB location + lineinfile: + path: "{{ config_file_dir }}../collectd.conf" + regexp: '^TypesDB "/usr/share/collectd/types.db"$' + line: 'TypesDB "/opt/collectd/share/collectd/types.db"' + +- name: Update config file location + lineinfile: + path: "{{ config_file_dir }}../collectd.conf" + regexp: "^(.*)/tmp/collectd.conf.d(.*)$" + line: '\1{{ config_file_dir }}\2' + backrefs: yes + tags: + - always + - en_default_all + - name: copy additional config files include: additional_configs.yml diff --git a/docker/ansible/roles/config_files/tasks/mcelog.yml b/docker/ansible/roles/config_files/tasks/mcelog.yml index 49bbec93..ac14f80c 100644 --- a/docker/ansible/roles/config_files/tasks/mcelog.yml +++ b/docker/ansible/roles/config_files/tasks/mcelog.yml @@ -33,7 +33,7 @@ - name: build mcelog from sources if not in package import_tasks: make_mcelog.yml - when: mcelog_present|failed and install_mcelog|default(false)|bool + when: (mcelog_present is failed) and (install_mcelog|default(false)|bool) tags: - mcelogs @@ -73,6 +73,6 @@ template: src: mcelog.conf.j2 dest: "{{ config_file_dir }}/mcelog.conf" - when: mcelog_running|succeeded and mcelog_exists|succeeded and mcelog_client_exists|succeeded + when: (mcelog_running is succeeded) and (mcelog_exists is succeeded) and (mcelog_client_exists is succeeded) tags: - - mcelogs + - mcelogs diff --git a/docker/ansible/roles/config_files/tasks/network.yml b/docker/ansible/roles/config_files/tasks/network.yml index 52902d4c..0af6a713 100644 --- a/docker/ansible/roles/config_files/tasks/network.yml +++ b/docker/ansible/roles/config_files/tasks/network.yml @@ -1,4 +1,4 @@ -#Copyright 2018 OPNFV and Intel Corporation +# Copyright 2018-21 Anuket, Intel Corporation and others # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,26 +14,24 @@ --- - name: Enable network plugin - template: - src: network.conf.j2 - dest: "{{ config_file_dir }}/network.conf" + set_fact: + collectd_plugins: '{{ collectd_plugins | union (["network"]) | unique }}' tags: - network - name: Add network port if defined - lineinfile: - dest: "{{ config_file_dir }}/network.conf" - insertafter: Plugin network - line: " Server \"{{ network_ip_addr }}\" \"{{ network_port }}\"" + set_fact: + collectd_plugin_network_server: "{{ collectd_plugin_network_server | default([]) | union([{ + 'name': network_ip_addr, + 'port': network_port, + }]) }}" when: network_ip_addr is defined tags: - network - name: Modify network.conf to add influxdb_hosts - lineinfile: - dest: "{{ config_file_dir }}/network.conf" - insertafter: Plugin network - line: " Server \"{{ item }}\" \"{{ influx_network_port }}\"" + set_fact: + collectd_plugin_network_server: "{{ collectd_plugin_network_server | default([]) | union([{ 'name': item, 'port': influx_network_port }]) }}" with_items: "{{ groups['influxdb_hosts'] }}" tags: - network diff --git a/docker/ansible/roles/config_files/tasks/ovs.yml b/docker/ansible/roles/config_files/tasks/ovs.yml new file mode 100644 index 00000000..fe3f0a13 --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/ovs.yml @@ -0,0 +1,53 @@ +# Copyright 2018-21 Anuket, Intel Corporation and others +# +# 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. +--- + +- name: Check if vswitchd is running + shell: ps -ef | grep vswitchd | grep -v grep > /dev/null + register: vswitchd_running + ignore_errors: True + tags: + - ovs_stats + - ovs_events + +- name: Check if db.sock exists + stat: + path: /var/run/openvswitch/db.sock + register: dbsock_exists + ignore_errors: True + tags: + - ovs_stats + - ovs_events + +- name: enable ovs_stats plugin + set_fact: + collectd_plugins: '{{ collectd_plugins | union(["ovs_stats"]) | unique }}' + collectd_plugin_ovs_stats_port: "{{ ovs_stats_port if ovs_stats_port is defined else omit }}" + collectd_plugin_ovs_stats_address: "{{ ovs_stats_ip_addr if ovs_stats_ip_addr is defined else omit }}" + collectd_plugin_ovs_stats_interval: "{{ ovs_stats_interval if ovs_stats_interval is defined else omit }}" + when: (vswitchd_running is succeeded) and (dbsock_exists is succeeded) + tags: + - ovs_stats + +- name: enable ovs_events plugin + set_fact: + collectd_plugins: '{{ collectd_plugins | union(["ovs_events"]) | unique }}' + collectd_plugin_ovs_events_interval: "{{ ovs_events_interval if ovs_events_interval is defined else omit }}" + collectd_plugin_ovs_events_address: "{{ ovs_events_ip_addr if ovs_events_ip_addr is defined else omit }}" + collectd_plugin_ovs_events_port: "{{ ovs_events_port if ovs_events_port is defined else omit }}" + when: (vswitchd_running is succeeded) and (dbsock_exists is succeeded) + tags: + - ovs_events + + diff --git a/docker/ansible/roles/config_files/tasks/pmu.yml b/docker/ansible/roles/config_files/tasks/pmu.yml index 20e3034c..c5820f98 100644 --- a/docker/ansible/roles/config_files/tasks/pmu.yml +++ b/docker/ansible/roles/config_files/tasks/pmu.yml @@ -1,4 +1,4 @@ -#Copyright 2018 OPNFV and Intel Corporation +# Copyright 2018-21 Anuket, Intel Corporation and others # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,8 +14,7 @@ --- - name: enable intel_pmu plugin - template: - src: intel_pmu.conf.j2 - dest: "{{ config_file_dir }}/intel_pmu.conf" + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['intel_pmu']) | unique }}" tags: - pmu diff --git a/docker/ansible/roles/config_files/tasks/prometheus.yml b/docker/ansible/roles/config_files/tasks/prometheus.yml index 51f2b1f6..c0e7e79d 100644 --- a/docker/ansible/roles/config_files/tasks/prometheus.yml +++ b/docker/ansible/roles/config_files/tasks/prometheus.yml @@ -1,4 +1,4 @@ -#Copyright 2018 OPNFV and Intel Corporation +# Copyright 2018-21 Anuket, Intel Corporation and others # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,8 +14,7 @@ --- - name: enable prometheus plugin - template: - src: prometheus.conf.j2 - dest: "{{ config_file_dir }}/prometheus.conf" + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['write_prometheus']) | unique }}" tags: - - prometheus
\ No newline at end of file + - prometheus diff --git a/docker/ansible/roles/config_files/tasks/rdt.yml b/docker/ansible/roles/config_files/tasks/rdt.yml index cbfa7de5..f0a46261 100644 --- a/docker/ansible/roles/config_files/tasks/rdt.yml +++ b/docker/ansible/roles/config_files/tasks/rdt.yml @@ -1,4 +1,4 @@ -#Copyright 2018 OPNFV and Intel Corporation +# Copyright 2018-21 Anuket, Intel Corporation and others # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -29,10 +29,9 @@ - rdt - name: enable rdt plugin - template: - src: rdt.conf.j2 - dest: "{{ config_file_dir }}/rdt.conf" - when: rdt_result|succeeded and virt_file.stat.exists == False + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['intel_rdt']) | unique }}" + when: (rdt_result is succeeded) and (virt_file.stat.exists == False) tags: - rdt diff --git a/docker/ansible/roles/config_files/tasks/snmp_agent.yml b/docker/ansible/roles/config_files/tasks/snmp_agent.yml index c72aee48..5e1ba975 100644 --- a/docker/ansible/roles/config_files/tasks/snmp_agent.yml +++ b/docker/ansible/roles/config_files/tasks/snmp_agent.yml @@ -21,9 +21,9 @@ tags: - snmp -- name: enable snmp agent for master container +- name: enable snmp agent for non-stable container template: - src: master/snmp_agent.conf.j2 + src: latest/snmp_agent.conf.j2 dest: "{{ config_file_dir }}/snmp_agent.conf" when: flavor|default('stable')|string != 'stable' tags: diff --git a/docker/ansible/roles/config_files/tasks/syslog.yml b/docker/ansible/roles/config_files/tasks/syslog.yml index 97864a5d..e9ab06f3 100644 --- a/docker/ansible/roles/config_files/tasks/syslog.yml +++ b/docker/ansible/roles/config_files/tasks/syslog.yml @@ -1,4 +1,4 @@ -#Copyright 2018 OPNFV and Intel Corporation +# Copyright 2018-21 Anuket, Intel Corporation and others # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,9 +14,8 @@ --- - name: enable syslog plugin - template: - src: syslog.conf.j2 - dest: "{{ config_file_dir }}/syslog.conf" + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['syslog']) | unique }}" tags: - syslog diff --git a/docker/ansible/roles/config_files/tasks/uuid.yml b/docker/ansible/roles/config_files/tasks/uuid.yml index 25cfa128..df669e1a 100644 --- a/docker/ansible/roles/config_files/tasks/uuid.yml +++ b/docker/ansible/roles/config_files/tasks/uuid.yml @@ -1,4 +1,4 @@ -#Copyright 2018 OPNFV and Intel Corporation +# Copyright 2018-21 Anuket, Intel Corporation and others # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,8 +14,7 @@ --- - name: enable uuid plugin - template: - src: uuid.conf.j2 - dest: "{{ config_file_dir }}/uuid.conf" + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['uuid']) | unique }}" tags: - uuid diff --git a/docker/ansible/roles/config_files/tasks/virt.yml b/docker/ansible/roles/config_files/tasks/virt.yml index 9db10e8c..75a17a18 100644 --- a/docker/ansible/roles/config_files/tasks/virt.yml +++ b/docker/ansible/roles/config_files/tasks/virt.yml @@ -1,4 +1,4 @@ -#Copyright 2018 OPNFV and Intel Corporation +# Copyright 2018-21 Anuket, Intel Corporation and others # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -21,16 +21,14 @@ - virt - name: (virt) check if rdt is enabled - stat: - path: "{{ config_file_dir }}/rdt.conf" - register: rdt_file + set_fact: + rdt_enabled: true tags: - - virt + - rdt - name: enable virt plugin - template: - src: virt.conf.j2 - dest: "{{ config_file_dir }}/virt.conf" - when: libvirt_result|succeeded and rdt_file.stat.exists == False + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['virt']) | unique }}" + when: libvirt_result is succeeded and not (rdt_enabled | default(false)) tags: - virt diff --git a/docker/ansible/roles/config_files/tasks/vswitch.yml b/docker/ansible/roles/config_files/tasks/vswitch.yml deleted file mode 100644 index baffc4bd..00000000 --- a/docker/ansible/roles/config_files/tasks/vswitch.yml +++ /dev/null @@ -1,49 +0,0 @@ -#Copyright 2018 OPNFV and Intel Corporation -# -# 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. ---- - -- name: Check if vswitchd is running - shell: ps -ef | grep vswitchd | grep -v grep > /dev/null - register: vswitchd_running - ignore_errors: True - tags: - - ovs_stats - - ovs_events - -- name: Check if db.sock exists - stat: - path: /var/run/openvswitch/db.sock - register: dbsock_exists - ignore_errors: True - tags: - - ovs_stats - - ovs_events - -- name: enable ovs_stats plugin - template: - src: "ovs_stats.conf.j2" - dest: "{{ config_file_dir }}/ovs_stats.conf" - when: vswitchd_running|succeeded and dbsock_exists|succeeded - tags: - - ovs_stats - -- name: enable ovs_events plugin - template: - src: "ovs_events.conf.j2" - dest: "{{ config_file_dir }}/ovs_events.conf" - when: vswitchd_running|succeeded and dbsock_exists|succeeded - tags: - - ovs_events - - diff --git a/docker/ansible/roles/config_files/templates/csv.conf.j2 b/docker/ansible/roles/config_files/templates/csv.conf.j2 deleted file mode 100644 index 3e351932..00000000 --- a/docker/ansible/roles/config_files/templates/csv.conf.j2 +++ /dev/null @@ -1,21 +0,0 @@ -#Copyright 2018 OPNFV and Intel Corporation -# -# 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 "{{ csv_log_dir }}" - StoreRates false -</Plugin> - diff --git a/docker/ansible/roles/config_files/templates/default_read_plugins.conf.j2 b/docker/ansible/roles/config_files/templates/default_read_plugins.conf.j2 deleted file mode 100644 index 48beb0be..00000000 --- a/docker/ansible/roles/config_files/templates/default_read_plugins.conf.j2 +++ /dev/null @@ -1,34 +0,0 @@ -#Copyright 2018 OPNFV and Intel Corporation -# -# 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 "{{ inventory_hostname }}" -Interval "{{ interval_value }}" - - -#LoadPlugin contextswitch -#LoadPlugin cpu -#LoadPlugin cpufreq -#LoadPlugin df -#LoadPlugin disk -#LoadPlugin ethstat -#LoadPlugin ipc -#LoadPlugin irq -#LoadPlugin load -#LoadPlugin memory -#LoadPlugin numa -#LoadPlugin processes -#LoadPlugin swap -#LoadPlugin turbostat -#LoadPlugin uptime - diff --git a/docker/ansible/roles/config_files/templates/dpdkevents.conf.j2 b/docker/ansible/roles/config_files/templates/dpdkevents.conf.j2 deleted file mode 100644 index 60bdb3e2..00000000 --- a/docker/ansible/roles/config_files/templates/dpdkevents.conf.j2 +++ /dev/null @@ -1,36 +0,0 @@ -#Copyright 2018 OPNFV and Intel Corporation -# -# 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 dpdkevents> - Interval 1 -</LoadPlugin> - -<Plugin "dpdkevents"> -# <EAL> -# Coremask "0x1" -# MemoryChannels "4" -# FilePrefix "rte" -# </EAL> - <Event "link_status"> - SendEventsOnUpdate false - EnabledPortMask 0xffff - SendNotification true - </Event> -# <Event "keep_alive"> -# SendEventsOnUpdate false -# LCoreMask "0xf" -# KeepAliveShmName "/dpdk_keepalive_shm_name" -# SendNotification true -# </Event> -</Plugin> diff --git a/docker/ansible/roles/config_files/templates/dpdkstat.conf.j2 b/docker/ansible/roles/config_files/templates/dpdkstat.conf.j2 deleted file mode 100644 index 738fb4d0..00000000 --- a/docker/ansible/roles/config_files/templates/dpdkstat.conf.j2 +++ /dev/null @@ -1,25 +0,0 @@ -#Copyright 2018 OPNFV and Intel Corporation -# -# 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 dpdkstat - -<Plugin dpdkstat> -# Coremask "0xf" -# ProcessType "secondary" -# FilePrefix "rte" - EnabledPortMask 0xffff -# PortName "interface1" -# PortName "interface2" -</Plugin> - diff --git a/docker/ansible/roles/config_files/templates/exec.conf.j2 b/docker/ansible/roles/config_files/templates/exec.conf.j2 deleted file mode 100644 index 2467606b..00000000 --- a/docker/ansible/roles/config_files/templates/exec.conf.j2 +++ /dev/null @@ -1,22 +0,0 @@ -#Copyright 2018 OPNFV and Intel Corporation -# -# 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 exec - -<Plugin exec> - # For OVS PMD stats plugin - Exec "collectd_exec" "/src/barometer/src/collectd/collectd_sample_configs/ovs_pmd_stats.sh" - NotificationExec "collectd_exec" "/src/barometer/src/collectd/collectd_sample_configs/write_notification.sh" -</Plugin> - diff --git a/docker/ansible/roles/config_files/templates/experimental/capabilities.conf.j2 b/docker/ansible/roles/config_files/templates/experimental/capabilities.conf.j2 deleted file mode 100644 index a422b702..00000000 --- a/docker/ansible/roles/config_files/templates/experimental/capabilities.conf.j2 +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2019 OPNFV and Intel Corporation -# -# 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 capabilities - -<Plugin capabilities> - Port "9564" -</Plugin> - diff --git a/docker/ansible/roles/config_files/templates/hugepages.conf.j2 b/docker/ansible/roles/config_files/templates/hugepages.conf.j2 deleted file mode 100644 index b391a398..00000000 --- a/docker/ansible/roles/config_files/templates/hugepages.conf.j2 +++ /dev/null @@ -1,24 +0,0 @@ -#Copyright 2018 OPNFV and Intel Corporation -# -# 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> - ReportPerNodeHP true - ReportRootHP true - ValuesPages true - ValuesBytes false - ValuesPercentage false -</Plugin> - diff --git a/docker/ansible/roles/config_files/templates/intel_pmu.conf.j2 b/docker/ansible/roles/config_files/templates/intel_pmu.conf.j2 deleted file mode 100644 index 564898da..00000000 --- a/docker/ansible/roles/config_files/templates/intel_pmu.conf.j2 +++ /dev/null @@ -1,25 +0,0 @@ -#Copyright 2018-2019 OPNFV and Intel Corporation -# -# 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" - Cores "[0-4]" -</Plugin> - diff --git a/docker/ansible/roles/config_files/templates/ipmi.conf.j2 b/docker/ansible/roles/config_files/templates/ipmi.conf.j2 deleted file mode 100644 index 54554d23..00000000 --- a/docker/ansible/roles/config_files/templates/ipmi.conf.j2 +++ /dev/null @@ -1,45 +0,0 @@ -#Copyright 2018 OPNFV and Intel Corporation -# -# 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 ipmi - -#<Plugin ipmi> -# <Instance "local"> -# Sensor "some_sensor" -# Sensor "another_one" -# IgnoreSelected false -# NotifySensorAdd false -# NotifySensorRemove true -# NotifySensorNotPresent false -# NotifyIPMIConnectionState false -# SELEnabled false -# SELClearEvent false -# </Instance> -# <Instance "remote"> -# Host "server.example.com" -# Address "1.2.3.4" -# Username "user" -# Password "secret" -# #AuthType "md5" -# Sensor "some_sensor" -# Sensor "another_one" -# IgnoreSelected false -# NotifySensorAdd false -# NotifySensorRemove true -# NotifySensorNotPresent false -# NotifyIPMIConnectionState false -# SELEnabled false -# SELClearEvent false -# </Instance> -#</Plugin> diff --git a/docker/ansible/roles/config_files/templates/kafka.conf.j2 b/docker/ansible/roles/config_files/templates/kafka.conf.j2 deleted file mode 100644 index 3e4bc242..00000000 --- a/docker/ansible/roles/config_files/templates/kafka.conf.j2 +++ /dev/null @@ -1,22 +0,0 @@ -#Copyright 2018 OPNFV and Intel Corporation -# -# 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 write_kafka - -<Plugin write_kafka> - Property "metadata.broker.list" "{{ kafka_ip_addr }}:{{ kafka_port }}" - <Topic "{{ kafka_topic }}"> - Format JSON - </Topic> -</Plugin> diff --git a/docker/ansible/roles/config_files/templates/master/snmp_agent.conf.j2 b/docker/ansible/roles/config_files/templates/latest/snmp_agent.conf.j2 index 1ff8b228..1ff8b228 100644 --- a/docker/ansible/roles/config_files/templates/master/snmp_agent.conf.j2 +++ b/docker/ansible/roles/config_files/templates/latest/snmp_agent.conf.j2 diff --git a/docker/ansible/roles/config_files/templates/experimental/logparser.conf.j2 b/docker/ansible/roles/config_files/templates/logparser.conf.j2 index 1f1a725b..1f1a725b 100644 --- a/docker/ansible/roles/config_files/templates/experimental/logparser.conf.j2 +++ b/docker/ansible/roles/config_files/templates/logparser.conf.j2 diff --git a/docker/ansible/roles/config_files/templates/ovs_events.conf.j2 b/docker/ansible/roles/config_files/templates/ovs_events.conf.j2 deleted file mode 100644 index 4fbea5ad..00000000 --- a/docker/ansible/roles/config_files/templates/ovs_events.conf.j2 +++ /dev/null @@ -1,26 +0,0 @@ -#Copyright 2018 OPNFV and Intel Corporation -# -# 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 "{{ ovs_events_interval }}" -</LoadPlugin> - -<Plugin ovs_events> -# Port "{{ ovs_event_port }}" -# Address "{{ ovs_event_ip_addr }}" -# Socket "/var/run/openvswitch/db.sock" -# Interfaces "br0" "veth0" - SendNotification true - DispatchValues true -</Plugin> diff --git a/docker/ansible/roles/config_files/templates/ovs_stats.conf.j2 b/docker/ansible/roles/config_files/templates/ovs_stats.conf.j2 deleted file mode 100644 index fc26e4b8..00000000 --- a/docker/ansible/roles/config_files/templates/ovs_stats.conf.j2 +++ /dev/null @@ -1,25 +0,0 @@ -#Copyright 2018 OPNFV and Intel Corporation -# -# 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 "{{ ovs_stats_interval }}" -</LoadPlugin> - -<Plugin ovs_stats> -# Port "{{ ovs_stats_port }}" -# Address "{{ ovs_stats_ip_addr }}" -# Socket "/var/run/openvswitch/db.sock" -# Bridges "br0" "br_ext" -</Plugin> - diff --git a/docker/ansible/roles/config_files/templates/prometheus.conf.j2 b/docker/ansible/roles/config_files/templates/prometheus.conf.j2 deleted file mode 100644 index bb947867..00000000 --- a/docker/ansible/roles/config_files/templates/prometheus.conf.j2 +++ /dev/null @@ -1,19 +0,0 @@ -#Copyright 2018 OPNFV and Intel Corporation -# -# 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 write_prometheus - -<Plugin "write_prometheus"> - Port "{{ prometheus_port }}" -</Plugin> diff --git a/docker/ansible/roles/config_files/templates/rdt.conf.j2 b/docker/ansible/roles/config_files/templates/rdt.conf.j2 deleted file mode 100644 index 0e1afcfc..00000000 --- a/docker/ansible/roles/config_files/templates/rdt.conf.j2 +++ /dev/null @@ -1,22 +0,0 @@ -#Copyright 2018 OPNFV and Intel Corporation -# -# 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 {{ rdt_interval }} -</LoadPlugin> - -<Plugin intel_rdt> - Cores "" -</Plugin> - diff --git a/docker/ansible/roles/config_files/templates/syslog.conf.j2 b/docker/ansible/roles/config_files/templates/syslog.conf.j2 deleted file mode 100644 index f9d77814..00000000 --- a/docker/ansible/roles/config_files/templates/syslog.conf.j2 +++ /dev/null @@ -1,21 +0,0 @@ -#Copyright 2018 OPNFV and Intel Corporation -# -# 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 syslog - -# Decrease syslog verbosity, to avoid duplicate logging -<Plugin syslog> - LogLevel "{{ syslog_log_level }}" -</Plugin> - diff --git a/docker/ansible/roles/config_files/templates/uuid.conf.j2 b/docker/ansible/roles/config_files/templates/uuid.conf.j2 deleted file mode 100644 index a9a84e71..00000000 --- a/docker/ansible/roles/config_files/templates/uuid.conf.j2 +++ /dev/null @@ -1,20 +0,0 @@ -#Copyright 2018 OPNFV and Intel Corporation -# -# 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 uuid - -#<Plugin uuid> -# UUIDFile "/etc/uuid" -#</Plugin> - diff --git a/docker/ansible/roles/config_files/templates/virt.conf.j2 b/docker/ansible/roles/config_files/templates/virt.conf.j2 deleted file mode 100644 index f1ba324d..00000000 --- a/docker/ansible/roles/config_files/templates/virt.conf.j2 +++ /dev/null @@ -1,32 +0,0 @@ -#Copyright 2018 OPNFV and Intel Corporation -# -# 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/docker/ansible/roles/config_files/vars/main.yml b/docker/ansible/roles/config_files/vars/main.yml index f12492a3..02fd7fb9 100644 --- a/docker/ansible/roles/config_files/vars/main.yml +++ b/docker/ansible/roles/config_files/vars/main.yml @@ -1,4 +1,4 @@ -#Copyright 2018 OPNFV and Intel Corporation +# Copyright 2018-21 Anuket, Intel Corporation and others # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,51 +12,56 @@ # See the License for the specific language governing permissions and # limitations under the License. --- +collectd_plugins: [] +collectd_interval: "{{ interval_value }}" +collectd_hostname: "{{ inventory_hostname }}" -#directory paths -config_file_dir: "/opt/collectd/etc/collectd.conf.d/" -csv_log_dir: "/var/lib/collectd/csv" -logfile_dir: "/var/log/" +collectd_plugin_capabilities_port: "9564" -#global default interval -interval_value: 10 +collectd_plugin_cpu_valuespercentage: False +collectd_plugin_cpu_reportbystate: True -#influx network port -influx_network_port: 25826 +collectd_plugin_csv_datadir: "{{ csv_log_dir }}" +collectd_plugin_csv_storerates: False -#network plugin vars -#network_port: 25826 -#network_ip_addr: localhost +collectd_plugin_dpdk_telemetry_client_socket_path: "/var/run/.client" +collectd_plugin_dpdk_telemetry_dpdk_socket_path: "/var/run/dpdk/rte/telemetry" -#prometheus plugin vars -prometheus_port: 9103 +collectd_plugin_exec_exec: + - user: "collectd_exec" + exec: "/src/barometer/src/collectd/collectd_sample_configs/ovs_pmd_stats.sh" +collectd_plugin_exec_notification: + - user: "collectd_exec" + notification_exec: "/src/barometer/src/collectd/collectd_sample_configs/write_notification.sh" -#ovs event and stats plugin vars -ovs_event_interval: 1 -ovs_event_ip_addr: localhost -ovs_event_port: 6640 -ovs_stats_interval: 1 -ovs_stats_ip_addr: localhost -ovs_stats_port: 6640 +collectd_plugin_hugepages_report_per_node_hp: True +collectd_plugin_hugepages_report_root_hp: True +collectd_plugin_hugepages_values_pages: True +collectd_plugin_hugepages_values_bytes: False +collectd_plugin_hugepages_values_percentage: False -#rdt plugin vars -rdt_interval: 1 +collectd_plugin_intel_pmu_report_hardware_cache_events: True +collectd_plugin_intel_pmu_report_kernel_pmu_events: True +collectd_plugin_intel_pmu_report_software_events: True +collectd_plugin_intel_pmu_cores: ["0-4"] -#kafka plugin vars -kafka_ip_addr: localhost -kafka_port: 9092 -kafka_topic: collectd +collectd_plugin_intel_rdt_cores: [""] +collectd_plugin_intel_rdt_interval: "{{ rdt_interval }}" -#logfile plugin vars -logfile_log_level: info +collectd_plugin_logfile_loglevel: "{{ logfile_log_level }}" +collectd_plugin_logfile_file: "{{ logfile_dir }}/collectd.log" +collectd_plugin_logfile_timestamp: True -#syslog plugin vars -syslog_log_level: info +collectd_plugin_ovs_events_dispatch_values: True +collectd_plugin_ovs_events_send_notification: True -#rrd plugin vars -rrdtool_db_dir: "/var/lib/collectd/rrd" -cache_flush: 120 -write_per_sec: 50 +collectd_plugin_virt_extra_stats: "cpu_util disk disk_err domain_state fs_info job_stats_background pcpu perf vcpupin" +collectd_plugin_virt_refresh_interval: 60 -#additional configuration files path -additional_configs_path: "" +collectd_plugin_write_kafka_hosts: + - "{{ kafka_ip_addr }}:{{ kafka_port }}" +collectd_plugin_write_kafka_topics: '{{ { kafka_topic: { "format": "JSON" }} }}' + +collectd_plugin_write_prometheus_port: "{{ prometheus_port }}" + +collectd_plugin_syslog_loglevel: "{{ syslog_log_level }}" diff --git a/docker/ansible/roles/install_docker/tasks/fedora.yml b/docker/ansible/roles/install_docker/tasks/fedora.yml index 56eebd59..f2a4f403 100644 --- a/docker/ansible/roles/install_docker/tasks/fedora.yml +++ b/docker/ansible/roles/install_docker/tasks/fedora.yml @@ -24,7 +24,7 @@ packages: - python3-dnf - python3 - - libselinux-python + - python3-libselinux - name: set up docker repository command: "dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo && dnf makecache" diff --git a/docker/ansible/roles/run_collectd/tasks/main.yml b/docker/ansible/roles/run_collectd/tasks/main.yml index 8fc27342..bf5aabf5 100644 --- a/docker/ansible/roles/run_collectd/tasks/main.yml +++ b/docker/ansible/roles/run_collectd/tasks/main.yml @@ -1,4 +1,4 @@ -#Copyright 2018-2019 OPNFV and Intel Corporation +# Copyright 2018-21 Anuket, Intel Corporation and others # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ - name: remove bar-collectd container docker_container: - name: bar-collectd + name: "{{ collectd_container_name }}" state: absent tags: - rm_containers @@ -40,7 +40,7 @@ set_fact: volumes_list: - - /opt/collectd/etc/collectd.conf.d/:/opt/collectd/etc/collectd.conf.d + - /opt/collectd/etc/:/opt/collectd/etc/ - /var/run:/var/run - /tmp:/tmp - /var/lib/collectd:/var/lib/collectd @@ -52,10 +52,10 @@ - name: launch collectd container docker_container: - name: bar-collectd + name: "{{ collectd_container_name }}" image: "{{ collectd_image_name }}" volumes: "{{ volumes_list }}" - command: "/run_collectd.sh" + entrypoint: "/run_collectd.sh" detach: yes state: started restart: yes diff --git a/docker/ansible/roles/run_collectd/vars/main.yml b/docker/ansible/roles/run_collectd/vars/main.yml index cebd0f47..26007ecf 100644 --- a/docker/ansible/roles/run_collectd/vars/main.yml +++ b/docker/ansible/roles/run_collectd/vars/main.yml @@ -1,4 +1,4 @@ -#Copyright 2019 OPNFV and Intel Corporation +# Copyright 2019-21 Anuket, Intel Corporation and others # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,9 +13,11 @@ # limitations under the License. --- +collectd_container_name: "bar-collectd" default_flavor: "{{ flavor|default('stable')|string }}" flavor_image_name: "{{ - 'barometer-collectd-master' if (default_flavor == 'master') else - 'barometer-collectd-experimental' if (default_flavor == 'experimental') + 'barometer-collectd-latest' if (default_flavor == 'master' or default_flavor == 'latest') else + 'barometer-collectd-experimental' if (default_flavor == 'experimental') else + 'barometer-collectd-6' if (default_flavor == 'collectd-6') else 'barometer-collectd' }}" -collectd_image_name: "{{ 'opnfv/' + flavor_image_name }}" +collectd_image_name: "{{ 'anuket/' + flavor_image_name }}" diff --git a/docker/ansible/roles/run_grafana/tasks/main.yml b/docker/ansible/roles/run_grafana/tasks/main.yml index 0ec307fa..d4a1638c 100644 --- a/docker/ansible/roles/run_grafana/tasks/main.yml +++ b/docker/ansible/roles/run_grafana/tasks/main.yml @@ -1,4 +1,4 @@ -#Copyright 2018 OPNFV and Intel Corporation +# Copyright 2018-21 Anuket, Intel Corporation and others # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ - name: Remove barometer-grafana image docker_image: state: absent - name: opnfv/barometer-grafana + name: anuket/barometer-grafana tags: - rm_images - rm_grafana_image @@ -40,7 +40,7 @@ - name: launch barometer-grafana container docker_container: name: bar-grafana - image: opnfv/barometer-grafana + image: anuket/barometer-grafana volumes: - /var/lib/grafana:/var/lib/grafana ports: diff --git a/docker/ansible/roles/run_influxdb/tasks/main.yml b/docker/ansible/roles/run_influxdb/tasks/main.yml index 53187fae..02eeb788 100644 --- a/docker/ansible/roles/run_influxdb/tasks/main.yml +++ b/docker/ansible/roles/run_influxdb/tasks/main.yml @@ -1,4 +1,4 @@ -#Copyright 2018 OPNFV and Intel Corporation +# Copyright 2018-21 Anuket, Intel Corporation and others # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -22,9 +22,9 @@ - rm_influxdb_cont when: rm_containers|default(false)|bool == true -- name: Remove opnfv/barometer-influxdb image +- name: Remove barometer-influxdb image docker_image: - name: opnfv/barometer-influxdb + name: anuket/barometer-influxdb state: absent tags: - rm_images @@ -34,7 +34,7 @@ - name: launch barometer-influxdb container docker_container: name: bar-influxdb - image: opnfv/barometer-influxdb + image: anuket/barometer-influxdb volumes: - /var/lib/influxdb:/var/lib/influxdb exposed: diff --git a/docker/ansible/roles/run_kafka/tasks/main.yml b/docker/ansible/roles/run_kafka/tasks/main.yml index 34d1f910..f30acd89 100644 --- a/docker/ansible/roles/run_kafka/tasks/main.yml +++ b/docker/ansible/roles/run_kafka/tasks/main.yml @@ -1,4 +1,4 @@ -#Copyright 2018 OPNFV and Intel Corporation +# Copyright 2018-21 Anuket, Intel Corporation and others # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -22,19 +22,19 @@ - remove_bar-kafka when: rm_containers|default(false)|bool == true -- name: Remove opnfv/barometer-kafka image +- name: Remove anuket/barometer-kafka image docker_image: - name: opnfv/barometer-kafka + name: anuket/barometer-kafka state: absent tags: - remove_images - remove_kafka_image when: rm_images|default(false)|bool == true -- name: launch opnfv/barometer-kafka container +- name: launch anuket/barometer-kafka container docker_container: name: bar-kafka - image: opnfv/barometer-kafka + image: anuket/barometer-kafka env: zookeeper_node: "{{ zookeeper_hostname }}" broker_id: "{{ broker_id }}" diff --git a/docker/ansible/roles/run_ves/tasks/main.yml b/docker/ansible/roles/run_ves/tasks/main.yml index aa9c29d3..a203fa98 100644 --- a/docker/ansible/roles/run_ves/tasks/main.yml +++ b/docker/ansible/roles/run_ves/tasks/main.yml @@ -1,4 +1,4 @@ -#Copyright 2018 OPNFV and Intel Corporation +# Copyright 2018-21 Anuket, Intel Corporation and others # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -22,19 +22,19 @@ - remove_bar-ves when: rm_containers|default(false)|bool == true -- name: Remove opnfv/barometer-ves image +- name: Remove anuket/barometer-ves image docker_image: state: absent - name: opnfv/barometer-ves + name: anuket/barometer-ves tags: - remove_images - remove_ves_image when: rm_images|default(false)|bool == true -- name: launch opnfv/barometer-ves container +- name: launch anuket/barometer-ves container docker_container: name: bar-ves - image: opnfv/barometer-ves + image: anuket/barometer-ves detach: yes state: started restart: yes diff --git a/docker/barometer-collectd-experimental/Dockerfile b/docker/barometer-collectd-experimental/Dockerfile index 49016d9b..f051ef35 100644 --- a/docker/barometer-collectd-experimental/Dockerfile +++ b/docker/barometer-collectd-experimental/Dockerfile @@ -1,4 +1,5 @@ -# Copyright 2017-2019 Intel Corporation and OPNFV. All rights reserved. +# Copyright 2017-2021 Intel Corporation, Anuket and others. +# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,40 +14,41 @@ # limitations under the License. # -FROM centos:7 -RUN yum update -y && \ - yum install -y which sudo git && \ - yum clean all && \ - git config --global http.sslVerify false +FROM quay.io/centos/centos:stream8 as builder + +ARG COLLECTD_FLAVOR=experimental +ARG COLLECTD_PULL_REQUESTS +ARG COLLECTD_CONFIG_CMD_ARGS +ARG COLLECTD_TAG +ARG WITH_DPDK=n ENV DOCKER y -ENV COLLECTD_FLAVOR experimental -ENV WITH_DPDK y ENV repos_dir /src -ENV openstack_plugins /src/barometer/src/collectd-openstack-plugins -WORKDIR ${repos_dir} RUN mkdir -p ${repos_dir}/barometer COPY . ${repos_dir}/barometer -COPY docker/barometer-collectd-experimental/collectd_apply_pull_request.sh \ - ${repos_dir}/barometer/src/collectd/ - -# copying additional experimental configs on top of configs for 'main' -# branch release -COPY docker/barometer-collectd-experimental/experimental-configs/* \ - ${repos_dir}/barometer/src/collectd/collectd_sample_configs-master/ WORKDIR ${repos_dir}/barometer/systems -RUN sh ./build_base_machine.sh && \ - useradd -ms /bin/bash collectd_exec && \ - echo "collectd_exec ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers +RUN ./build_base_machine.sh && \ + dnf clean all && rm -rf /var/cache/dnf -WORKDIR ${openstack_plugins} -RUN make && \ - pip install --upgrade pip && \ - pip install -r ${openstack_plugins}/collectd-openstack-plugins/requirements.txt +FROM quay.io/centos/centos:stream8 COPY docker/barometer-collectd-experimental/run_collectd.sh /run_collectd.sh RUN chmod +x /run_collectd.sh +RUN useradd -ms /bin/bash collectd_exec && \ + echo "collectd_exec ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers + +COPY --from=builder /opt/collectd /opt/collectd +COPY --from=builder /usr/local/src /usr/local/src +COPY --from=builder /usr/share/snmp/mibs /usr/share/snmp/mibs +COPY --from=builder /opt/collectd/share/collectd/types.db /usr/share/collectd/types.db + +RUN dnf install -y 'dnf-command(builddep)' centos-release-opstools && \ + dnf config-manager --set-enabled powertools && \ + dnf builddep -y https://raw.githubusercontent.com/centos-opstools/collectd/master/collectd.spec && \ + dnf install -y jansson && \ + dnf clean all && rm -rf /var/cache/dnf + ENTRYPOINT ["/run_collectd.sh"] diff --git a/docker/barometer-collectd-experimental/collectd_apply_pull_request.sh b/docker/barometer-collectd-experimental/collectd_apply_pull_request.sh deleted file mode 100755 index 45a2a2cd..00000000 --- a/docker/barometer-collectd-experimental/collectd_apply_pull_request.sh +++ /dev/null @@ -1,41 +0,0 @@ -#! /bin/bash -# Copyright 2019 Intel Corporation and OPNFV. All rights reserved. -# -# 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. -# - -# This files contains list of pull requests to be applied on top -# of main branch before building collectd included in docker -# collectd-experimental container - -# Space/newline separated list of pull requests IDs -# for example: -# PULL_REQUESTS=(3027 #reimplement delay rate -# 3028 #other PR -# ) - -PULL_REQUESTS=( - 3045 #logparser - 3292 #capabilities plugin - #insert another PR ID here - ) - -# during rebasing/merging git requires email & name to be set -git config user.email "barometer-experimental@container" -git config user.name "BarometerExperimental" - -for PR_ID in "${PULL_REQUESTS[@]}" -do - echo "Applying pull request $PR_ID" - git pull --rebase origin pull/$PR_ID/head -done diff --git a/docker/barometer-collectd-experimental/experimental-configs/README b/docker/barometer-collectd-experimental/experimental-configs/README deleted file mode 100644 index e4386358..00000000 --- a/docker/barometer-collectd-experimental/experimental-configs/README +++ /dev/null @@ -1 +0,0 @@ -Place here configuration files that are required by experimental pull requests diff --git a/docker/barometer-collectd-experimental/experimental-configs/capabilities.conf b/docker/barometer-collectd-experimental/experimental-configs/capabilities.conf deleted file mode 100644 index a422b702..00000000 --- a/docker/barometer-collectd-experimental/experimental-configs/capabilities.conf +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2019 OPNFV and Intel Corporation -# -# 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 capabilities - -<Plugin capabilities> - Port "9564" -</Plugin> - diff --git a/docker/barometer-collectd-experimental/experimental-configs/logparser.conf b/docker/barometer-collectd-experimental/experimental-configs/logparser.conf deleted file mode 100644 index 1f1a725b..00000000 --- a/docker/barometer-collectd-experimental/experimental-configs/logparser.conf +++ /dev/null @@ -1,75 +0,0 @@ -# Copyright 2019 Intel Corporation and OPNFV. All rights reserved. -# -# 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 logparser - -<Plugin logparser> - <Logfile "/var/log/syslog"> - FirstFullRead false - <Message "pcie_errors"> - DefaultType "pcie_error" - DefaultSeverity "warning" - <Match "aer error"> - Regex "AER:.*error received" - SubmatchIdx -1 - </Match> - <Match "incident time"> - Regex "(... .. ..:..:..) .* pcieport.*AER" - SubmatchIdx 1 - IsMandatory false - </Match> - <Match "root port"> - Regex "pcieport (.*): AER:" - SubmatchIdx 1 - IsMandatory true - </Match> - <Match "device"> - PluginInstance true - Regex " ([0-9a-fA-F:\\.]*): PCIe Bus Error" - SubmatchIdx 1 - IsMandatory false - </Match> - <Match "severity_mandatory"> - Regex "severity=" - SubMatchIdx -1 - </Match> - <Match "nonfatal"> - Regex "severity=.*\\([nN]on-[fF]atal" - TypeInstance "non_fatal" - IsMandatory false - </Match> - <Match "fatal"> - Regex "severity=.*\\([fF]atal" - Severity "failure" - TypeInstance "fatal" - IsMandatory false - </Match> - <Match "corrected"> - Regex "severity=Corrected" - TypeInstance "correctable" - IsMandatory false - </Match> - <Match "error type"> - Regex "type=(.*)," - SubmatchIdx 1 - IsMandatory false - </Match> - <Match "id"> - Regex ", id=(.*)" - SubmatchIdx 1 - </Match> - </Message> - </Logfile> -</Plugin> diff --git a/docker/barometer-collectd-master/Dockerfile b/docker/barometer-collectd-latest/Dockerfile index 9637a486..4b6dfefb 100644 --- a/docker/barometer-collectd-master/Dockerfile +++ b/docker/barometer-collectd-latest/Dockerfile @@ -1,4 +1,5 @@ -# Copyright 2017-2019 Intel Corporation and OPNFV. All rights reserved. +# Copyright 2017-2021 Intel Corporation, Anuket and others. +# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,33 +14,23 @@ # limitations under the License. # -FROM centos:7 -RUN yum update -y && \ - yum install -y which sudo git && \ - yum clean all && \ - git config --global http.sslVerify false +FROM quay.io/centos/centos:stream8 +ARG COLLECTD_FLAVOR=latest +ARG WITH_DPDK=y ENV DOCKER y -ENV COLLECTD_FLAVOR master -ENV WITH_DPDK y ENV repos_dir /src -ENV openstack_plugins /src/barometer/src/collectd-openstack-plugins -WORKDIR ${repos_dir} RUN mkdir -p ${repos_dir}/barometer COPY . ${repos_dir}/barometer WORKDIR ${repos_dir}/barometer/systems RUN sh ./build_base_machine.sh && \ + dnf clean all && rm -rf /var/cache/dnf && \ useradd -ms /bin/bash collectd_exec && \ echo "collectd_exec ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers -WORKDIR ${openstack_plugins} -RUN make && \ - pip install --upgrade pip && \ - pip install -r ${openstack_plugins}/collectd-openstack-plugins/requirements.txt - -COPY docker/barometer-collectd-master/run_collectd.sh /run_collectd.sh +COPY docker/barometer-collectd-latest/run_collectd.sh /run_collectd.sh RUN chmod +x /run_collectd.sh ENTRYPOINT ["/run_collectd.sh"] diff --git a/docker/barometer-collectd-master/run_collectd.sh b/docker/barometer-collectd-latest/run_collectd.sh index 5920248a..5920248a 100644 --- a/docker/barometer-collectd-master/run_collectd.sh +++ b/docker/barometer-collectd-latest/run_collectd.sh diff --git a/docker/barometer-collectd/Dockerfile b/docker/barometer-collectd/Dockerfile index 8de66c69..db155572 100644 --- a/docker/barometer-collectd/Dockerfile +++ b/docker/barometer-collectd/Dockerfile @@ -1,4 +1,5 @@ -# Copyright 2017-2019 Intel Corporation and OPNFV. All rights reserved. +# Copyright 2017-2021 Intel Corporation, Anuket and others. +# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,30 +14,27 @@ # limitations under the License. # -FROM centos:7 -RUN yum update -y && \ - yum install -y which sudo git && \ - yum clean all && \ +FROM quay.io/centos/centos:stream8 +RUN dnf update -y && \ + dnf install -y which sudo git-core && \ + dnf clean all && \ git config --global http.sslVerify false ENV DOCKER y ENV WITH_DPDK y ENV COLLECTD_FLAVOR stable ENV repos_dir /src -ENV openstack_plugins /src/barometer/src/collectd-openstack-plugins WORKDIR ${repos_dir} RUN git clone https://gerrit.opnfv.org/gerrit/barometer + WORKDIR ${repos_dir}/barometer/systems RUN sh ./build_base_machine.sh && \ + dnf clean all && rm -rf /var/cache/dnf && \ + cd ${repos_dir}/ && rm -rf barometer && \ useradd -ms /bin/bash collectd_exec && \ echo "collectd_exec ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers -WORKDIR ${openstack_plugins} -RUN make && \ - pip install --upgrade pip && \ - pip install -r ${openstack_plugins}/collectd-openstack-plugins/requirements.txt - COPY run_collectd.sh /run_collectd.sh RUN chmod +x /run_collectd.sh diff --git a/docker/barometer-grafana/dashboards/cpu_usage_dashboard.json b/docker/barometer-grafana/dashboards/cpu_usage_dashboard.json index 0b8ab73e..bab2742d 100644 --- a/docker/barometer-grafana/dashboards/cpu_usage_dashboard.json +++ b/docker/barometer-grafana/dashboards/cpu_usage_dashboard.json @@ -582,7 +582,7 @@ "measurement": "cpu_value", "orderByTime": "ASC", "policy": "default", - "query": "select derivative(mean(value),1s) AS idle from \"cpu_value\" WHERE \"type\" = 'cpu' AND \"host\" =~ /^$host$/ AND $timeFilter GROUP BY time($interval), instance, type_instance fill(null)", + "query": "select derivative(mean(value),1s) AS idle from \"cpu_value\" WHERE \"host\" =~ /^$host$/ AND $timeFilter GROUP BY time($interval), instance, type_instance fill(null)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", @@ -710,7 +710,7 @@ "measurement": "cpu_value", "orderByTime": "ASC", "policy": "default", - "query": "SELECT mean(\"value\") FROM \"cpu_value\" WHERE (\"host\" =~ /^$host$/ AND \"type\" = 'cpu' AND \"type_instance\" != 'idle') AND $timeFilter GROUP BY time($__interval), \"instance\", \"type_instance\" fill(none)", + "query": "SELECT mean(\"value\") FROM \"cpu_value\" WHERE (\"host\" =~ /^$host$/ AND \"type_instance\" != 'idle') AND $timeFilter GROUP BY time($__interval), \"instance\", \"type_instance\" fill(none)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", diff --git a/docker/ansible/roles/config_files/templates/network.conf.j2 b/docker/flask_app/Dockerfile index c89a18eb..67e6d589 100644 --- a/docker/ansible/roles/config_files/templates/network.conf.j2 +++ b/docker/flask_app/Dockerfile @@ -1,20 +1,25 @@ -#Copyright 2018 OPNFV and Intel Corporation +# Copyright 2021 Anuket and others. All rights reserved. # # 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 +# 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. +# + +FROM python:3-alpine + +EXPOSE 5000 -LoadPlugin network +WORKDIR /app +COPY ./ /app -#this is auto-filled using ansible script -<Plugin network> -</Plugin> +RUN python -m pip install -r requirements.txt +ENTRYPOINT ["python", "flask_app.py"] diff --git a/docker/flask_app/README b/docker/flask_app/README new file mode 100644 index 00000000..03f8f3ff --- /dev/null +++ b/docker/flask_app/README @@ -0,0 +1,45 @@ +To build this run: + sudo docker build -t my-flask-app . + +To run the app and see collectd metrics: + + sudo docker run -d --net=host my-flask-app + OR + sudo docker run -d -p 5000:5000 my-flask-app + +and configure collectd to use the write_http plugin: + + LoadPlugin write_http + + <Plugin "write_http"> + <Node "example"> + URL "http://127.0.0.1:5000" + Format Command + # Format JSON + </Node> + </Plugin> + +Format Command is used to make the output more readable for humans. +You can also use JSON. + +Later the server will do something more useful. +To view the metrics that are being sent by collectd, run:: + + sudo docker inspect <container_id> + #OR + sudo docker logs <container_id> + +Metrics from collectd-5.x will use PUTVAL +Metrics from collectd-6.x will use PUTMETRIC + +Sample output:: + + 127.0.0.1 - - [21/Apr/2021 19:31:49] "POST / HTTP/1.1" 200 - + PUTVAL fbae30cc-2f20-11b2-a85c-819293100691/turbostat-cpu00/gauge-TSC interval=10.000 1619029909.268:2112.02271161789 + PUTVAL fbae30cc-2f20-11b2-a85c-819293100691/turbostat-cpu00/frequency-busy interval=10.000 1619029909.268:1613.51555288381 + PUTVAL fbae30cc-2f20-11b2-a85c-819293100691/turbostat-cpu00/percent-c1 interval=10.000 1619029909.268:86.2353665532377 + PUTVAL fbae30cc-2f20-11b2-a85c-819293100691/turbostat-cpu00/frequency-average interval=10.000 1619029909.268:222.094501460956 + PUTVAL fbae30cc-2f20-11b2-a85c-819293100691/turbostat-pkg00/temperature interval=10.000 1619029909.268:53 + PUTVAL fbae30cc-2f20-11b2-a85c-819293100691/turbostat-pkg00/temperature-tcc_activation interval=10.000 1619029909.268:100 + PUTVAL fbae30cc-2f20-11b2-a85c-819293100691/turbostat-cpu04/frequency-average interval=10.000 1619029909.268:206.978572579757 + diff --git a/docker/flask_app/flask_app.py b/docker/flask_app/flask_app.py new file mode 100644 index 00000000..771a91bc --- /dev/null +++ b/docker/flask_app/flask_app.py @@ -0,0 +1,16 @@ +from flask import Flask, request +import json + +app = Flask(__name__) + +@app.route('/', methods=['GET', 'POST']) +def get_data(): + #print(request.data) + #print(type(request.data)) + print(request.data.decode('utf-8')) + #print(json.loads(request.data.decode("utf-8"))) + + return 'This is working!' + +if __name__=='__main__': + app.run(debug=True, host='0.0.0.0') diff --git a/docker/flask_app/requirements.txt b/docker/flask_app/requirements.txt new file mode 100644 index 00000000..e3e9a71d --- /dev/null +++ b/docker/flask_app/requirements.txt @@ -0,0 +1 @@ +Flask |