diff --git a/CHANGELOG.md b/CHANGELOG.md index 95ae311..bf8676e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ cookbook-rb-exporter CHANGELOG =============== +## 0.2.0 + + - David Vanhoucke + - [462f9cc] add method to activate the split of the traffic through logstash + ## 0.1.0 - David Vanhoucke diff --git a/resources/metadata.rb b/resources/metadata.rb index 19d864b..c99525b 100644 --- a/resources/metadata.rb +++ b/resources/metadata.rb @@ -3,4 +3,4 @@ maintainer_email 'git@redborder.com' license 'AGPL-3.0' description 'Installs/Configures cookbook-rb-exporter' -version '0.1.0' +version '0.2.0' diff --git a/resources/providers/config.rb b/resources/providers/config.rb index 31bc7aa..a32a5ad 100644 --- a/resources/providers/config.rb +++ b/resources/providers/config.rb @@ -4,6 +4,7 @@ action :add do begin user = new_resource.user + split_traffic_logstash = new_resource.split_traffic_logstash config_dir = new_resource.config_dir arp_ifaces = [] @@ -116,7 +117,7 @@ cookbook 'rb-exporter' mode '0644' retries 2 - variables(observation_id: observation_id, observation_id_filters: observation_id_filters) + variables(observation_id: observation_id, observation_id_filters: observation_id_filters, split_traffic_logstash: split_traffic_logstash) notifies :run, "execute[restart_rb-exporter_#{iface_key}]", :delayed end else diff --git a/resources/resources/config.rb b/resources/resources/config.rb index 110a8e2..ceefd29 100644 --- a/resources/resources/config.rb +++ b/resources/resources/config.rb @@ -6,3 +6,4 @@ attribute :user, kind_of: String, default: 'rb-exporter' attribute :config_dir, kind_of: String, default: '/etc/rb-exporter' +attribute :split_traffic_logstash, kind_of: [TrueClass, FalseClass], default: false diff --git a/resources/templates/default/rb-exporter_pretag_map.erb b/resources/templates/default/rb-exporter_pretag_map.erb index 17dc62d..63bcc4c 100644 --- a/resources/templates/default/rb-exporter_pretag_map.erb +++ b/resources/templates/default/rb-exporter_pretag_map.erb @@ -13,6 +13,7 @@ ! dst_mac, vlan. <% if @observation_id %> +<% if !@split_traffic_logstash %> <% for observation_id_filter in @observation_id_filters %> set_tag2=<%= observation_id_filter['observation_id'] %> filter='src net <%= observation_id_filter['subnet'] %>' <% end %> @@ -20,6 +21,7 @@ <% for observation_id_filter in @observation_id_filters %> set_tag2=<%= observation_id_filter['observation_id'] %> filter='dst net <%= observation_id_filter['subnet'] %>' <% end %> +<% end %> set_tag2=<%=@observation_id%> <% end %>