Skip to content
This repository has been archived by the owner on Nov 15, 2019. It is now read-only.

Commit

Permalink
Adds support to middleware threshold and web sessions conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
josejulio committed Oct 5, 2017
1 parent 1bf92aa commit 45a5779
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ def convert_to_group_conditions(miq_alert)
case eval_method
when "mw_accumulated_gc_duration" then generate_mw_gc_condition(eval_method, options)
when "mw_heap_used", "mw_non_heap_used" then generate_mw_jvm_conditions(eval_method, options)
when "mw_aggregated_active_web_sessions", "mw_aggregated_expired_web_sessions", "mw_aggregated_rejected_web_sessions" then
generate_mw_web_sessions_conditions(eval_method, options)
end
end

Expand Down Expand Up @@ -142,6 +144,27 @@ def generate_mw_compare_condition(data_id, data2_id, operator, data2_multiplier)
c
end

def generate_mw_threshold_condition(data_id, operator, threshold)
c = ::Hawkular::Alerts::Trigger::Condition.new({})
c.trigger_mode = :FIRING
c.data_id = data_id
c.type = :THRESHOLD
c.operator = operator
c.threshold = threshold
c
end

def generate_mw_web_sessions_conditions(eval_method, options)
::Hawkular::Alerts::Trigger::GroupConditionsInfo.new(
[
generate_mw_threshold_condition(
mw_server_metrics_by_column[eval_method],
convert_operator(options[:mw_operator]),
options[:value_mw_threshold].to_i
)
]
end

def convert_operator(op)
case op
when "<" then :LT
Expand Down

0 comments on commit 45a5779

Please sign in to comment.