server-scripts/netdata-rauter.rb
2018-09-13 07:43:21 +00:00

10 lines
282 B
Ruby

require 'open-uri'
req = open('http://rauter.evenet.dn42:19999/api/v1/allmetrics?format=prometheus')
req.each_line do |l|
l.gsub!(/#.*/,"")
if l =~ /([^{]+){[^}]+}\s+(\d+)\s+\d+/
metric, val = $1, $2
puts "#{metric.gsub("_", ".")} #{val} #{Time.new.utc.to_i}"
end
end