Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.2.0 #160

Merged
merged 21 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions resources/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
17 changes: 17 additions & 0 deletions resources/libraries/get_monitor_configuration.rb
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions resources/libraries/get_monitor_in_proxy.rb
Original file line number Diff line number Diff line change
@@ -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
38 changes: 22 additions & 16 deletions resources/libraries/get_pipelines.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion resources/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
maintainer_email '[email protected]'
license 'AGPL-3.0'
description 'Installs/Configures redborder manager'
version '2.1.0'
version '2.2.0'

depends 'rb-common'
depends 'chef-server'
Expand Down Expand Up @@ -42,4 +42,5 @@
depends 'rblogstatter'
depends 'rb-arubacentral'
depends 'rb-postfix'
depends 'rb-clamav'
depends 'keepalived'
9 changes: 7 additions & 2 deletions resources/recipes/configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion resources/recipes/prepare_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading