Skip to content

Commit

Permalink
fix inflight event calculation, finally.
Browse files Browse the repository at this point in the history
I added @pol to the list of authors because he filed a pull request with fixing exactly that which
I broke. So basically it's his fix.

fixes #28
  • Loading branch information
widhalmt committed Apr 11, 2019
1 parent b4fabcc commit df1ed21
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
9 changes: 5 additions & 4 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Author: Jordan Sissel <jls@semicomplete.com>
Author: Roland Lückl <roland.lueckl@1und1.de>
Author: Thomas Widhalm <thomas.widhalm@netways.de>
Author: Yannick Charton <tontonitch-pro@yahoo.fr>
Jordan Sissel <jls@semicomplete.com>
Pol Llovet <pol.llovet@gmail.com>
Roland Lückl <roland.lueckl@1und1.de>
Thomas Widhalm <thomas.widhalm@netways.de>
Yannick Charton <tontonitch-pro@yahoo.fr>
11 changes: 6 additions & 5 deletions check_logstash
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
# File : check_logstash
# Author : Thomas Widhalm, Netways
# E-Mail: thomas.widhalm@netways.de
# Date : 22/03/2019
# Date : 11/04/2019
#
# Version: 0.7.2-0
# Version: 0.7.3-0
#
# This program is free software; you can redistribute it or modify
# it under the terms of the GNU General Public License version 3.0
#
# Changelog:
# - 0.7.3 fix inflight event calculation
# - 0.7.2 fix handling of xpack-monitoring pipeline
# - 0.7.1 fix multipipeline checks, improve errorhandling
# - 0.6.2 update for multipipeline output
Expand Down Expand Up @@ -359,13 +360,13 @@ class CheckLogstash
events_in = result.get('pipelines.' + named_pipeline[0] + '.events.in').to_i
events_out = result.get('pipelines.' + named_pipeline[0] + '.events.out').to_i

inflight_events = events_out - events_in
inflight_events = events_in - events_out
inflight_arr.push(PerfData.report_counter(result, 'pipelines.' + named_pipeline[0] + '.events.out', nil, nil, 0, nil))
inflight_arr.push(PerfData_derived.report('inflight_events_' + named_pipeline[0], inflight_events, warning_inflight_events_max, critical_inflight_events_max, 0, nil))
end
end
else
inflight_events = (result.get('pipeline.events.out') - result.get('pipeline.events.in')).to_i
inflight_events = (result.get('pipeline.events.in') - result.get('pipeline.events.out')).to_i
inflight_arr.push(PerfData.report_counter(result, 'pipeline.events.out', nil, nil, 0, nil))
inflight_arr.push(PerfData_derived.report('inflight_events', inflight_events, warning_inflight_events_max, critical_inflight_events_max, 0, nil))
end
Expand Down Expand Up @@ -437,7 +438,7 @@ class CheckLogstash
events_in = result.get('pipelines.' + named_pipeline[0] + '.events.in').to_i
events_out = result.get('pipelines.' + named_pipeline[0] + '.events.out').to_i

inflight_events = events_out - events_in
inflight_events = events_in - events_out
inflight_events_report = inflight_events_report + " " + named_pipeline[0] + ": " + inflight_events.to_s + ";"

if critical_inflight_events_max && critical_inflight_events_max < inflight_events
Expand Down
11 changes: 6 additions & 5 deletions lib/check_logstash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
# File : check_logstash
# Author : Thomas Widhalm, Netways
# E-Mail: thomas.widhalm@netways.de
# Date : 22/03/2019
# Date : 11/04/2019
#
# Version: 0.7.2-0
# Version: 0.7.3-0
#
# This program is free software; you can redistribute it or modify
# it under the terms of the GNU General Public License version 3.0
#
# Changelog:
# - 0.7.3 fix inflight event calculation
# - 0.7.2 fix handling of xpack-monitoring pipeline
# - 0.7.1 fix multipipeline checks, improve errorhandling
# - 0.6.2 update for multipipeline output
Expand Down Expand Up @@ -359,13 +360,13 @@ def performance_data(result)
events_in = result.get('pipelines.' + named_pipeline[0] + '.events.in').to_i
events_out = result.get('pipelines.' + named_pipeline[0] + '.events.out').to_i

inflight_events = events_out - events_in
inflight_events = events_in - events_out
inflight_arr.push(PerfData.report_counter(result, 'pipelines.' + named_pipeline[0] + '.events.out', nil, nil, 0, nil))
inflight_arr.push(PerfData_derived.report('inflight_events_' + named_pipeline[0], inflight_events, warning_inflight_events_max, critical_inflight_events_max, 0, nil))
end
end
else
inflight_events = (result.get('pipeline.events.out') - result.get('pipeline.events.in')).to_i
inflight_events = (result.get('pipeline.events.in') - result.get('pipeline.events.out')).to_i
inflight_arr.push(PerfData.report_counter(result, 'pipeline.events.out', nil, nil, 0, nil))
inflight_arr.push(PerfData_derived.report('inflight_events', inflight_events, warning_inflight_events_max, critical_inflight_events_max, 0, nil))
end
Expand Down Expand Up @@ -437,7 +438,7 @@ def inflight_events_health(result)
events_in = result.get('pipelines.' + named_pipeline[0] + '.events.in').to_i
events_out = result.get('pipelines.' + named_pipeline[0] + '.events.out').to_i

inflight_events = events_out - events_in
inflight_events = events_in - events_out
inflight_events_report = inflight_events_report + " " + named_pipeline[0] + ": " + inflight_events.to_s + ";"

if critical_inflight_events_max && critical_inflight_events_max < inflight_events
Expand Down

1 comment on commit df1ed21

@pol
Copy link

@pol pol commented on df1ed21 Apr 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the citation!

Please sign in to comment.