sensu-plugins / sensu-plugins-sensu

This plugin provides monitoring and metrics for Sensu.
http://sensu-plugins.io
MIT License
12 stars 35 forks source link

[BUG] check-aggregate.rb: alert percentages are incorrect due to type casting #53

Open majormoses opened 6 years ago

majormoses commented 6 years ago

In check-aggregate.rb we cast several options that are percentage based as an integer rather than a float. This means that specifying a float does not do what is expected:

Options improperly cast:

when we compare thresholds this results in an inflated number. Example:

$ irb
irb(main):001:0> 2.5.class
=> Float
irb(main):002:0> 2.5*100
=> 250.0
irb(main):003:0> 2.5.to_i*100
=> 200
irb(main):04:0> 99.99*100
=> 9999.0
irb(main):005:0> 99.99.to_i*100
=> 9900