Skip to content

Commit

Permalink
Merge branch 'development' into bugfix/#16981_fixing_wakeup_call
Browse files Browse the repository at this point in the history
  • Loading branch information
ljblancoredborder committed May 16, 2024
2 parents 4d648d9 + 6911318 commit 992d422
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 31 deletions.
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
===============

## 1.7.10

- nilsver
- [f66e148] added conditional check on pipelines

## 1.7.9

- Miguel Álvarez
- [1c900b6] Update prepare_system.rb
- [f9d986c] Update memory_services.rb
- [546e802] rename to excluded_memory_services

## 1.7.8

- nilsver
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ rpm:
$(MAKE) -C packaging/rpm

rpmtest:
$(MAKE) LATEST=`git stash create` -C packaging/rpm
$(MAKE) LATEST=`git stash create` -C packaging/rpm

clean:
rm -rf SOURCES pkgs
17 changes: 10 additions & 7 deletions resources/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@
default["redborder"]["memory_services"]["redborder-cep"] = {"count" => 10, "memory" => 0 }
default["redborder"]["memory_services"]["rb-aioutliers"] = {"count" => 10, "memory" => 0 }

# exclude mem services, setting memory to 0 for each.
default['redborder']['excluded_memory_services'] = %w[chef-client]

# default attributes for managers_info, it would be rewriten with the cluster config
default["redborder"]["cluster_info"] = {}
default["redborder"]["cluster_info"][node["hostname"]] = {}
Expand All @@ -106,12 +109,12 @@
default["redborder"]["memory_assigned"] = {}

# geoip has been removed because is not a service
default["redborder"]["services_group"]["full"] = %w[consul chef-server zookeeper memcached rsyslog kafka logstash s3
postgresql redborder-postgresql nginx webui druid-broker
druid-historical druid-realtime druid-coordinator f2k
redborder-monitor pmacct redborder-dswatcher
redborder-events-counter http2k
]
default["redborder"]["services_group"]["full"] = %w[
consul chef-server zookeeper memcached rsyslog kafka logstash s3
redborder-ale postgresql redborder-postgresql nginx webui druid-broker
druid-historical druid-realtime druid-coordinator f2k redborder-monitor
pmacct redborder-dswatcher redborder-events-counter http2k
]

default["redborder"]["services_group"]["custom"] = []
default["redborder"]["services_group"]["core"] = %w[consul zookeeper druid-coordinator druid-overlord hadoop-resourcemanager] #consul server
Expand Down Expand Up @@ -167,7 +170,7 @@
default["redborder"]["services"]["redborder-events-counter"] = false
default["redborder"]["services"]["rsyslog"] = true
default["redborder"]["services"]["redborder-nmsp"] = false
default["redborder"]["services"]["redborder-ale"] = false
default["redborder"]["services"]["redborder-ale"] = true
default["redborder"]["services"]["n2klocd"] = false
default["redborder"]["services"]["radiusd"] = false

Expand Down
27 changes: 15 additions & 12 deletions resources/libraries/memory_services.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ def memory_services(sysmem_total, excluded_services=[])

node["redborder"]["memory_services"].each do |name,mem_s|
if node["redborder"]["services"][name] and !excluded_services.include?(name)
memory_services_size = memory_services_size + mem_s["count"]
if !node["redborder"]["excluded_memory_services"].include?(name)
memory_services_size = memory_services_size + mem_s["count"]
end
end
memory_services_size_total = memory_services_size_total + mem_s["count"]
end
Expand All @@ -24,17 +26,18 @@ def memory_services(sysmem_total, excluded_services=[])
node["redborder"]["memory_services"].each do |name,mem_s|

if node["redborder"]["services"][name] and !excluded_services.include?(name)

# service count memory assigned * system memory / assigned services memory size
memory_serv[name] = (mem_s["count"] * sysmem_total / memory_services_size).round
#if the service has a limit of memory, we have to recalculate all using recursivity
if !mem_s["max_limit"].nil? and memory_serv[name] > mem_s["max_limit"]
memlimit_found = true
excluded_services << name
#assigning the limit of memory for this service
node.default["redborder"]["memory_services"][name]["memory"] = mem_s["max_limit"]
#now we have to take off the memory excluded from the total to recalculate memory wihout excluded services by limit
sysmem_total_limitsless = sysmem_total - mem_s["max_limit"]
if !node["redborder"]["excluded_memory_services"].include?(name)
# service count memory assigned * system memory / assigned services memory size
memory_serv[name] = (mem_s["count"] * sysmem_total / memory_services_size).round
#if the service has a limit of memory, we have to recalculate all using recursivity
if !mem_s["max_limit"].nil? and memory_serv[name] > mem_s["max_limit"]
memlimit_found = true
excluded_services << name
#assigning the limit of memory for this service
node.default["redborder"]["memory_services"][name]["memory"] = mem_s["max_limit"]
#now we have to take off the memory excluded from the total to recalculate memory wihout excluded services by limit
sysmem_total_limitsless = sysmem_total - mem_s["max_limit"]
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion resources/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
license 'All rights reserved'
description 'Installs/Configures redborder manager'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '1.7.8'
version '1.7.10'

depends 'chef-server'
depends 'zookeeper'
Expand Down
24 changes: 15 additions & 9 deletions resources/recipes/configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -275,15 +275,21 @@
action (manager_services["pmacct"] ? [:add, :register] : [:remove, :deregister])
end

logstash_config "Configure logstash" do
cdomain node["redborder"]["cdomain"]
flow_nodes node["redborder"]["all_flow_sensors_info"]["flow-sensor"]
namespaces node["redborder"]["namespaces"]
vault_nodes node["redborder"]["sensors_info_all"]["vault-sensor"]
scanner_nodes node["redborder"]["sensors_info_all"]["scanner-sensor"]
device_nodes node["redborder"]["sensors_info_all"]["device-sensor"]
logstash_pipelines node["redborder"]["logstash"]["pipelines"]
action (manager_services["logstash"] ? [:add, :register] : [:remove, :deregister])
if node["redborder"]["logstash"]["pipelines"].nil? || node["redborder"]["logstash"]["pipelines"].empty?
service 'logstash' do
action [:disable, :stop]
end
else
logstash_config "Configure logstash" do
cdomain node["redborder"]["cdomain"]
flow_nodes node["redborder"]["all_flow_sensors_info"]["flow-sensor"]
namespaces node["redborder"]["namespaces"]
vault_nodes node["redborder"]["sensors_info_all"]["vault-sensor"]
scanner_nodes node["redborder"]["sensors_info_all"]["scanner-sensor"]
device_nodes node["redborder"]["sensors_info_all"]["device-sensor"]
logstash_pipelines node["redborder"]["logstash"]["pipelines"]
action (manager_services["logstash"] ? [:add, :register] : [:remove, :deregister])
end
end

rbdswatcher_config "Configure redborder-dswatcher" do
Expand Down
1 change: 0 additions & 1 deletion resources/recipes/prepare_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@
#node attributes related with memory are changed inside the function to have simplicity using recursivity
memory_services(sysmem_total)


#License

modules = ["ips", "flow", "monitor", "location", "api", "malware", "vault"]
Expand Down
6 changes: 6 additions & 0 deletions resources/templates/default/redborder-manager.erb
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,9 @@ webui
/usr/bin/env BOOTUP=none /usr/lib/redborder/bin/rb_create_bulkstats_columns.sh *,
/usr/lib/redborder/bin/rb_create_rsa.sh *
".gsub(/\s+/, ' ').strip %>
<%="
redborder-ale
ALL=NOPASSWD:SETENV:
/usr/lib/rvm/rubies/ruby-2.7.5/bin/ruby,
/var/rb-ale/bin/rb_ale.rb
".gsub(/\s+/, ' ').strip %>

0 comments on commit 992d422

Please sign in to comment.