bin/metrics-haproxy.rb in sensu-plugins-haproxy-1.1.0 vs bin/metrics-haproxy.rb in sensu-plugins-haproxy-1.2.0
- old
+ new
@@ -81,11 +81,11 @@
long: '--backends BACKEND1[,BACKEND2]',
proc: proc { |l| l.split(',') },
default: [] # an empty list means show all backends
option :server_metrics,
- description: 'Add metrics for backend servers',
+ description: 'Gathers additional frontend metrics, i.e. total requests',
boolean: true,
long: '--server-metrics',
default: false
option :retries,
@@ -174,9 +174,12 @@
output "#{config[:scheme]}.#{line[0]}.response_time", line[60]
output "#{config[:scheme]}.#{line[0]}.average_time", line[61]
elsif config[:server_metrics]
output "#{config[:scheme]}.#{line[0]}.#{line[1]}.session_total", line[7]
output "#{config[:scheme]}.#{line[0]}.#{line[1]}.session_current", line[4]
+ output "#{config[:scheme]}.#{line[0]}.#{line[1]}.requests_per_second", line[46]
+ output "#{config[:scheme]}.#{line[0]}.#{line[1]}.requests_per_second_max", line[47]
+ output "#{config[:scheme]}.#{line[0]}.#{line[1]}.requests_total", line[48]
end
if line[1] != 'BACKEND' && !line[1].nil?
up_by_backend[line[0]] ||= 0
up_by_backend[line[0]] += line[17].start_with?('UP') ? 1 : 0