-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsolr_document_cache
More file actions
32 lines (26 loc) · 996 Bytes
/
Copy pathsolr_document_cache
File metadata and controls
32 lines (26 loc) · 996 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'
if ARGV.length > 0 && ARGV[0] == 'config'
puts "graph_category solr"
puts "graph_title Document Cache"
puts "graph_vlabel times / ${graph_period}"
puts "lookups.label lookups"
puts "lookups.type DERIVE"
puts "hits.label hits"
puts "hits.type DERIVE"
puts "inserts.label inserts"
puts "inserts.type DERIVE"
puts "evictions.label evictions"
puts "evictions.type DERIVE"
exit(0)
end
solr_stats_url = ENV['solr_stats_url'] || 'http://localhost:8080/solr/admin/stats.jsp'
xpath = '//CACHE/entry[2]/stats'
solr_stats = open(solr_stats_url)
doc = REXML::Document.new(solr_stats)
stats = doc.elements[xpath]
puts "lookups.value #{stats.elements[8].text.slice(/\s*([0-9.]*)\s*/, 1)}"
puts "hits.value #{stats.elements[9].text.slice(/\s*([0-9.]*)\s*/, 1)}"
puts "inserts.value #{stats.elements[11].text.slice(/\s*([0-9.]*)\s*/, 1)}"
puts "evictions.value #{stats.elements[12].text.slice(/\s*([0-9.]*)\s*/, 1)}"