Last active
June 14, 2016 15:55
-
-
Save grosscol/31036754b5e5bbb5ea7995cc812ab9e6 to your computer and use it in GitHub Desktop.
Grabbing status of solr cores via restful api
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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