diff --git a/CHANGELOG.md b/CHANGELOG.md index 403534fb..325f42bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,18 @@ cookbook-rb-manager CHANGELOG =============== +## 2.2.0 + + - nilsver + - [0186ecc] add pipeline per monitor configuration + - [b5d56c5] fix check if pipelines are active + - [e557b19] add helper file + - [64b9adc] monitor pipelines work with proxy too + - Miguel Alvarez + - [86e6e36] Add memcached hosts to the webui + - [2be5b59] Fix configure clamscan + - [2e0b86b] Add clamav + ## 2.1.0 - David Vanhoucke diff --git a/resources/attributes/default.rb b/resources/attributes/default.rb index 2005eaeb..e2d32307 100644 --- a/resources/attributes/default.rb +++ b/resources/attributes/default.rb @@ -169,6 +169,7 @@ default['redborder']['services']['radiusd'] = false default['redborder']['services']['postfix'] = true default['redborder']['services']['keepalived'] = false +default['redborder']['services']['clamav'] = true default['redborder']['systemdservices']['chef-client'] = ['chef-client'] default['redborder']['systemdservices']['chef-server'] = ['opscode-erchef'] diff --git a/resources/libraries/get_monitor_configuration.rb b/resources/libraries/get_monitor_configuration.rb new file mode 100644 index 00000000..9cc35dd6 --- /dev/null +++ b/resources/libraries/get_monitor_configuration.rb @@ -0,0 +1,17 @@ +module RbManager + module Helpers + def get_monitor_configuration + monitor_config = [] + sensor = search(:node, 'redborder_monitors:[* TO *] AND name:*device*').sort + sensor.each do |node| + monitors = node.normal['redborder']['monitors'] + monitors.each do |monitor| + if monitor['name'] == 'bulkstats_schema' || monitor['name'] == 'thermal' + monitor_config << monitor['name'] + end + end + end + monitor_config + end + end +end diff --git a/resources/libraries/get_monitor_in_proxy.rb b/resources/libraries/get_monitor_in_proxy.rb new file mode 100644 index 00000000..5482cf9e --- /dev/null +++ b/resources/libraries/get_monitor_in_proxy.rb @@ -0,0 +1,20 @@ +module RbManager + module Helpers + def find_monitor_sensor_in_proxy_nodes + sensors_info = [] + sensor_types = ['proxy-sensor'] + sensor_types.each do |s_type| + begin + sensors = search(:node, "role:#{s_type}") + .map { |s| s.override['redborder']['sensors_mapping']['device'] } + .reject { |device| device.nil? || device.empty? } + + sensors_info.concat(sensors) unless sensors.empty? + rescue NoMethodError + sensors_info = [] + end + end + sensors_info + end + end +end diff --git a/resources/libraries/get_pipelines.rb b/resources/libraries/get_pipelines.rb index 770eebed..62af24be 100644 --- a/resources/libraries/get_pipelines.rb +++ b/resources/libraries/get_pipelines.rb @@ -2,26 +2,32 @@ module RbManager module Helpers def get_pipelines logstash_pipelines = [] - sensors = node.run_state['sensors_info_all'] + sensors = get_sensors_info() namespaces = get_namespaces() main_logstash = determine_main_logstash_node() + monitor_sensor_in_proxy_nodes = find_monitor_sensor_in_proxy_nodes() + monitor_config = get_monitor_configuration() + has_device_sensors = !sensors['device-sensor'].nil? && !sensors['device-sensor'].empty? - if manager_services['logstash'] - logstash_pipelines.push('rbwindow-pipeline') if main_logstash == node.name - logstash_pipelines.push('apstate-pipeline') - logstash_pipelines.push('scanner-pipeline') unless sensors['scanner-sensor'].empty? - logstash_pipelines.push('nmsp-pipeline') if main_logstash == node.name && !sensors['flow-sensor'].empty? - logstash_pipelines.push('radius-pipeline') if main_logstash == node.name - logstash_pipelines.push('vault-pipeline') unless sensors['vault-sensor'].empty? - logstash_pipelines.push('netflow-pipeline') unless sensors['flow-sensor'].empty? - logstash_pipelines.push('sflow-pipeline') unless sensors['flow-sensor'].empty? - logstash_pipelines.push('meraki-pipeline') unless sensors['meraki-sensor'].empty? - logstash_pipelines.push('monitor-pipeline') unless namespaces.empty? - logstash_pipelines.push('location-pipeline') unless sensors['ale-sensor'].empty? || sensors['mse-sensor'].empty? || sensors['flow-sensor'].empty? || sensors['arubacentral-sensor'].empty? - logstash_pipelines.push('mobility-pipeline') - logstash_pipelines.push('redfish-pipeline') unless sensors['device-sensor'].empty? - logstash_pipelines.push('bulkstats-pipeline') unless sensors['device-sensor'].empty? + logstash_pipelines.push('rbwindow-pipeline') if main_logstash == node.name + logstash_pipelines.push('apstate-pipeline') + logstash_pipelines.push('scanner-pipeline') unless sensors['scanner-sensor'].empty? + logstash_pipelines.push('nmsp-pipeline') if main_logstash == node.name && !sensors['flow-sensor'].empty? + logstash_pipelines.push('radius-pipeline') if main_logstash == node.name + logstash_pipelines.push('vault-pipeline') unless sensors['vault-sensor'].empty? + logstash_pipelines.push('netflow-pipeline') unless sensors['flow-sensor'].empty? + logstash_pipelines.push('sflow-pipeline') unless sensors['flow-sensor'].empty? + logstash_pipelines.push('meraki-pipeline') unless sensors['meraki-sensor'].empty? + logstash_pipelines.push('monitor-pipeline') unless namespaces.empty? + logstash_pipelines.push('location-pipeline') unless sensors['ale-sensor'].empty? && sensors['mse-sensor'].empty? && sensors['flow-sensor'].empty? && sensors['arubacentral-sensor'].empty? + logstash_pipelines.push('mobility-pipeline') unless sensors['ale-sensor'].empty? && sensors['mse-sensor'].empty? && sensors['flow-sensor'].empty? && sensors['arubacentral-sensor'].empty? + if (has_device_sensors && monitor_config.include?('thermal')) || !monitor_sensor_in_proxy_nodes.empty? + logstash_pipelines.push('redfish-pipeline') end + if (has_device_sensors && monitor_config.include?('bulkstats_schema')) || !monitor_sensor_in_proxy_nodes.empty? + logstash_pipelines.push('bulkstats-pipeline') + end + logstash_pipelines end diff --git a/resources/metadata.rb b/resources/metadata.rb index 29685054..b7163a59 100644 --- a/resources/metadata.rb +++ b/resources/metadata.rb @@ -3,7 +3,7 @@ maintainer_email 'git@redborder.com' license 'AGPL-3.0' description 'Installs/Configures redborder manager' -version '2.1.0' +version '2.2.0' depends 'rb-common' depends 'chef-server' @@ -42,4 +42,5 @@ depends 'rblogstatter' depends 'rb-arubacentral' depends 'rb-postfix' +depends 'rb-clamav' depends 'keepalived' diff --git a/resources/recipes/configure.rb b/resources/recipes/configure.rb index cceeb254..54a95cc5 100644 --- a/resources/recipes/configure.rb +++ b/resources/recipes/configure.rb @@ -325,6 +325,7 @@ webui_config 'Configure WebUI' do hostname node['hostname'] + memcached_servers node['redborder']['managers_per_services']['memcached'] memory_kb node['redborder']['memory_services']['webui']['memory'] cdomain node['redborder']['cdomain'] port node['redborder']['webui']['port'] @@ -400,8 +401,8 @@ vault_nodes node.run_state['sensors_info_all']['vault-sensor'] scanner_nodes node.run_state['sensors_info_all']['scanner-sensor'] device_nodes node.run_state['sensors_info_all']['device-sensor'] - logstash_pipelines node.run_state['pipelines'] - if manager_services['logstash'] && node.run_state['pipelines'] && !node.run_state['pipelines'].empty? + logstash_pipelines node.default['pipelines'] + if !logstash_pipelines.nil? && !logstash_pipelines.empty? action [:add, :register] else action [:remove, :deregister] @@ -523,6 +524,10 @@ action :add end +rb_clamav_config 'Configure ClamAV' do + action(manager_services['clamav'] ? :add : :remove) +end + # Determine external begin external_services = data_bag_item('rBglobal', 'external_services') diff --git a/resources/recipes/prepare_system.rb b/resources/recipes/prepare_system.rb index 10eadbcf..eac41efc 100644 --- a/resources/recipes/prepare_system.rb +++ b/resources/recipes/prepare_system.rb @@ -101,7 +101,7 @@ node.run_state['all_flow_sensors_info'] = get_all_flow_sensors_info() # get logstash pipelines -node.run_state['pipelines'] = get_pipelines() +node.default['pipelines'] = get_pipelines() # get namespaces node.run_state['namespaces'] = get_namespaces