Skip to content

Instantly share code, notes, and snippets.

@grosscol
Last active June 14, 2016 15:55
Show Gist options
  • Save grosscol/31036754b5e5bbb5ea7995cc812ab9e6 to your computer and use it in GitHub Desktop.
Save grosscol/31036754b5e5bbb5ea7995cc812ab9e6 to your computer and use it in GitHub Desktop.
Grabbing status of solr cores via restful api
def cores_status
vars = {
action: "STATUS",
wt: "json"}
target_url = "#{self.solr_admin_url}/cores"
resp = Typhoeus.get(target_url, params: vars)
if resp.response_code == 200
body = JSON.parse!(resp.response_body)
# Array of two elements [name string, info hash]
return body["status"]
else
logger.error("Core status query url: #{target_url}")
logger.error("Core status query response error. Response code #{resp.response_code}")
return []
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment