bin/check-influxdb-query.rb in sensu-plugins-influxdb-1.3.0 vs bin/check-influxdb-query.rb in sensu-plugins-influxdb-1.4.0

- old
+ new

@@ -112,11 +112,12 @@ option :mode, short: '-m MODE', long: '--mode MODE', default: 'first', - description: 'How the results are being checked (one of "first", "last", "max", "min", "avg") when the query returns more than one value' + description: 'How the results are being checked (one of "first", "last", "max", "min", "sum", "avg") when the query returns more than one value', + in: %w(first last max min sum avg average) option :jsonpath, short: '-j JSONPATH', long: '--jsonpath JSONPATH', default: nil, @@ -218,12 +219,14 @@ jpath.on(value).last when 'min' jpath.on(value).min when 'max' jpath.on(value).max + when 'sum' + jpath.on(value).inject(:+) when 'avg', 'average' jpath.on(value).inject(:+).to_f / jpath.on(value).length - else + when 'first' jpath.on(value).first end end end