Skip to content

Commit

Permalink
Merge pull request #38 from redBorder/development
Browse files Browse the repository at this point in the history
Release 0.3.0
  • Loading branch information
ljblancoredborder authored Jul 30, 2024
2 parents c939764 + 4a64c6d commit 2bda259
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 3 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
cookbook-rb-proxy CHANGELOG
===============

## 0.3.0

- nilsver
- [e1272bb] add check for monitor configuration pipelines
- [6185bfa], [08f57da] fix logstash not running when pipelines empty
- [ec5d379] update configure.rb
- [c35b312] logstash should not be running when there are no pipelines
- Miguel Alvarez
- [2be5b59] Fix configure clamscan
- [2e0b86b] Add clamav

## 0.2.5

- nilsver
Expand Down
3 changes: 2 additions & 1 deletion resources/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
default['redborder']['services']['redborder-scanner'] = true
default['redborder']['services']['snmp'] = true
default['redborder']['services']['f2k'] = true
default['redborder']['services']['logstash'] = true
default['redborder']['services']['logstash'] = false
default['redborder']['services']['pmacct'] = true
default['redborder']['services']['rsyslog'] = true
default['redborder']['services']['redborder-nmsp'] = true
Expand All @@ -57,6 +57,7 @@
default['redborder']['services']['radiusd'] = false
default['redborder']['services']['k2http'] = true
default['redborder']['services']['redborder-exporter'] = true
default['redborder']['services']['clamav'] = true

default['redborder']['systemdservices']['chef-client'] = ['chef-client']
default['redborder']['systemdservices']['kafka'] = ['kafka']
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 RbProxy
module Helpers
def get_monitor_configuration
proxy_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'
proxy_config << monitor['name']
end
end
end
proxy_config
end
end
end
17 changes: 17 additions & 0 deletions resources/libraries/get_pipelines.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module RbProxy
module Helpers
def get_pipelines
logstash_pipelines = []
sensors = get_sensors_info()
proxy_config = get_monitor_configuration()
has_device_sensors = !sensors['device-sensor'].nil? && !sensors['device-sensor'].empty?
contains_thermal = proxy_config.include?('thermal')
contains_bulkstats = proxy_config.include?('bulkstats_schema')

logstash_pipelines.push('redfish-pipeline') if has_device_sensors && contains_thermal
logstash_pipelines.push('bulkstats-pipeline') if has_device_sensors && contains_bulkstats

logstash_pipelines
end
end
end
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 'git@redborder.com'
license 'AGPL-3.0'
description 'Installs/Configures redborder proxy'
version '0.2.5'
version '0.3.0'

depends 'rb-common'
depends 'rb-selinux'
Expand All @@ -24,3 +24,4 @@
# depends 'freeradius'
depends 'k2http'
depends 'rbcgroup'
depends 'rb-clamav'
7 changes: 6 additions & 1 deletion resources/recipes/configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@
namespaces node.run_state['namespaces']
vault_nodes node.run_state['sensors_info_all']['vault-sensor']
device_nodes node.run_state['sensors_info_all']['device-sensor']
if proxy_services['logstash']
logstash_pipelines node.default['pipelines']
if !logstash_pipelines.nil? && !logstash_pipelines.empty?
action [:add]
else
action [:remove]
Expand Down Expand Up @@ -169,6 +170,10 @@
action :add
end

rb_clamav_config 'Configure ClamAV' do
action(proxy_services['clamav'] ? :add : :remove)
end

# MOTD
manager = `grep 'cloud_address' /etc/redborder/rb_init_conf.yml | cut -d' ' -f2`

Expand Down
3 changes: 3 additions & 0 deletions resources/recipes/prepare_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
# get namespaces
node.run_state['namespaces'] = get_namespaces

# get logstash pipelines
node.default['pipelines'] = get_pipelines()

# get string with all zookeeper hosts and port separated by commas, its needed for multiples services
# zk_port = node['redborder']['zookeeper']['port']
# zk_hosts = ['localhost'].map {|z| '#{z}.node:#{zk_port}'}.join(',')
Expand Down

0 comments on commit 2bda259

Please sign in to comment.