lib/lbrt/alert.rb in lbrt-0.1.3 vs lib/lbrt/alert.rb in lbrt-0.1.4

- old
+ new

@@ -5,9 +5,27 @@ @client = client @options = options @driver = Lbrt::Driver.new(@client, @options) end + def peco + alert_by_name = {} + + @client.alerts.get.each do |alrt| + alert_id = alrt.fetch('id') + name = alrt.fetch('name') + next unless Lbrt::Utils.matched?(name, @options[:target]) + alert_by_name[name] = alert_id + end + + result = PecoSelector.select_from(alert_by_name) + + result.each do |alert_id| + url = "https://metrics.librato.com/alerts#/#{alert_id}" + Lbrt::Utils.open(url) + end + end + def export(export_options = {}) exported = Lbrt::Alert::Exporter.export(@client, @options) Lbrt::Alert::DSL.convert(exported, @options) end