sensu-plugins / sensu-plugins-graphite

This plugin provides native Graphite instrumentation for monitoring, including: replication status, various Graphite data queries, mutators, and handlers
http://sensu-plugins.io
MIT License
22 stars 45 forks source link

--until isn't included when retrieving data #58

Open inno-ron opened 6 years ago

inno-ron commented 6 years ago

Seems like the SensuPluginsGraphite::GraphiteProxy.retrieve_data! does not taking the config[:until] value when building the url.

Aka, running a graphite check with --target 'my.metric&until=-2hours isn't like running --target 'my.metric' --until -2hours

majormoses commented 6 years ago

Can you please reference a specific check I am not seeing a --until option.

inno-ron commented 6 years ago

hi @majormoses , I am referring to check-graphite-data but the issue is in the core code that retrieving the graphite url of a check. If you'll check out lib/sensu-plugins-graphite/graphite_proxy/proxy.rb you would see the following line in retrieve_data function, on line 82: url = "#{config[:server]}/render?format=json&target=#{formatted_target}&from=#{config[:from]}" this url missing the following: &until=#{config[:until]} and therefor whoever passes a --until to the check-graphite-data command doesn't affect the check url itself.

majormoses commented 6 years ago

I see, thanks for clarifying. I validated your findings are correct and should be pretty easy to fix. Any chance you would be willing to submit a PR to fix this?

inno-ron commented 6 years ago

@majormoses sure thing. will ping here when done.

inno-ron commented 6 years ago

@majormoses pull request has been created #60