From b742c9d191db1cfd5959d692771b047565631b85 Mon Sep 17 00:00:00 2001 From: Kamil Wiatrowski Date: Thu, 18 Apr 2019 13:33:39 +0200 Subject: ansible: add variable to select collectd container Add a variable to playbooks to select type of collectd container. Container flavor can be stable, master or experimental. Change-Id: Ie591ca3b7816210c377c5bffbb54117f8ee764aa Signed-off-by: Kamil Wiatrowski --- docker/ansible/default.inv | 3 + .../ansible/roles/config_files/tasks/logparser.yml | 23 ++ docker/ansible/roles/config_files/tasks/main.yml | 3 + .../roles/config_files/tasks/snmp_agent.yml | 11 +- .../templates/experimental/logparser.conf.j2 | 74 ++++ .../templates/master/snmp_agent.conf.j2 | 397 +++++++++++++++++++++ docker/ansible/roles/run_collectd/tasks/main.yml | 6 +- docker/ansible/roles/run_collectd/vars/main.yml | 21 ++ 8 files changed, 534 insertions(+), 4 deletions(-) create mode 100644 docker/ansible/roles/config_files/tasks/logparser.yml create mode 100644 docker/ansible/roles/config_files/templates/experimental/logparser.conf.j2 create mode 100644 docker/ansible/roles/config_files/templates/master/snmp_agent.conf.j2 create mode 100644 docker/ansible/roles/run_collectd/vars/main.yml diff --git a/docker/ansible/default.inv b/docker/ansible/default.inv index 0f76e9cc..fb366577 100644 --- a/docker/ansible/default.inv +++ b/docker/ansible/default.inv @@ -13,6 +13,9 @@ 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 +flavor=stable [influxdb_hosts] #hostname or ip must be used. diff --git a/docker/ansible/roles/config_files/tasks/logparser.yml b/docker/ansible/roles/config_files/tasks/logparser.yml new file mode 100644 index 00000000..615d2e2b --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/logparser.yml @@ -0,0 +1,23 @@ +#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. +--- + +- name: enable logparser plugin + template: + src: experimental/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 1bf66985..58cfec63 100644 --- a/docker/ansible/roles/config_files/tasks/main.yml +++ b/docker/ansible/roles/config_files/tasks/main.yml @@ -50,6 +50,9 @@ - name: enable logfile plugin import_tasks: logfile.yml +- name: enable logparser plugin + import_tasks: logparser.yml + - name: enable mcelog plugin import_tasks: mcelog.yml diff --git a/docker/ansible/roles/config_files/tasks/snmp_agent.yml b/docker/ansible/roles/config_files/tasks/snmp_agent.yml index 603dc122..c72aee48 100644 --- a/docker/ansible/roles/config_files/tasks/snmp_agent.yml +++ b/docker/ansible/roles/config_files/tasks/snmp_agent.yml @@ -1,4 +1,4 @@ -#Copyright 2018 OPNFV and Intel Corporation +#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. @@ -17,5 +17,14 @@ template: src: snmp_agent.conf.j2 dest: "{{ config_file_dir }}/snmp_agent.conf" + when: flavor|default('stable')|string == 'stable' + tags: + - snmp + +- name: enable snmp agent for master container + template: + src: master/snmp_agent.conf.j2 + dest: "{{ config_file_dir }}/snmp_agent.conf" + when: flavor|default('stable')|string != 'stable' tags: - snmp diff --git a/docker/ansible/roles/config_files/templates/experimental/logparser.conf.j2 b/docker/ansible/roles/config_files/templates/experimental/logparser.conf.j2 new file mode 100644 index 00000000..3802768b --- /dev/null +++ b/docker/ansible/roles/config_files/templates/experimental/logparser.conf.j2 @@ -0,0 +1,74 @@ +# Copyright 2019 OPNFV +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +LoadPlugin logparser + + + + FirstFullRead false + + DefaultType "pcie_error" + DefaultSeverity "warning" + + Regex "AER:.*error received" + SubmatchIdx -1 + + + Regex "(... .. ..:..:..) .* pcieport.*AER" + SubmatchIdx 1 + IsMandatory false + + + Regex "pcieport (.*): AER:" + SubmatchIdx 1 + IsMandatory true + + + PluginInstance true + Regex " ([0-9a-fA-F:\\.]*): PCIe Bus Error" + SubmatchIdx 1 + IsMandatory false + + + Regex "severity=" + SubMatchIdx -1 + + + Regex "severity=.*\\([nN]on-[fF]atal" + TypeInstance "non_fatal" + IsMandatory false + + + Regex "severity=.*\\([fF]atal" + Severity "failure" + TypeInstance "fatal" + IsMandatory false + + + Regex "severity=Corrected" + TypeInstance "correctable" + IsMandatory false + + + Regex "type=(.*)," + SubmatchIdx 1 + IsMandatory false + + + Regex ", id=(.*)" + SubmatchIdx 1 + + + + diff --git a/docker/ansible/roles/config_files/templates/master/snmp_agent.conf.j2 b/docker/ansible/roles/config_files/templates/master/snmp_agent.conf.j2 new file mode 100644 index 00000000..97a4ce40 --- /dev/null +++ b/docker/ansible/roles/config_files/templates/master/snmp_agent.conf.j2 @@ -0,0 +1,397 @@ +# Copyright 2019 OPNFV +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +LoadPlugin snmp_agent + + +# Intel PMU MIB + + IndexOID "INTEL-PMU-MIB::pmuGroupIndex" + + + Source "PluginInstance" + + Plugin "intel_pmu" + OIDs "INTEL-PMU-MIB::pmuGroupDescr" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "L1-dcache-loads" + OIDs "INTEL-PMU-MIB::pmuL1DCacheLoads" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "L1-dcache-load-misses" + OIDs "INTEL-PMU-MIB::pmuL1DCacheLoadMisses" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "L1-dcache-stores" + OIDs "INTEL-PMU-MIB::pmuL1DCacheStores" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "L1-dcache-store-misses" + OIDs "INTEL-PMU-MIB::pmuL1DCacheStoreMisses" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "L1-dcache-prefetches" + OIDs "INTEL-PMU-MIB::pmuL1DCachePrefetches" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "L1-dcache-prefetch-misses" + OIDs "INTEL-PMU-MIB::pmuL1DCachePrefetchMisses" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "L1-icache-loads" + OIDs "INTEL-PMU-MIB::pmuL1ICacheLoads" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "L1-icache-load-misses" + OIDs "INTEL-PMU-MIB::pmuL1ICacheLoadMisses" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "L1-icache-prefetches" + OIDs "INTEL-PMU-MIB::pmuL1ICachePrefetches" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "L1-icache-prefetch-misses" + OIDs "INTEL-PMU-MIB::pmuL1ICachePrefetchMisses" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "LLC-loads" + OIDs "INTEL-PMU-MIB::pmuLLCLoads" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "LLC-load-misses" + OIDs "INTEL-PMU-MIB::pmuLLCLoadMisses" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "LLC-stores" + OIDs "INTEL-PMU-MIB::pmuLLCStores" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "LLC-store-misses" + OIDs "INTEL-PMU-MIB::pmuLLCStoreMisses" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "LLC-prefetches" + OIDs "INTEL-PMU-MIB::pmuLLCPrefetches" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "LLC-prefetch-misses" + OIDs "INTEL-PMU-MIB::pmuLLCPrefetchMisses" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "dTLB-loads" + OIDs "INTEL-PMU-MIB::pmuDTLBLoads" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "dTLB-load-misses" + OIDs "INTEL-PMU-MIB::pmuDTLBLoadMisses" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "dTLB-stores" + OIDs "INTEL-PMU-MIB::pmuDTLBStores" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "dTLB-store-misses" + OIDs "INTEL-PMU-MIB::pmuDTLBStoreMisses" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "dTLB-prefetches" + OIDs "INTEL-PMU-MIB::pmuDTLBPrefetches" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "dTLB-prefetch-misses" + OIDs "INTEL-PMU-MIB::pmuDTLBPrefetchMisses" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "iTLB-loads" + OIDs "INTEL-PMU-MIB::pmuITLBLoads" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "iTLB-load-misses" + OIDs "INTEL-PMU-MIB::pmuITLBLoadMisses" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "branch-loads" + OIDs "INTEL-PMU-MIB::pmuBranchLoads" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "branch-load-misses" + OIDs "INTEL-PMU-MIB::pmuBranchLoadMisses" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "cpu-cycles" + OIDs "INTEL-PMU-MIB::pmuCpuCycles" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "instructions" + OIDs "INTEL-PMU-MIB::pmuInstructions" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "cache-references" + OIDs "INTEL-PMU-MIB::pmuCacheReferences" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "cache-misses" + OIDs "INTEL-PMU-MIB::pmuCacheMisses" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "branches" + OIDs "INTEL-PMU-MIB::pmuBranches" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "branch-misses" + OIDs "INTEL-PMU-MIB::pmuBranchMisses" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "bus-cycles" + OIDs "INTEL-PMU-MIB::pmuBusCycles" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "cpu-clock" + OIDs "INTEL-PMU-MIB::pmuCpuClock" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "task-clock" + OIDs "INTEL-PMU-MIB::pmuTaskClock" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "context-switches" + OIDs "INTEL-PMU-MIB::pmuContextSwitches" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "cpu-migrations" + OIDs "INTEL-PMU-MIB::pmuCpuMigrations" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "page-faults" + OIDs "INTEL-PMU-MIB::pmuPageFaults" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "minor-faults" + OIDs "INTEL-PMU-MIB::pmuMinorFaults" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "major-faults" + OIDs "INTEL-PMU-MIB::pmuMajorFaults" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "alignment-faults" + OIDs "INTEL-PMU-MIB::pmuAlignmentFaults" + + + Plugin "intel_pmu" + Type "counter" + TypeInstance "emulation-faults" + OIDs "INTEL-PMU-MIB::pmuEmulationFaults" + +
+# Intel RDT MIB + + IndexOID "INTEL-RDT-MIB::rdtGroupIndex" + SizeOID "INTEL-RDT-MIB::rdtGroupNumber" + + + Source "PluginInstance" + + Plugin "intel_rdt" + OIDs "INTEL-RDT-MIB::rdtGroupDescr" + + + Plugin "intel_rdt" + Type "bytes" + TypeInstance "llc" + OIDs "INTEL-RDT-MIB::rdtLlc" + + + Plugin "intel_rdt" + Type "ipc" + OIDs "INTEL-RDT-MIB::rdtIpc" + + + Plugin "intel_rdt" + Type "memory_bandwidth" + TypeInstance "remote" + OIDs "INTEL-RDT-MIB::rdtMbmRemote" + + + Plugin "intel_rdt" + Type "memory_bandwidth" + TypeInstance "local" + OIDs "INTEL-RDT-MIB::rdtMbmLocal" + +
+# Intel Mcelog MIB + + IndexOID "INTEL-MCELOG-MIB::memoryGroupIndex" + + + Source "PluginInstance" + + Plugin "mcelog" + OIDs "INTEL-MCELOG-MIB::memoryGroupDescr" + + + Plugin "mcelog" + Type "errors" + TypeInstance "corrected_memory_errors" + OIDs "INTEL-MCELOG-MIB::memoryCorrectedErrors" + + + Plugin "mcelog" + Type "errors" + TypeInstance "corrected_memory_errors_in_24h" + OIDs "INTEL-MCELOG-MIB::memoryCorrectedTimedErrors" + + + Plugin "mcelog" + Type "errors" + TypeInstance "uncorrected_memory_errors" + OIDs "INTEL-MCELOG-MIB::memoryUncorrectedErrors" + + + Plugin "mcelog" + Type "errors" + TypeInstance "uncorrected_memory_errors_in_24h" + OIDs "INTEL-MCELOG-MIB::memoryUncorrectedTimedErrors" + +
+# Hugepages + + + + Source "PluginInstance" + + Plugin "hugepages" + OIDs "INTEL-HUGEPAGES-MIB::hugepagesNode" + + + Plugin "hugepages" + Type "memory" + TypeInstance "free" + OIDs "INTEL-HUGEPAGES-MIB::hugepagesMemoryFree" + + + Plugin "hugepages" + Type "memory" + TypeInstance "used" + OIDs "INTEL-HUGEPAGES-MIB::hugepagesMemoryUsed" + + + Plugin "hugepages" + Type "vmpage_number" + TypeInstance "free" + OIDs "INTEL-HUGEPAGES-MIB::hugepagesPagesFree" + + + Plugin "hugepages" + Type "vmpage_number" + TypeInstance "used" + OIDs "INTEL-HUGEPAGES-MIB::hugepagesPagesUsed" + + + Plugin "hugepages" + Type "percent" + TypeInstance "free" + OIDs "INTEL-HUGEPAGES-MIB::hugepagesPercentFree" + + + Plugin "hugepages" + Type "percent" + TypeInstance "used" + OIDs "INTEL-HUGEPAGES-MIB::hugepagesPercentUsed" + +
+
diff --git a/docker/ansible/roles/run_collectd/tasks/main.yml b/docker/ansible/roles/run_collectd/tasks/main.yml index c77aad58..744c7a77 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 OPNFV and Intel Corporation +#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. @@ -24,7 +24,7 @@ - name: Remove bar-collectd image docker_image: - name: opnfv/barometer-collectd + name: "{{ collectd_image_name }}" state: absent tags: - rm_images @@ -34,7 +34,7 @@ - name: launch collectd container docker_container: name: bar-collectd - image: opnfv/barometer-collectd + image: "{{ collectd_image_name }}" volumes: - /opt/collectd/etc/collectd.conf.d/:/opt/collectd/etc/collectd.conf.d - /var/run:/var/run diff --git a/docker/ansible/roles/run_collectd/vars/main.yml b/docker/ansible/roles/run_collectd/vars/main.yml new file mode 100644 index 00000000..cebd0f47 --- /dev/null +++ b/docker/ansible/roles/run_collectd/vars/main.yml @@ -0,0 +1,21 @@ +#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. +--- + +default_flavor: "{{ flavor|default('stable')|string }}" +flavor_image_name: "{{ + 'barometer-collectd-master' if (default_flavor == 'master') else + 'barometer-collectd-experimental' if (default_flavor == 'experimental') + else 'barometer-collectd' }}" +collectd_image_name: "{{ 'opnfv/' + flavor_image_name }}" -- cgit 1.2.3-korg