-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsolr_total_time
More file actions
32 lines (26 loc) · 893 Bytes
/
Copy pathsolr_total_time
File metadata and controls
32 lines (26 loc) · 893 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#! /usr/bin/env ruby
require 'open-uri'
require 'rexml/document'
solr_url = ENV['solr_url'] || 'http://localhost:8080/solr'
solr_core = (ENV['solr_core'] || "").split(',')
query_name = ENV['query_name'] || 'standerd'
xpath = "//entry[normalize-space(name/text())='#{query_name}']"
if ARGV.length > 0 && ARGV[0] == 'config'
puts <<CONFIG
graph_category solr
graph_title Total Time per second
graph_vlabel milisecond / second
graph_args --base 1000 -l 0
CONFIG
solr_core.each do |core|
puts "total_time_#{core.gsub(/-/, '_')}.label #{core}"
puts "total_time_#{core.gsub(/-/, '_')}.type DERIVE"
end
exit(0)
end
solr_core.each do |core|
solr_stats = open("#{solr_url}/#{core}/admin/stats.jsp")
doc = REXML::Document.new(solr_stats)
entry = doc.elements[xpath]
puts "total_time_#{core.gsub(/-/, '_')}.value #{entry.elements['stats/stat[5]'].text.gsub(/\s/, '')}"
end