Skip to content

Commit

Permalink
add check for proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsver committed Jun 17, 2024
1 parent 924ee84 commit 299a03d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
23 changes: 23 additions & 0 deletions resources/libraries/get_monitor_in_proxy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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
8 changes: 5 additions & 3 deletions resources/libraries/get_pipelines.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
module Rb_manager
module RbManager
module Helpers

def get_pipelines()
logstash_pipelines = []
sensors = get_sensors_info()
namespaces = get_namespaces()
main_logstash = determine_main_logstash_node()
monitor_sensor_in_proxy_nodes = find_monitor_sensor_in_proxy_nodes()

if manager_services["logstash"]
logstash_pipelines.push("rbwindow-pipeline") if main_logstash == node.name
Expand All @@ -20,8 +21,8 @@ def get_pipelines()
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?
logstash_pipelines.push("redfish-pipeline") unless sensors['device-sensor'].empty? && monitor_sensor_in_proxy_nodes.empty?
logstash_pipelines.push("bulkstats-pipeline") unless sensors['device-sensor'].empty? && monitor_sensor_in_proxy_nodes.empty?
end
logstash_pipelines
end
Expand All @@ -35,5 +36,6 @@ def determine_main_logstash_node()
main_logstash_nodes = memcached_nodes & logstash_nodes
main_logstash_nodes.first || logstash_nodes.first
end

end
end

0 comments on commit 299a03d

Please sign in to comment.