Skip to content

Commit

Permalink
Merge pull request #126 from redBorder/bugfix/#17049_logstash_pipelin…
Browse files Browse the repository at this point in the history
…e_crash_fix

imported logstash template from centos6
  • Loading branch information
jsotofernandez authored May 2, 2024
2 parents 4a23974 + 3268d47 commit c91f2b4
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
38 changes: 38 additions & 0 deletions resources/libraries/get_pipelines.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module Rb_manager
module Helpers

def get_pipelines()
logstash_pipelines = []
sensors = node["redborder"]["sensors_info_all"]
namespaces = get_namespaces()
main_logstash = determine_main_logstash_node()

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 and !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? or sensors["mse-sensor"].empty? or sensors["flow-sensor"].empty? or 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?
end
end

# The main logstash is a node where both memcached and logstash are running or the first logstash node (order by name).
# This main logasths node is gonna run the pipelines rbwindow, location, mobility, nmsp, meraki and radius
# Those pipelines should only run in one node (the main_logstash node) for now..
def determine_main_logstash_node()
memcached_nodes = managers_per_service["memcached"].sort.uniq
logstash_nodes = managers_per_service["logstash"].sort.uniq
main_logstash_nodes = memcached_nodes & logstash_nodes
main_logstash_nodes.first || logstash_nodes.first
end
end
end
1 change: 1 addition & 0 deletions resources/recipes/configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@
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

Expand Down
5 changes: 4 additions & 1 deletion resources/recipes/prepare_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
node.default["redborder"]["services"]["consul-client"] = true
end

#Set :ipaddress_sync
#Set :ipaddress_sync
ipaddress_sync=node["ipaddress"]
sync_net = `cat /etc/redborder/rb_init_conf.yml | grep sync_net | awk '{print $2'} | sed 's|/.*||'`.strip
node['network']['interfaces'].each do |interface, details|
Expand Down Expand Up @@ -95,6 +95,9 @@
#get sensors info of all flow sensors
node.default["redborder"]["all_flow_sensors_info"] = get_all_flow_sensors_info()

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

#get namespaces
node.default["redborder"]["namespaces"] = get_namespaces

Expand Down

0 comments on commit c91f2b4

Please sign in to comment.