Class: Sensu::Plugin::Metric::CLI::Graphite

Inherits:
CLI
  • Object
show all
Defined in:
lib/sensu-plugin/metric/cli.rb

Instance Attribute Summary

Attributes inherited from CLI

#argv

Instance Method Summary collapse

Methods inherited from CLI

#initialize, method_added, #run

Constructor Details

This class inherits a constructor from Sensu::Plugin::CLI

Instance Method Details

#output(*args) ⇒ String

Note:

the argument order should be: ‘metric_path`: Mandatory, name for the metric, `value`: Mandatory, metric value `timestamp`: Optional, unix timestamp, defaults to current time

Outputs metrics using the Statsd datagram format

Parameters:

  • args (Array<String, Int>)

    list of arguments

Returns:

  • (String)

    formated metric data



28
29
30
31
32
33
34
35
36
# File 'lib/sensu-plugin/metric/cli.rb', line 28

def output(*args)
  return if args.empty?
  if args[0].is_a?(Exception) || args[1].nil?
    puts args[0].to_s
  else
    args[2] ||= Time.now.to_i
    puts args[0..2].join("\s")
  end
end