lib/splash/processes.rb in prometheus-splash-0.6.0 vs lib/splash/processes.rb in prometheus-splash-0.6.1
- old
+ new
@@ -56,11 +56,11 @@
# @param [Hash] options
# @option options [String] :session a session number for log daemon
# @return [Hash] Exiter case :quiet_exit
def notify(options = {})
log = get_logger
- unless verify_service host: @config.prometheus_pushgateway_host ,port: @config.prometheus_pushgateway_port then
+ unless verify_service url: @config.prometheus_pushgateway_url then
return { :case => :service_dependence_missing, :more => "Prometheus Notification not send." }
end
session = (options[:session]) ? options[:session] : log.get_session
log.info "Sending metrics to Prometheus Pushgateway", session
@processes_target.each do |item|
@@ -70,10 +70,10 @@
@metric_status.set(val, labels: { process: item[:process] })
@metric_cpu_percent.set(item[:cpu], labels: { process: item[:process] })
@metric_mem_percent.set(item[:mem], labels: { process: item[:process] })
end
hostname = Socket.gethostname
- url = "http://#{@config.prometheus_pushgateway_host}:#{@config.prometheus_pushgateway_port}/#{@config.prometheus_pushgateway_path}"
+ url = @config.prometheus_pushgateway_url
Prometheus::Client::Push.new('Splash',hostname, url).add(@registry)
log.ok "Sending to Prometheus PushGateway done.", session
return {:case => :quiet_exit }
end