class Splash::Commands::CmdNotifier
Public Class Methods
new(options={})
click to toggle source
# File lib/splash/commands.rb, line 20 def initialize(options={}) @config = get_config @url = @config.prometheus_pushgateway_url @name = "cmd_#{options[:name].to_s}" @exitcode = options[:exitcode] @time = options[:time] end
Public Instance Methods
notify()
click to toggle source
send metrics to Prometheus PushGateway @return [Bool]
# File lib/splash/commands.rb, line 30 def notify unless verify_service url: @url then return { :case => :service_dependence_missing, :more => "Prometheus Notification not send."} end @@metric_exitcode.set(@exitcode) @@metric_time.set(@time) hostname = Socket.gethostname return Prometheus::Client::Push.new(@name, hostname, @url).add(@@registry) end